diff options
| author | Chris Lu <chris.lu@gmail.com> | 2017-08-29 23:59:53 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2017-08-29 23:59:53 -0700 |
| commit | 58344980e45fb3a1421fe4f2368e95c08b8b18df (patch) | |
| tree | 58624f613fcd389bf40b782d2f9e4a6153187bb8 /weed/command | |
| parent | f7c22f0159b79d4f6d0a63df9597cfb1e9e6155d (diff) | |
| download | seaweedfs-58344980e45fb3a1421fe4f2368e95c08b8b18df.tar.xz seaweedfs-58344980e45fb3a1421fe4f2368e95c08b8b18df.zip | |
preallocate disk space during compaction also, add cleanup for failed compaction
Diffstat (limited to 'weed/command')
| -rw-r--r-- | weed/command/compact.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/command/compact.go b/weed/command/compact.go index 5c3038c78..0dd4efe0e 100644 --- a/weed/command/compact.go +++ b/weed/command/compact.go @@ -33,14 +33,16 @@ func runCompact(cmd *Command, args []string) bool { return false } + preallocate := *compactVolumePreallocate * (1 << 20) + vid := storage.VolumeId(*compactVolumeId) v, err := storage.NewVolume(*compactVolumePath, *compactVolumeCollection, vid, - storage.NeedleMapInMemory, nil, nil, *compactVolumePreallocate*(1<<20)) + storage.NeedleMapInMemory, nil, nil, preallocate) if err != nil { glog.Fatalf("Load Volume [ERROR] %s\n", err) } if *compactMethod == 0 { - if err = v.Compact(); err != nil { + if err = v.Compact(preallocate); err != nil { glog.Fatalf("Compact Volume [ERROR] %s\n", err) } } else { |
