Browse Source

Merge pull request #858 from PapaYofen/hack

Fix https://github.com/chrislusf/seaweedfs/issues/825
pull/862/head
Chris Lu 6 years ago
committed by GitHub
parent
commit
47bf0e3eae
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      weed/topology/topology.go
  2. 5
      weed/topology/volume_growth.go

8
weed/topology/topology.go

@ -88,11 +88,13 @@ func (t *Topology) Lookup(collection string, vid storage.VolumeId) []*DataNode {
return nil return nil
} }
func (t *Topology) NextVolumeId() storage.VolumeId {
func (t *Topology) NextVolumeId() (storage.VolumeId, error) {
vid := t.GetMaxVolumeId() vid := t.GetMaxVolumeId()
next := vid.Next() 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 { func (t *Topology) HasWritableVolume(option *VolumeGrowOption) bool {

5
weed/topology/volume_growth.go

@ -82,7 +82,10 @@ func (vg *VolumeGrowth) findAndGrow(grpcDialOption grpc.DialOption, topo *Topolo
if e != nil { if e != nil {
return 0, e return 0, e
} }
vid := topo.NextVolumeId()
vid, raftErr := topo.NextVolumeId()
if raftErr != nil {
return 0, raftErr
}
err := vg.grow(grpcDialOption, topo, vid, option, servers...) err := vg.grow(grpcDialOption, topo, vid, option, servers...)
return len(servers), err return len(servers), err
} }

Loading…
Cancel
Save