pass volume version when creating a volume

This commit is contained in:
chrislu
2025-06-19 01:15:25 -07:00
parent 87927d068b
commit 2f1b3d68d7
14 changed files with 38 additions and 31 deletions

View File

@@ -10,7 +10,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/storage/super_block"
)
func (v *Volume) maybeWriteSuperBlock() error {
func (v *Volume) maybeWriteSuperBlock(ver needle.Version) error {
datSize, _, e := v.DataBackend.GetStat()
if e != nil {
@@ -18,7 +18,7 @@ func (v *Volume) maybeWriteSuperBlock() error {
return e
}
if datSize == 0 {
v.SuperBlock.Version = needle.GetCurrentVersion()
v.SuperBlock.Version = ver
_, e = v.DataBackend.WriteAt(v.SuperBlock.Bytes(), 0)
if e != nil && os.IsPermission(e) {
//read-only, but zero length - recreate it!