mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-28 05:15:00 +08:00
can vacuum volume when size mismatch (#5200)
Co-authored-by: Yang Wang <yangwang@weride.ai>
This commit is contained in:
parent
c82236b41b
commit
316ae45795
@ -93,7 +93,17 @@ func (n *Needle) ReadData(r backend.BackendStorageFile, offset int64, size Size,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return n.ReadBytes(bytes, offset, size, version)
|
||||
|
||||
err = n.ReadBytes(bytes, offset, size, version)
|
||||
if err == ErrorSizeMismatch && OffsetSize == 4 {
|
||||
offset = offset + int64(MaxPossibleVolumeSize)
|
||||
bytes, err = ReadNeedleBlob(r, offset, size, version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = n.ReadBytes(bytes, offset, size, version)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (n *Needle) ParseNeedleHeader(bytes []byte) {
|
||||
|
@ -60,6 +60,9 @@ func doCheckAndFixVolumeData(v *Volume, indexFile *os.File, indexOffset int64) (
|
||||
}
|
||||
} else {
|
||||
if lastAppendAtNs, err = verifyNeedleIntegrity(v.DataBackend, v.Version(), offset.ToActualOffset(), key, size); err != nil {
|
||||
if err == ErrorSizeMismatch {
|
||||
return verifyNeedleIntegrity(v.DataBackend, v.Version(), offset.ToActualOffset()+int64(MaxPossibleVolumeSize), key, size)
|
||||
}
|
||||
return lastAppendAtNs, err
|
||||
}
|
||||
}
|
||||
|
@ -55,9 +55,6 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption, onReadSize
|
||||
}
|
||||
if readOption == nil || !readOption.IsMetaOnly {
|
||||
err = n.ReadData(v.DataBackend, nv.Offset.ToActualOffset(), readSize, v.Version())
|
||||
if err == needle.ErrorSizeMismatch && OffsetSize == 4 {
|
||||
err = n.ReadData(v.DataBackend, nv.Offset.ToActualOffset()+int64(MaxPossibleVolumeSize), readSize, v.Version())
|
||||
}
|
||||
v.checkReadWriteError(err)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
Loading…
Reference in New Issue
Block a user