aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage/volume.go')
-rw-r--r--weed/storage/volume.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/weed/storage/volume.go b/weed/storage/volume.go
index 2dfba55c8..bebeded54 100644
--- a/weed/storage/volume.go
+++ b/weed/storage/volume.go
@@ -42,7 +42,8 @@ type Volume struct {
lastCompactIndexOffset uint64
lastCompactRevision uint16
- isCompacting bool
+ isCompacting bool
+ isCommitCompacting bool
volumeInfo *volume_server_pb.VolumeInfo
location *DiskLocation
@@ -190,6 +191,21 @@ func (v *Volume) SetStopping() {
}
}
+func (v *Volume) SyncToDisk() {
+ v.dataFileAccessLock.Lock()
+ defer v.dataFileAccessLock.Unlock()
+ if v.nm != nil {
+ if err := v.nm.Sync(); err != nil {
+ glog.Warningf("Volume Close fail to sync volume idx %d", v.Id)
+ }
+ }
+ if v.DataBackend != nil {
+ if err := v.DataBackend.Sync(); err != nil {
+ glog.Warningf("Volume Close fail to sync volume %d", v.Id)
+ }
+ }
+}
+
// Close cleanly shuts down this volume
func (v *Volume) Close() {
v.dataFileAccessLock.Lock()