0
0
Fork 0

Merge pull request #749 from sreekanth-cb/zapfile_cleanup_fix

unblock the files for clean up, esp for merged new segment files
This commit is contained in:
Marty Schoch 2018-02-08 10:53:41 -05:00 committed by GitHub
commit f531a248e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -266,9 +266,7 @@ func (s *Scorch) persistSnapshot(snapshot *IndexSnapshot) error {
for k, v := range s.root.internal {
newIndexSnapshot.internal[k] = v
}
for _, filename := range filenames {
delete(s.ineligibleForRemoval, filename)
}
rootPrev := s.root
s.root = newIndexSnapshot
s.rootLock.Unlock()
@ -276,6 +274,12 @@ func (s *Scorch) persistSnapshot(snapshot *IndexSnapshot) error {
_ = rootPrev.DecRef()
}
}
// allow files to become eligible for removal
s.rootLock.Lock()
for _, filename := range filenames {
delete(s.ineligibleForRemoval, filename)
}
s.rootLock.Unlock()
return nil
}