mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
collecting only bucket volumes
This commit is contained in:
parent
7f4e33ec15
commit
4f5b018a02
|
@ -12,6 +12,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer"
|
"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)
|
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
|
// collect each volume file ids
|
||||||
for volumeId, vinfo := range volumeIdToVInfo {
|
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)
|
err = c.collectOneVolumeFileIds(tempFolder, volumeId, vinfo, *verbose, writer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to collect file ids from volume %d on %s: %v", volumeId, vinfo.server, err)
|
return fmt.Errorf("failed to collect file ids from volume %d on %s: %v", volumeId, vinfo.server, err)
|
||||||
|
|
Loading…
Reference in a new issue