diff options
| author | chrislu <chris.lu@gmail.com> | 2022-04-26 23:34:05 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-04-26 23:34:05 -0700 |
| commit | 70e5a1b632cafe39379e2c2d91611480efade4bf (patch) | |
| tree | e4558cf8c4930ff5703a1f006039e63f01ea9345 | |
| parent | ffe028f8d097ccf579947478fd5d0785f2d08191 (diff) | |
| download | seaweedfs-70e5a1b632cafe39379e2c2d91611480efade4bf.tar.xz seaweedfs-70e5a1b632cafe39379e2c2d91611480efade4bf.zip | |
volume close should wait for committing compaction
| -rw-r--r-- | weed/storage/volume.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/weed/storage/volume.go b/weed/storage/volume.go index bebeded54..3539efa85 100644 --- a/weed/storage/volume.go +++ b/weed/storage/volume.go @@ -210,11 +210,13 @@ func (v *Volume) SyncToDisk() { func (v *Volume) Close() { v.dataFileAccessLock.Lock() defer v.dataFileAccessLock.Unlock() + + for v.isCommitCompacting { + time.Sleep(521 * time.Millisecond) + glog.Warningf("Volume Close wait for compaction %d", v.Id) + } + 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 { glog.Warningf("Volume Close fail to sync volume idx %d", v.Id) } |
