Skip to content

Commit

Permalink
Merge pull request #1320 from aaronlehmann/force-new-cluster-issue
Browse files Browse the repository at this point in the history
raft: ForceNewCluster flag should only apply at startup
  • Loading branch information
LK4D4 committed Aug 5, 2016
2 parents 9b0742e + aaa0273 commit e021d14
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions manager/state/raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ type Node struct {
// shutting down the node.
waitProp sync.WaitGroup

// forceNewCluster is a special flag used to recover from disaster
// scenario by pointing to an existing or backed up data directory.
forceNewCluster bool

confState raftpb.ConfState
appliedIndex uint64
snapshotIndex uint64
Expand Down Expand Up @@ -192,7 +188,6 @@ func NewNode(ctx context.Context, opts NewNodeOptions) *Node {
MaxInflightMsgs: cfg.MaxInflightMsgs,
Logger: cfg.Logger,
},
forceNewCluster: opts.ForceNewCluster,
stopCh: make(chan struct{}),
doneCh: make(chan struct{}),
removeRaftCh: make(chan struct{}),
Expand Down Expand Up @@ -362,7 +357,7 @@ func (n *Node) Run(ctx context.Context) error {
// saveToStorage.
if !raft.IsEmptySnap(rd.Snapshot) {
// Load the snapshot data into the store
if err := n.restoreFromSnapshot(rd.Snapshot.Data, n.forceNewCluster); err != nil {
if err := n.restoreFromSnapshot(rd.Snapshot.Data, false); err != nil {
n.Config.Logger.Error(err)
}
n.appliedIndex = rd.Snapshot.Metadata.Index
Expand Down

0 comments on commit e021d14

Please sign in to comment.