diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-10-28 18:59:39 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-28 06:59:39 -0700 |
| commit | f9f499b8d5929fb1fd6e26261c4bba83eb20b525 (patch) | |
| tree | 809c4bad54e7cad75d81653e6877a1bd2d26bac7 /weed/command | |
| parent | 1e0d64c04883a8d7b09677e9721f9e189743e2f3 (diff) | |
| download | seaweedfs-f9f499b8d5929fb1fd6e26261c4bba83eb20b525.tar.xz seaweedfs-f9f499b8d5929fb1fd6e26261c4bba83eb20b525.zip | |
[fix] add param for ignore error (#3918)
Diffstat (limited to 'weed/command')
| -rw-r--r-- | weed/command/fix.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/weed/command/fix.go b/weed/command/fix.go index f0499a818..b5016d961 100644 --- a/weed/command/fix.go +++ b/weed/command/fix.go @@ -31,6 +31,7 @@ var cmdFix = &Command{ var ( fixVolumeCollection = cmdFix.Flag.String("collection", "", "an optional volume collection name, if specified only it will be processed") fixVolumeId = cmdFix.Flag.Int64("volumeId", 0, "an optional volume id, if not 0 (default) only it will be processed") + fixIgnoreError = cmdFix.Flag.Bool("ignoreError", false, "an optional, if true will be processed despite errors") ) type VolumeFileScanner4Fix struct { @@ -126,11 +127,21 @@ func doFixOneVolume(basepath string, baseFileName string, collection string, vol } if err := storage.ScanVolumeFile(basepath, collection, vid, storage.NeedleMapInMemory, scanner); err != nil { - glog.Fatalf("scan .dat File: %v", err) + err := fmt.Errorf("scan .dat File: %v", err) + if *fixIgnoreError { + glog.Error(err) + } else { + glog.Fatal(err) + } } if err := nm.SaveToIdx(indexFileName); err != nil { os.Remove(indexFileName) - glog.Fatalf("save to .idx File: %v", err) + err := fmt.Errorf("save to .idx File: %v", err) + if *fixIgnoreError { + glog.Error(err) + } else { + glog.Fatal(err) + } } } |
