diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-07-29 02:25:24 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-07-29 02:25:24 -0700 |
| commit | d09606c65ba29f848b6e96b03285842e1808a194 (patch) | |
| tree | f515d677634311a54a6d760e311eff0a23d90919 | |
| parent | 032f1226db3378559d173cec8e8440068d25c114 (diff) | |
| download | seaweedfs-d09606c65ba29f848b6e96b03285842e1808a194.tar.xz seaweedfs-d09606c65ba29f848b6e96b03285842e1808a194.zip | |
refactoring
| -rw-r--r-- | weed/command/fix.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/command/fix.go b/weed/command/fix.go index 916338d3e..3643c9d58 100644 --- a/weed/command/fix.go +++ b/weed/command/fix.go @@ -34,11 +34,12 @@ func runFix(cmd *Command, args []string) bool { return false } - fileName := strconv.Itoa(*fixVolumeId) + baseFileName := strconv.Itoa(*fixVolumeId) if *fixVolumeCollection != "" { - fileName = *fixVolumeCollection + "_" + fileName + baseFileName = *fixVolumeCollection + "_" + baseFileName } - indexFile, err := os.OpenFile(path.Join(*fixVolumePath, fileName+".idx"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) + indexFileName := path.Join(*fixVolumePath, baseFileName+".idx") + indexFile, err := os.OpenFile(indexFileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { glog.Fatalf("Create Volume Index [ERROR] %s\n", err) } @@ -67,6 +68,7 @@ func runFix(cmd *Command, args []string) bool { }) if err != nil { glog.Fatalf("Export Volume File [ERROR] %s\n", err) + os.Remove(indexFileName) } return true |
