diff --git a/weed/storage/store.go b/weed/storage/store.go index 3562cde18..9ae9e9644 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -67,7 +67,7 @@ func (mn *MasterNodes) findMaster() (string, error) { } mn.nodes = append(masters, m) mn.master = mn.nodes[rand.Intn(len(mn.nodes))] - glog.V(2).Infof("current master nodes is (nodes:%v, master:%s)", mn, mn.nodes, mn.master) + glog.V(2).Infof("current master nodes is (nodes:%v, master:%s)", mn.nodes, mn.master) break } else { glog.V(4).Infof("Failed listing masters on %s: %v", m, e) diff --git a/weed/storage/volume.go b/weed/storage/volume.go index 8ec698fd4..9b358317a 100644 --- a/weed/storage/volume.go +++ b/weed/storage/volume.go @@ -38,7 +38,13 @@ func NewVolume(dirname string, collection string, id VolumeId, needleMapKind Nee func (v *Volume) String() string { v.mutex.RLock() defer v.mutex.RUnlock() - return fmt.Sprintf("Id:%v, dir:%s, Collection:%s, dataFile:%v, nm:%v, readOnly:%v", v.Id, v.dir, v.Collection, v.dataFile, v.nm, v.readOnly) + return fmt.Sprintf("Id:%v, dir:%s, Collection:%s, dataFile:%v, nm:%v, readOnly:%v", + v.Id, + v.dir, + v.Collection, + v.dataFile, + v.nm, + v.readOnly) } func loadVolumeWithoutIndex(dirname string, collection string, id VolumeId, needleMapKind NeedleMapType) (v *Volume, e error) { diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go index 4798a3c38..0a0fec80e 100644 --- a/weed/topology/data_node.go +++ b/weed/topology/data_node.go @@ -34,7 +34,7 @@ func (dn *DataNode) String() string { dn.mutex.RLock() defer dn.mutex.RUnlock() return fmt.Sprintf("Node:%s, volumes:%v, Ip:%s, Port:%d, PublicUrl:%s, Dead:%v", - dn.NodeImpl.String(), + dn.NodeImpl.toString(), dn.volumes, dn.Ip, dn.Port, diff --git a/weed/topology/node.go b/weed/topology/node.go index f8de1a28a..40479f11f 100644 --- a/weed/topology/node.go +++ b/weed/topology/node.go @@ -132,11 +132,18 @@ func (n *NodeImpl) IsDataCenter() bool { return n.nodeType == "DataCenter" } func (n *NodeImpl) String() string { - if n.Parent() != nil { - return n.Parent().String() + ":" + string(n.id) + n.mutex.RLock() + defer n.mutex.RUnlock() + return n.toString() +} + +func (n *NodeImpl) toString() string { + if n.parent != nil { + return n.parent.String() + ":" + string(n.id) } return string(n.id) } + func (n *NodeImpl) Id() NodeId { return n.id }