influxdb
influxdb copied to clipboard
fix(tsi): retaining fileset should not copy pointer
Current implementation of retainFileSet is not safe because it returns p.fileSet directly. It is supposed to be protected by mutex:
func (p *Partition) retainFileSet() *FileSet {
fs := p.fileSet
fs.Retain()
return fs
}
The bug may lead to deadlock if the fileset is modified while there is compaction.
The CI will success when https://github.com/influxdata/influxdb/pull/18961 is merged
@dgnorton I suppose this fix needs to be ported back to 1.7/1.8
@foobar - can you make a unit test for this showing the problem?
rereview the code, FileSet.files is actually immutable so the clone is not needed.