diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-03-31 01:52:40 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-31 01:52:40 -0700 |
| commit | 67d870dfc2b63c9de9d1cfc35c2984b00f1b0d46 (patch) | |
| tree | bd2833e02668e83b9fa8c14eb82e3e484fde395d | |
| parent | 7f4e33ec1574f862ed8fd238e808ae471667dfb7 (diff) | |
| parent | 4f5b018a02e6b2d2c8590d840ae0f3b0ac938a17 (diff) | |
| download | seaweedfs-67d870dfc2b63c9de9d1cfc35c2984b00f1b0d46.tar.xz seaweedfs-67d870dfc2b63c9de9d1cfc35c2984b00f1b0d46.zip | |
Merge pull request #2856 from kmlebedev/fsck_bucket_path
collecting only bucket volumes
| -rw-r--r-- | weed/shell/command_volume_fsck.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.go index 1b3d7bf0d..7d3aa28a5 100644 --- a/weed/shell/command_volume_fsck.go +++ b/weed/shell/command_volume_fsck.go @@ -12,6 +12,7 @@ import ( "net/url" "os" "path/filepath" + "strings" "sync" "github.com/chrislusf/seaweedfs/weed/filer" @@ -92,8 +93,27 @@ func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io. return fmt.Errorf("failed to collect all volume locations: %v", err) } + isBucketsPath := false + var fillerBucketsPath string + if *findMissingChunksInFiler && *findMissingChunksInFilerPath != "" { + fillerBucketsPath, err = readFilerBucketsPath(commandEnv) + if err != nil { + return fmt.Errorf("read filer buckets path: %v", err) + } + if strings.HasPrefix(*findMissingChunksInFilerPath, fillerBucketsPath) { + isBucketsPath = true + } + } + if err != nil { + return fmt.Errorf("read filer buckets path: %v", err) + } + // collect each volume file ids for volumeId, vinfo := range volumeIdToVInfo { + if isBucketsPath && !strings.HasPrefix(*findMissingChunksInFilerPath, fillerBucketsPath+"/"+vinfo.collection) { + delete(volumeIdToVInfo, volumeId) + continue + } err = c.collectOneVolumeFileIds(tempFolder, volumeId, vinfo, *verbose, writer) if err != nil { return fmt.Errorf("failed to collect file ids from volume %d on %s: %v", volumeId, vinfo.server, err) |
