Skip to content

Commit e021d14

Browse files
authored
Merge pull request #1320 from aaronlehmann/force-new-cluster-issue
raft: ForceNewCluster flag should only apply at startup
2 parents 9b0742e + aaa0273 commit e021d14

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

manager/state/raft/raft.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ type Node struct {
104104
// shutting down the node.
105105
waitProp sync.WaitGroup
106106

107-
// forceNewCluster is a special flag used to recover from disaster
108-
// scenario by pointing to an existing or backed up data directory.
109-
forceNewCluster bool
110-
111107
confState raftpb.ConfState
112108
appliedIndex uint64
113109
snapshotIndex uint64
@@ -192,7 +188,6 @@ func NewNode(ctx context.Context, opts NewNodeOptions) *Node {
192188
MaxInflightMsgs: cfg.MaxInflightMsgs,
193189
Logger: cfg.Logger,
194190
},
195-
forceNewCluster: opts.ForceNewCluster,
196191
stopCh: make(chan struct{}),
197192
doneCh: make(chan struct{}),
198193
removeRaftCh: make(chan struct{}),
@@ -362,7 +357,7 @@ func (n *Node) Run(ctx context.Context) error {
362357
// saveToStorage.
363358
if !raft.IsEmptySnap(rd.Snapshot) {
364359
// Load the snapshot data into the store
365-
if err := n.restoreFromSnapshot(rd.Snapshot.Data, n.forceNewCluster); err != nil {
360+
if err := n.restoreFromSnapshot(rd.Snapshot.Data, false); err != nil {
366361
n.Config.Logger.Error(err)
367362
}
368363
n.appliedIndex = rd.Snapshot.Metadata.Index

0 commit comments

Comments
 (0)