aboutsummaryrefslogtreecommitdiff
path: root/weed/command/compact.go
diff options
context:
space:
mode:
authorTom Maxwell <tom.maxwell@4sightimaging.com>2019-09-03 15:41:28 +0100
committerTom Maxwell <tom.maxwell@4sightimaging.com>2019-09-03 15:41:28 +0100
commitd637d86d22f6f4033d931dd59aa86233521246a4 (patch)
tree1b87a4c660a10d921cf87ae17ccef7fcc301e997 /weed/command/compact.go
parent9a459d984bd3fa0da0a45751e7244b82f8bc7b92 (diff)
downloadseaweedfs-d637d86d22f6f4033d931dd59aa86233521246a4.tar.xz
seaweedfs-d637d86d22f6f4033d931dd59aa86233521246a4.zip
Changes to try and pass the URL parameters through - in memory flag not working still
Diffstat (limited to 'weed/command/compact.go')
-rw-r--r--weed/command/compact.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/command/compact.go b/weed/command/compact.go
index df4bcdd6e..7a61f0b95 100644
--- a/weed/command/compact.go
+++ b/weed/command/compact.go
@@ -26,6 +26,7 @@ var (
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("preallocateMB", 0, "preallocate volume disk space")
+ compactVolumeInMemory = cmdCompact.Flag.Bool("volumeInMemory", false, "create the volume in memory")
)
func runCompact(cmd *Command, args []string) bool {
@@ -35,15 +36,16 @@ func runCompact(cmd *Command, args []string) bool {
}
preallocate := *compactVolumePreallocate * (1 << 20)
+ inMemory := *compactVolumeInMemory
vid := needle.VolumeId(*compactVolumeId)
v, err := storage.NewVolume(*compactVolumePath, *compactVolumeCollection, vid,
- storage.NeedleMapInMemory, nil, nil, preallocate)
+ storage.NeedleMapInMemory, nil, nil, preallocate, inMemory)
if err != nil {
glog.Fatalf("Load Volume [ERROR] %s\n", err)
}
if *compactMethod == 0 {
- if err = v.Compact(preallocate, 0); err != nil {
+ if err = v.Compact(preallocate, 0, inMemory); err != nil {
glog.Fatalf("Compact Volume [ERROR] %s\n", err)
}
} else {