Browse Source

ensure offset in the index file is positive

pull/1596/head
Chris Lu 4 years ago
parent
commit
9708df47d1
  1. 2
      weed/storage/volume_checking.go

2
weed/storage/volume_checking.go

@ -22,7 +22,7 @@ func CheckAndFixVolumeDataIntegrity(v *Volume, indexFile *os.File) (lastAppendAt
return 0, nil return 0, nil
} }
healthyIndexSize := indexSize healthyIndexSize := indexSize
for i := 1; i <= 10; i++ {
for i := 1; i <= 10 && indexSize >= int64(i)*NeedleMapEntrySize; i++ {
// check and fix last 10 entries // check and fix last 10 entries
lastAppendAtNs, err = doCheckAndFixVolumeData(v, indexFile, indexSize-int64(i)*NeedleMapEntrySize) lastAppendAtNs, err = doCheckAndFixVolumeData(v, indexFile, indexSize-int64(i)*NeedleMapEntrySize)
if err == io.EOF { if err == io.EOF {

Loading…
Cancel
Save