aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_checking.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-02-24 02:37:03 -0800
committerchrislu <chris.lu@gmail.com>2024-02-24 02:37:03 -0800
commit7c45992c7960cb213bdc6cfe7bc70c6c86d509e0 (patch)
tree09b97517c8c679bf5176b72e59c6986d8187f838 /weed/storage/volume_checking.go
parentbf0899cbf4ccb42e02f5984802d41c5e9b5e90bf (diff)
downloadseaweedfs-7c45992c7960cb213bdc6cfe7bc70c6c86d509e0.tar.xz
seaweedfs-7c45992c7960cb213bdc6cfe7bc70c6c86d509e0.zip
when verifyNeedleIntegrity, do not truncate files
related to https://github.com/seaweedfs/seaweedfs/pull/5259
Diffstat (limited to 'weed/storage/volume_checking.go')
-rw-r--r--weed/storage/volume_checking.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/weed/storage/volume_checking.go b/weed/storage/volume_checking.go
index 0f92a2e93..4d51e081f 100644
--- a/weed/storage/volume_checking.go
+++ b/weed/storage/volume_checking.go
@@ -118,12 +118,8 @@ func verifyNeedleIntegrity(datFile backend.BackendStorageFile, v needle.Version,
return n.AppendAtNs, nil
}
if fileSize > fileTailOffset {
- glog.Warningf("Truncate %s from %d bytes to %d bytes!", datFile.Name(), fileSize, fileTailOffset)
- err = datFile.Truncate(fileTailOffset)
- if err == nil {
- return n.AppendAtNs, nil
- }
- return n.AppendAtNs, fmt.Errorf("truncate file %s: %v", datFile.Name(), err)
+ glog.Warningf("data file %s actual %d bytes expected %d bytes!", datFile.Name(), fileSize, fileTailOffset)
+ return n.AppendAtNs, fmt.Errorf("data file %s actual %d bytes expected %d bytes", datFile.Name(), fileSize, fileTailOffset)
}
glog.Warningf("data file %s has %d bytes, less than expected %d bytes!", datFile.Name(), fileSize, fileTailOffset)
}