vacuum metrics and force sync dst files (#3832)

This commit is contained in:
Konstantin Lebedev
2022-10-13 12:51:20 +05:00
committed by GitHub
parent f5d4952d73
commit 1f7e52c63e
8 changed files with 70 additions and 33 deletions

View File

@@ -180,21 +180,6 @@ func (v *Volume) DiskType() types.DiskType {
return v.location.DiskType
}
func (v *Volume) SetStopping() {
v.dataFileAccessLock.Lock()
defer v.dataFileAccessLock.Unlock()
if v.nm != nil {
if err := v.nm.Sync(); err != nil {
glog.Warningf("Volume SetStopping fail to sync volume idx %d", v.Id)
}
}
if v.DataBackend != nil {
if err := v.DataBackend.Sync(); err != nil {
glog.Warningf("Volume SetStopping fail to sync volume %d", v.Id)
}
}
}
func (v *Volume) SyncToDisk() {
v.dataFileAccessLock.Lock()
defer v.dataFileAccessLock.Unlock()
@@ -228,10 +213,9 @@ func (v *Volume) Close() {
v.nm = nil
}
if v.DataBackend != nil {
if err := v.DataBackend.Sync(); err != nil {
if err := v.DataBackend.Close(); err != nil {
glog.Warningf("Volume Close fail to sync volume %d", v.Id)
}
_ = v.DataBackend.Close()
v.DataBackend = nil
stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Dec()
}