aboutsummaryrefslogtreecommitdiff
path: root/weed/command/compact.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/command/compact.go')
-rw-r--r--weed/command/compact.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/command/compact.go b/weed/command/compact.go
index db11880ec..ae54db115 100644
--- a/weed/command/compact.go
+++ b/weed/command/compact.go
@@ -20,10 +20,11 @@ var cmdCompact = &Command{
}
var (
- compactVolumePath = cmdCompact.Flag.String("dir", ".", "data directory to store files")
- compactVolumeCollection = cmdCompact.Flag.String("collection", "", "volume collection name")
- compactVolumeId = cmdCompact.Flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir.")
- compactMethod = cmdCompact.Flag.Int("method", 0, "option to choose which compact method. use 0 or 1.")
+ compactVolumePath = cmdCompact.Flag.String("dir", ".", "data directory to store files")
+ compactVolumeCollection = cmdCompact.Flag.String("collection", "", "volume collection name")
+ compactVolumeId = cmdCompact.Flag.Int("volumeId", -1, "a volume id. The volume should already exist in the dir.")
+ compactMethod = cmdCompact.Flag.Int("method", 0, "option to choose which compact method. use 0 or 1.")
+ compactVolumePreallocate = cmdCompact.Flag.Int64("preallocate", 0, "preallocate volume disk space")
)
func runCompact(cmd *Command, args []string) bool {
@@ -34,7 +35,7 @@ func runCompact(cmd *Command, args []string) bool {
vid := storage.VolumeId(*compactVolumeId)
v, err := storage.NewVolume(*compactVolumePath, *compactVolumeCollection, vid,
- storage.NeedleMapInMemory, nil, nil)
+ storage.NeedleMapInMemory, nil, nil, *compactVolumePreallocate)
if err != nil {
glog.Fatalf("Load Volume [ERROR] %s\n", err)
}