Merge pull request #2974 from kmlebedev/wait_volume_closed_compression

waite volume being closed during compression idx
This commit is contained in:
Chris Lu 2022-04-26 23:29:22 -07:00 committed by GitHub
commit ffe028f8d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -211,6 +211,10 @@ func (v *Volume) Close() {
v.dataFileAccessLock.Lock() v.dataFileAccessLock.Lock()
defer v.dataFileAccessLock.Unlock() defer v.dataFileAccessLock.Unlock()
if v.nm != nil { if v.nm != nil {
for v.isCompacting {
glog.Warningf("Volume being closed during compression idx %d", v.Id)
time.Sleep(time.Second)
}
if err := v.nm.Sync(); err != nil { if err := v.nm.Sync(); err != nil {
glog.Warningf("Volume Close fail to sync volume idx %d", v.Id) glog.Warningf("Volume Close fail to sync volume idx %d", v.Id)
} }