Browse Source

when verifyNeedleIntegrity, do not truncate files

related to https://github.com/seaweedfs/seaweedfs/pull/5259
pull/5335/head
chrislu 11 months ago
parent
commit
7c45992c79
  1. 8
      weed/storage/volume_checking.go

8
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)
}

Loading…
Cancel
Save