diff options
| author | Chris Lu <chris.lu@gmail.com> | 2014-04-16 23:43:27 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2014-04-16 23:43:27 -0700 |
| commit | 51939efeac635d0ba8b683cae6176aa60845b5f7 (patch) | |
| tree | 4b630c01d57cc1cc57e2ed58b25a275109039a30 /go/topology/topology.go | |
| parent | 9653a54766fbb7d9e7453c0df0eb0de016cfbce6 (diff) | |
| download | seaweedfs-51939efeac635d0ba8b683cae6176aa60845b5f7.tar.xz seaweedfs-51939efeac635d0ba8b683cae6176aa60845b5f7.zip | |
1. volume server now sends master server its max file key, so that
master server does not need to store the sequence on disk any more
2. fix raft server's failure to init cluster during bootstrapping
Diffstat (limited to 'go/topology/topology.go')
| -rw-r--r-- | go/topology/topology.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/go/topology/topology.go b/go/topology/topology.go index b1fa3f2a2..9db3e78ae 100644 --- a/go/topology/topology.go +++ b/go/topology/topology.go @@ -19,7 +19,7 @@ type Topology struct { volumeSizeLimit uint64 - sequence sequence.Sequencer + Sequence sequence.Sequencer chanDeadDataNodes chan *DataNode chanRecoveredDataNodes chan *DataNode @@ -40,7 +40,7 @@ func NewTopology(id string, confFile string, seq sequence.Sequencer, volumeSizeL t.pulse = int64(pulse) t.volumeSizeLimit = volumeSizeLimit - t.sequence = seq + t.Sequence = seq t.chanDeadDataNodes = make(chan *DataNode) t.chanRecoveredDataNodes = make(chan *DataNode) @@ -118,7 +118,7 @@ func (t *Topology) PickForWrite(count int, option *VolumeGrowOption) (string, in if err != nil || datanodes.Length() == 0 { return "", 0, nil, errors.New("No writable volumes avalable!") } - fileId, count := t.sequence.NextFileId(count) + fileId, count := t.Sequence.NextFileId(count) return storage.NewFileId(*vid, fileId, rand.Uint32()).String(), count, datanodes.Head(), nil } @@ -143,7 +143,8 @@ func (t *Topology) RegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) { t.GetVolumeLayout(v.Collection, v.ReplicaPlacement).RegisterVolume(&v, dn) } -func (t *Topology) RegisterVolumes(init bool, volumeInfos []storage.VolumeInfo, ip string, port int, publicUrl string, maxVolumeCount int, dcName string, rackName string) { +func (t *Topology) RegisterVolumes(init bool, volumeInfos []storage.VolumeInfo, ip string, port int, publicUrl string, maxVolumeCount int, maxFileKey uint64, dcName string, rackName string) { + t.Sequence.SetMax(maxFileKey) dcName, rackName = t.configuration.Locate(ip, dcName, rackName) dc := t.GetOrCreateDataCenter(dcName) rack := dc.GetOrCreateRack(rackName) |
