diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-10-14 12:18:09 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-14 00:18:09 -0700 |
| commit | 2f72103c831f8a5227613436ed87f9464825f995 (patch) | |
| tree | f82dbfe60f1999da257d291b0366c5e796efbb6a /weed/storage/volume_loading.go | |
| parent | f19c9e3d9d83daa9fa48eaeb8b23cc69215bacb5 (diff) | |
| download | seaweedfs-2f72103c831f8a5227613436ed87f9464825f995.tar.xz seaweedfs-2f72103c831f8a5227613436ed87f9464825f995.zip | |
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
Diffstat (limited to 'weed/storage/volume_loading.go')
| -rw-r--r-- | weed/storage/volume_loading.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go index 97b69ad71..dac0e22a2 100644 --- a/weed/storage/volume_loading.go +++ b/weed/storage/volume_loading.go @@ -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() |
