wait to read again if the volume is compacting

This commit is contained in:
Chris Lu
2019-01-05 19:52:17 -08:00
parent fe50224ea0
commit 9383c91eb1
3 changed files with 10 additions and 1 deletions

View File

@@ -43,6 +43,8 @@ func (v *Volume) commitCompact() error {
v.dataFileAccessLock.Lock()
defer v.dataFileAccessLock.Unlock()
glog.V(3).Infof("Got volume %d committing lock...", v.Id)
v.compactingWg.Add(1)
defer v.compactingWg.Done()
v.nm.Close()
if err := v.dataFile.Close(); err != nil {
glog.V(0).Infof("fail to close volume %d", v.Id)