mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
replace https://github.com/seaweedfs/seaweedfs/pull/3621
This commit is contained in:
parent
205ecb5d03
commit
576c113c59
|
@ -20,7 +20,9 @@ func NewDataCenter(id string) *DataCenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dc *DataCenter) GetOrCreateRack(rackName string) *Rack {
|
func (dc *DataCenter) GetOrCreateRack(rackName string) *Rack {
|
||||||
for _, c := range dc.Children() {
|
dc.Lock()
|
||||||
|
defer dc.Unlock()
|
||||||
|
for _, c := range dc.children {
|
||||||
rack := c.(*Rack)
|
rack := c.(*Rack)
|
||||||
if string(rack.Id()) == rackName {
|
if string(rack.Id()) == rackName {
|
||||||
return rack
|
return rack
|
||||||
|
|
|
@ -32,7 +32,9 @@ func (r *Rack) FindDataNode(ip string, port int) *DataNode {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (r *Rack) GetOrCreateDataNode(ip string, port int, grpcPort int, publicUrl string, maxVolumeCounts map[string]uint32) *DataNode {
|
func (r *Rack) GetOrCreateDataNode(ip string, port int, grpcPort int, publicUrl string, maxVolumeCounts map[string]uint32) *DataNode {
|
||||||
for _, c := range r.Children() {
|
r.Lock()
|
||||||
|
defer r.Unlock()
|
||||||
|
for _, c := range r.children {
|
||||||
dn := c.(*DataNode)
|
dn := c.(*DataNode)
|
||||||
if dn.MatchLocation(ip, port) {
|
if dn.MatchLocation(ip, port) {
|
||||||
dn.LastSeen = time.Now().Unix()
|
dn.LastSeen = time.Now().Unix()
|
||||||
|
|
|
@ -258,7 +258,9 @@ func (t *Topology) UnRegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter {
|
func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter {
|
||||||
for _, c := range t.Children() {
|
t.Lock()
|
||||||
|
defer t.Unlock()
|
||||||
|
for _, c := range t.children {
|
||||||
dc := c.(*DataCenter)
|
dc := c.(*DataCenter)
|
||||||
if string(dc.Id()) == dcName {
|
if string(dc.Id()) == dcName {
|
||||||
return dc
|
return dc
|
||||||
|
|
Loading…
Reference in a new issue