aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/volume_checking.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-10-31 15:50:01 -0700
committerChris Lu <chris.lu@gmail.com>2020-10-31 15:50:01 -0700
commit9708df47d1be0943b6bf548c0dc0f1a06f5fcafa (patch)
tree79c83ce54a6791b3c24269259f636d79ec6aaa22 /weed/storage/volume_checking.go
parent10f9f1cc26934352fb82ff1de0abdc6585b54b9e (diff)
downloadseaweedfs-9708df47d1be0943b6bf548c0dc0f1a06f5fcafa.tar.xz
seaweedfs-9708df47d1be0943b6bf548c0dc0f1a06f5fcafa.zip
ensure offset in the index file is positive
Diffstat (limited to 'weed/storage/volume_checking.go')
-rw-r--r--weed/storage/volume_checking.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/weed/storage/volume_checking.go b/weed/storage/volume_checking.go
index 048944199..00e04047f 100644
--- a/weed/storage/volume_checking.go
+++ b/weed/storage/volume_checking.go
@@ -22,7 +22,7 @@ func CheckAndFixVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAt
return 0, nil
}
healthyIndexSize := indexSize
- for i := 1; i <= 10; i++ {
+ for i := 1; i <= 10 && indexSize >= int64(i)*NeedleMapEntrySize; i++ {
// check and fix last 10 entries
lastAppendAtNs, err = doCheckAndFixVolumeData(v, indexFile, indexSize-int64(i)*NeedleMapEntrySize)
if err == io.EOF {