aboutsummaryrefslogtreecommitdiff
path: root/weed/command
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-06-19 01:15:25 -0700
committerchrislu <chris.lu@gmail.com>2025-06-19 01:15:25 -0700
commit2f1b3d68d7f3d4b8684ee37a58938f7af399117c (patch)
treed7b4a1cddb602de3ecd2341a60bf0f067a206763 /weed/command
parent87927d068b02d965f3ea287488942f49f1f4d151 (diff)
downloadseaweedfs-2f1b3d68d7f3d4b8684ee37a58938f7af399117c.tar.xz
seaweedfs-2f1b3d68d7f3d4b8684ee37a58938f7af399117c.zip
pass volume version when creating a volume
Diffstat (limited to 'weed/command')
-rw-r--r--weed/command/backup.go7
-rw-r--r--weed/command/compact.go2
2 files changed, 6 insertions, 3 deletions
diff --git a/weed/command/backup.go b/weed/command/backup.go
index f9b9fba64..d5599372e 100644
--- a/weed/command/backup.go
+++ b/weed/command/backup.go
@@ -115,7 +115,10 @@ func runBackup(cmd *Command, args []string) bool {
return true
}
}
- v, err := storage.NewVolume(util.ResolvePath(*s.dir), util.ResolvePath(*s.dir), *s.collection, vid, storage.NeedleMapInMemory, replication, ttl, 0, 0, 0)
+
+ ver := needle.Version(stats.Version)
+
+ v, err := storage.NewVolume(util.ResolvePath(*s.dir), util.ResolvePath(*s.dir), *s.collection, vid, storage.NeedleMapInMemory, replication, ttl, 0, ver, 0, 0)
if err != nil {
fmt.Printf("Error creating or reading from volume %d: %v\n", vid, err)
return true
@@ -142,7 +145,7 @@ func runBackup(cmd *Command, args []string) bool {
fmt.Printf("Error destroying volume: %v\n", err)
}
// recreate an empty volume
- v, err = storage.NewVolume(util.ResolvePath(*s.dir), util.ResolvePath(*s.dir), *s.collection, vid, storage.NeedleMapInMemory, replication, ttl, 0, 0, 0)
+ v, err = storage.NewVolume(util.ResolvePath(*s.dir), util.ResolvePath(*s.dir), *s.collection, vid, storage.NeedleMapInMemory, replication, ttl, 0, ver, 0, 0)
if err != nil {
fmt.Printf("Error creating or reading from volume %d: %v\n", vid, err)
return true
diff --git a/weed/command/compact.go b/weed/command/compact.go
index 6f5f2307a..59e69bc74 100644
--- a/weed/command/compact.go
+++ b/weed/command/compact.go
@@ -41,7 +41,7 @@ func runCompact(cmd *Command, args []string) bool {
preallocate := *compactVolumePreallocate * (1 << 20)
vid := needle.VolumeId(*compactVolumeId)
- v, err := storage.NewVolume(util.ResolvePath(*compactVolumePath), util.ResolvePath(*compactVolumePath), *compactVolumeCollection, vid, storage.NeedleMapInMemory, nil, nil, preallocate, 0, 0)
+ v, err := storage.NewVolume(util.ResolvePath(*compactVolumePath), util.ResolvePath(*compactVolumePath), *compactVolumeCollection, vid, storage.NeedleMapInMemory, nil, nil, preallocate, needle.GetCurrentVersion(), 0, 0)
if err != nil {
glog.Fatalf("Load Volume [ERROR] %s\n", err)
}