From 418878edce063ed0826777450b3ffb5d838241c5 Mon Sep 17 00:00:00 2001 From: chrislusf Date: Tue, 23 Jun 2015 22:49:09 -0700 Subject: [PATCH] In case lastNode==0, need to set it to -1 Fix https://github.com/chrislusf/seaweedfs/issues/156 --- go/storage/store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/storage/store.go b/go/storage/store.go index 425675c8b..b37175f11 100644 --- a/go/storage/store.go +++ b/go/storage/store.go @@ -44,9 +44,9 @@ func NewMasterNodes(bootstrapNode string) (mn *MasterNodes) { } func (mn *MasterNodes) reset() { glog.V(4).Infof("Resetting master nodes: %v", mn) - if len(mn.nodes) > 1 && mn.lastNode > 0 { + 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 + mn.lastNode = -mn.lastNode - 1 } } func (mn *MasterNodes) findMaster() (string, error) {