aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-04-26 22:08:34 -0700
committerGitHub <noreply@github.com>2022-04-26 22:08:34 -0700
commiteb49bd5638c9e9860fe4ba7fc54a2e78a84e9941 (patch)
tree6654dee52d406304220bdc341c0a0ec765659a60
parent15c7d6e7bc203620dcc5de8cb5f58a2c4a20dbe0 (diff)
parentd4343ab7da4171088ab328d9d688885b67fd1d0c (diff)
downloadseaweedfs-eb49bd5638c9e9860fe4ba7fc54a2e78a84e9941.tar.xz
seaweedfs-eb49bd5638c9e9860fe4ba7fc54a2e78a84e9941.zip
Merge pull request #2970 from kmlebedev/vlm_fsck_forcePurging
delete missing data from volumes in one replica
-rw-r--r--weed/shell/command_volume_fsck.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.go
index 1aa33e054..584ce722b 100644
--- a/weed/shell/command_volume_fsck.go
+++ b/weed/shell/command_volume_fsck.go
@@ -33,7 +33,8 @@ func init() {
}
type commandVolumeFsck struct {
- env *CommandEnv
+ env *CommandEnv
+ forcePurging *bool
}
func (c *commandVolumeFsck) Name() string {
@@ -68,6 +69,7 @@ func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.
findMissingChunksInFilerPath := fsckCommand.String("findMissingChunksInFilerPath", "/", "used together with findMissingChunksInFiler")
findMissingChunksInVolumeId := fsckCommand.Int("findMissingChunksInVolumeId", 0, "used together with findMissingChunksInFiler")
applyPurging := fsckCommand.Bool("reallyDeleteFromVolume", false, "<expert only!> after detection, delete missing data from volumes / delete missing file entries from filer")
+ c.forcePurging = fsckCommand.Bool("forcePurging", false, "delete missing data from volumes in one replica used together with applyPurging")
purgeAbsent := fsckCommand.Bool("reallyDeleteFilerEntries", 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")
tempPath := fsckCommand.String("tempPath", path.Join(os.TempDir()), "path for temporary idx files")
@@ -293,7 +295,7 @@ func (c *commandVolumeFsck) findExtraChunksInVolumeServers(dataNodeVolumeIdToVIn
}
orphanFileIds := []string{}
for fid, foundInAllReplicas := range orphanReplicaFileIds {
- if !isSeveralReplicas[volumeId] || (isSeveralReplicas[volumeId] && foundInAllReplicas) {
+ if !isSeveralReplicas[volumeId] || *c.forcePurging || (isSeveralReplicas[volumeId] && foundInAllReplicas) {
orphanFileIds = append(orphanFileIds, fid)
}
}
@@ -301,7 +303,7 @@ func (c *commandVolumeFsck) findExtraChunksInVolumeServers(dataNodeVolumeIdToVIn
continue
}
if verbose {
- fmt.Fprintf(writer, "purging process for volume %d", volumeId)
+ fmt.Fprintf(writer, "purging process for volume %d.\n", volumeId)
}
if isEcVolumeReplicas[volumeId] {