Fix panic in FileStore.walkKeys
If a TSM file is replaced while walkKeys is running, a panic could occur because the mmap has been unmapped.pull/9748/head
parent
ede6b2f041
commit
ec3f5c353c
|
@ -311,6 +311,12 @@ func (f *FileStore) WalkKeys(seek []byte, fn func(key []byte, typ byte) error) e
|
|||
return nil
|
||||
}
|
||||
|
||||
// Ensure files are not unmapped while we're iterating over them.
|
||||
for _, r := range f.files {
|
||||
r.Ref()
|
||||
defer r.Unref()
|
||||
}
|
||||
|
||||
ki := newMergeKeyIterator(f.files, seek)
|
||||
f.mu.RUnlock()
|
||||
for ki.Next() {
|
||||
|
|
Loading…
Reference in New Issue