diff options
| author | Chris Lu <chris.lu@gmail.com> | 2016-09-22 20:31:17 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2016-09-22 20:31:20 -0700 |
| commit | 1bc041b46de0db2e1baa9e56aa0fca2bb61a48b8 (patch) | |
| tree | 91306d68e0f384e3964728685bbbfb61d0dad678 /weed/command/compact.go | |
| parent | 603f8e4f860022325681a122b9fdd8fe2b89502e (diff) | |
| download | seaweedfs-1bc041b46de0db2e1baa9e56aa0fca2bb61a48b8.tar.xz seaweedfs-1bc041b46de0db2e1baa9e56aa0fca2bb61a48b8.zip | |
add a new way to manually compact corrupted volume
fix https://github.com/chrislusf/seaweedfs/issues/371
Diffstat (limited to 'weed/command/compact.go')
| -rw-r--r-- | weed/command/compact.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/weed/command/compact.go b/weed/command/compact.go index ba2fbf867..db11880ec 100644 --- a/weed/command/compact.go +++ b/weed/command/compact.go @@ -23,6 +23,7 @@ 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.") ) func runCompact(cmd *Command, args []string) bool { @@ -37,8 +38,14 @@ func runCompact(cmd *Command, args []string) bool { if err != nil { glog.Fatalf("Load Volume [ERROR] %s\n", err) } - if err = v.Compact(); err != nil { - glog.Fatalf("Compact Volume [ERROR] %s\n", err) + if *compactMethod == 0 { + if err = v.Compact(); err != nil { + glog.Fatalf("Compact Volume [ERROR] %s\n", err) + } + } else { + if err = v.Compact2(); err != nil { + glog.Fatalf("Compact Volume [ERROR] %s\n", err) + } } return true |
