mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-18 21:07:56 +08:00
avoid load volume file with BytesOffset mismatch (#3841)
* avoid load volume file with BytesOffset mismatch https://github.com/seaweedfs/seaweedfs/issues/2966 * set BytesOffset if has not VolumeInfoFile * typos fail => failed * exit if bytesOffset mismatch
This commit is contained in:

committed by
GitHub

parent
f19c9e3d9d
commit
2f72103c83
@@ -2,6 +2,7 @@ package storage
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/types"
|
||||
"os"
|
||||
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
@@ -193,7 +194,10 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
|
||||
|
||||
if !hasVolumeInfoFile {
|
||||
v.volumeInfo.Version = uint32(v.SuperBlock.Version)
|
||||
v.SaveVolumeInfo()
|
||||
v.volumeInfo.BytesOffset = uint32(types.OffsetSize)
|
||||
if err := v.SaveVolumeInfo(); err != nil {
|
||||
glog.Warningf("volume %d failed to save file info: %v", v.Id, err)
|
||||
}
|
||||
}
|
||||
|
||||
stats.VolumeServerVolumeCounter.WithLabelValues(v.Collection, "volume").Inc()
|
||||
|
Reference in New Issue
Block a user