Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Fix https://github.com/chrislusf/seaweedfs/issues/825

chenwanli0bc3cdd26ae9
diff --git a/weed/topology/topology.go b/weed/topology/topology.go
index 619cc9696f..77716605a1 100644
--- a/weed/topology/topology.go
+++ b/weed/topology/topology.go
@@ -88,11 +88,13 @@ func (t *Topology) Lookup(collection string, vid storage.VolumeId) []*DataNode {
return nil
}
-func (t *Topology) NextVolumeId() storage.VolumeId {
+func (t *Topology) NextVolumeId() (storage.VolumeId, error) {
vid := t.GetMaxVolumeId()
next := vid.Next()
- go t.RaftServer.Do(NewMaxVolumeIdCommand(next))
- return next
+ if _, err := t.RaftServer.Do(NewMaxVolumeIdCommand(next)); err != nil {
+ return 0, err
+ }
+ return next, nil
}
func (t *Topology) HasWritableVolume(option *VolumeGrowOption) bool {
diff --git a/weed/topology/volume_growth.go b/weed/topology/volume_growth.go
index 3d178b827d..ef39a1c012 100644
--- a/weed/topology/volume_growth.go
+++ b/weed/topology/volume_growth.go
@@ -82,7 +82,10 @@ func (vg *VolumeGrowth) findAndGrow(grpcDialOption grpc.DialOption, topo *Topolo
if e != nil {
return 0, e
}
- vid := topo.NextVolumeId()
+ vid, raftErr := topo.NextVolumeId()
+ if raftErr != nil {
+ return 0, raftErr
+ }
err := vg.grow(grpcDialOption, topo, vid, option, servers...)
return len(servers), err
}