aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_fsck.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-09-27 09:48:23 -0700
committerchrislu <chris.lu@gmail.com>2022-09-27 09:48:23 -0700
commitb6d7556dda6ee49dc956bf06da716470144d409b (patch)
treecd8cb0b5ae6dde2caf3d31a71e98fa1f407c76eb /weed/shell/command_volume_fsck.go
parentea15476b06c5d51f5f7ee52e5a01791d5633c42e (diff)
downloadseaweedfs-b6d7556dda6ee49dc956bf06da716470144d409b.tar.xz
seaweedfs-b6d7556dda6ee49dc956bf06da716470144d409b.zip
skip truncation on error
fix https://github.com/seaweedfs/seaweedfs/issues/3746
Diffstat (limited to 'weed/shell/command_volume_fsck.go')
-rw-r--r--weed/shell/command_volume_fsck.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/weed/shell/command_volume_fsck.go b/weed/shell/command_volume_fsck.go
index cae8e22d4..04d8bc2c4 100644
--- a/weed/shell/command_volume_fsck.go
+++ b/weed/shell/command_volume_fsck.go
@@ -407,9 +407,10 @@ func (c *commandVolumeFsck) collectOneVolumeFileIds(tempFolder string, dataNodeI
return resp.LastModified <= cutoffFrom, nil
})
if err != nil {
- fmt.Fprintf(writer, "Failed to search for last vilad index on volume %d with error %v", volumeId, err)
+ fmt.Fprintf(writer, "Failed to search for last valid index on volume %d with error %v", volumeId, err)
+ } else {
+ buf.Truncate(index * types.NeedleMapEntrySize)
}
- buf.Truncate(index * types.NeedleMapEntrySize)
}
idxFilename := getVolumeFileIdFile(tempFolder, dataNodeId, volumeId)
err = writeToFile(buf.Bytes(), idxFilename)