diff options
| author | chrislusf <chris.lu@gmail.com> | 2015-05-22 08:12:51 -0700 |
|---|---|---|
| committer | chrislusf <chris.lu@gmail.com> | 2015-05-22 08:12:51 -0700 |
| commit | c7cf4fa46c9d8c2de95484d47db15dfb87cdfa47 (patch) | |
| tree | 803a446bb1bf2dda44bb388afecfe631e5d07cae /go | |
| parent | 99aee22e082988da45c09c25e1975bf451d6c6fa (diff) | |
| download | seaweedfs-c7cf4fa46c9d8c2de95484d47db15dfb87cdfa47.tar.xz seaweedfs-c7cf4fa46c9d8c2de95484d47db15dfb87cdfa47.zip | |
Fix looking for master nodes.
Diffstat (limited to 'go')
| -rw-r--r-- | go/storage/store.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/go/storage/store.go b/go/storage/store.go index 1d269428a..54a6f9c69 100644 --- a/go/storage/store.go +++ b/go/storage/store.go @@ -43,7 +43,9 @@ func NewMasterNodes(bootstrapNode string) (mn *MasterNodes) { return } func (mn *MasterNodes) reset() { + glog.V(4).Infof("Resetting master nodes: %v", mn) if len(mn.nodes) > 1 && mn.lastNode > 0 { + glog.V(0).Infof("Reset master %s from: %v", mn.nodes[mn.lastNode], mn.nodes) mn.lastNode = -mn.lastNode } } @@ -58,9 +60,9 @@ func (mn *MasterNodes) findMaster() (string, error) { if len(masters) == 0 { continue } - mn.nodes = masters + mn.nodes = append(masters, m) mn.lastNode = rand.Intn(len(mn.nodes)) - glog.V(2).Info("current master node is :", mn.nodes[mn.lastNode]) + glog.V(2).Infof("current master nodes is %v", mn) break } else { glog.V(4).Infof("Failed listing masters on %s: %v", m, e) @@ -321,9 +323,11 @@ func (s *Store) SendHeartbeatToMaster() (masterNode string, secretKey security.S var ret operation.JoinResult if err := json.Unmarshal(jsonBlob, &ret); err != nil { glog.V(0).Infof("Failed to join %s with response: %s", joinUrl, string(jsonBlob)) + s.masterNodes.reset() return masterNode, "", err } if ret.Error != "" { + s.masterNodes.reset() return masterNode, "", errors.New(ret.Error) } s.volumeSizeLimit = ret.VolumeSizeLimit |
