aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_checking.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2024-09-19 13:04:08 +0500
committerGitHub <noreply@github.com>2024-09-19 01:04:08 -0700
commit6d4f5c94ac9f9cfcfc67f642a8fbc373b0e4504a (patch)
treebda3cc7fb9eda327df08f93c37cb6b5e753d1418 /weed/storage/volume_checking.go
parent50e22864cfbe0208c4f693c4367632944b8c1b81 (diff)
downloadseaweedfs-6d4f5c94ac9f9cfcfc67f642a8fbc373b0e4504a.tar.xz
seaweedfs-6d4f5c94ac9f9cfcfc67f642a8fbc373b0e4504a.zip
[volume] remove truncate idx file if size not healthy (#6043)
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 f5ceffcce..9bd432f85 100644
--- a/weed/storage/volume_checking.go
+++ b/weed/storage/volume_checking.go
@@ -14,7 +14,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/util"
)
-func CheckAndFixVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAtNs uint64, err error) {
+func CheckVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAtNs uint64, err error) {
var indexSize int64
if indexSize, err = verifyIndexFileIntegrity(indexFile); err != nil {
return 0, fmt.Errorf("verifyIndexFileIntegrity %s failed: %v", indexFile.Name(), err)
@@ -35,11 +35,7 @@ func CheckAndFixVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAt
}
}
if healthyIndexSize < indexSize {
- glog.Warningf("CheckAndFixVolumeDataIntegrity truncate idx file %s from %d to %d", indexFile.Name(), indexSize, healthyIndexSize)
- err = indexFile.Truncate(healthyIndexSize)
- if err != nil {
- glog.Warningf("CheckAndFixVolumeDataIntegrity truncate idx file %s from %d to %d: %v", indexFile.Name(), indexSize, healthyIndexSize, err)
- }
+ return 0, fmt.Errorf("CheckVolumeDataIntegrity %s failed: index size %d differs from healthy size %d", indexFile.Name(), indexSize, healthyIndexSize)
}
return
}