aboutsummaryrefslogtreecommitdiff
path: root/weed/shell
diff options
context:
space:
mode:
authorRadtoo <56451+Radtoo@users.noreply.github.com>2022-02-06 23:46:52 +0100
committerRadtoo <56451+Radtoo@users.noreply.github.com>2022-02-06 23:46:52 +0100
commitfbb14e0ea8145777486af160958d6c90a4569415 (patch)
treee8d849d4d7165593e66cd85141bb0ead6167ea68 /weed/shell
parent6b17f45da2302b6a36908ff3fc9b0b7606fd677d (diff)
downloadseaweedfs-fbb14e0ea8145777486af160958d6c90a4569415.tar.xz
seaweedfs-fbb14e0ea8145777486af160958d6c90a4569415.zip
Adding separate toggle to purge absent vols
While this toggle is basically required to clean out entries for deleted volumes, having a separate description + toggling this separately seems like a good idea so people get a chance to check if their volumes are all mounted/connected as expected. Also renamed forcePurge to just purge.
Diffstat (limited to 'weed/shell')
-rw-r--r--weed/shell/command_volume_fsck.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.go
index 410b51db3..6a4ab2559 100644
--- a/weed/shell/command_volume_fsck.go
+++ b/weed/shell/command_volume_fsck.go
@@ -64,7 +64,8 @@ func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.
verbose := fsckCommand.Bool("v", false, "verbose mode")
findMissingChunksInFiler := fsckCommand.Bool("findMissingChunksInFiler", false, "see \"help volume.fsck\"")
findMissingChunksInFilerPath := fsckCommand.String("findMissingChunksInFilerPath", "/", "used together with findMissingChunksInFiler")
- applyPurging := fsckCommand.Bool("forcePurge", false, "<expert only!> after detection, delete missing data from volumes / delete missing file entries from filer")
+ applyPurging := fsckCommand.Bool("purge", false, "<expert only!> after detection, delete missing data from volumes / delete missing file entries from filer")
+ purgeAbsent := fsckCommand.Bool("purgeAbsent", false, "<expert only!> delete missing file entries from filer if the corresponding volume is missing for any reason, please ensure all still existing/expected volumes are connected! used together with findMissingChunksInFiler")
if err = fsckCommand.Parse(args); err != nil {
return nil
}
@@ -101,7 +102,7 @@ func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.
if *findMissingChunksInFiler {
// collect all filer file ids and paths
- if err = c.collectFilerFileIdAndPaths(volumeIdToVInfo, tempFolder, writer, *findMissingChunksInFilerPath, *verbose, *applyPurging); err != nil {
+ if err = c.collectFilerFileIdAndPaths(volumeIdToVInfo, tempFolder, writer, *findMissingChunksInFilerPath, *verbose, *purgeAbsent); err != nil {
return fmt.Errorf("collectFilerFileIdAndPaths: %v", err)
}
// for each volume, check filer file ids
@@ -122,7 +123,7 @@ func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.
return nil
}
-func (c *commandVolumeFsck) collectFilerFileIdAndPaths(volumeIdToServer map[uint32]VInfo, tempFolder string, writer io.Writer, filerPath string, verbose bool, applyPurging bool) error {
+func (c *commandVolumeFsck) collectFilerFileIdAndPaths(volumeIdToServer map[uint32]VInfo, tempFolder string, writer io.Writer, filerPath string, verbose bool, purgeAbsent bool) error {
if verbose {
fmt.Fprintf(writer, "checking each file from filer ...\n")
@@ -179,8 +180,8 @@ func (c *commandVolumeFsck) collectFilerFileIdAndPaths(volumeIdToServer map[uint
// fmt.Fprintf(writer, "%d,%x%08x %d %s\n", i.vid, i.fileKey, i.cookie, len(i.path), i.path)
} else {
fmt.Fprintf(writer, "%d,%x%08x %s volume not found\n", i.vid, i.fileKey, i.cookie, i.path)
- if applyPurging {
- fmt.Printf("deleting path %s for volume not found", i.path)
+ if purgeAbsent {
+ fmt.Printf("deleting path %s after volume not found", i.path)
c.httpDelete(i.path, verbose)
}
}