Avoid assigning duplicate RAFT IDs to new nodes.#5571
Conversation
manishrjain
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @manishrjain, @martinmr, and @vvbalaji-dgraph)
dgraph/cmd/zero/raft.go, line 217 at r1 (raw file):
} if has && m.Addr != member.Addr {
This could avoid an address change from happening.
572f42e to
fb8429b
Compare
martinmr
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @vvbalaji-dgraph)
dgraph/cmd/zero/raft.go, line 217 at r1 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
This could avoid an address change from happening.
Done. Reverted this change.
manishrjain
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @manishrjain, @martinmr, and @vvbalaji-dgraph)
dgraph/cmd/zero/zero.go, line 500 at r2 (raw file):
if m.Id == 0 { m.Id = s.nextRaftId s.nextRaftId += 1
A proposal could error out, and then get applied later. Therefore, it is best to keep incrementing nextRaftId.
martinmr
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @vvbalaji-dgraph)
dgraph/cmd/zero/zero.go, line 500 at r2 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
A proposal could error out, and then get applied later. Therefore, it is best to keep incrementing nextRaftId.
Done.
Currently, zero uses the MaxRaftId to assign RAFT IDs to new nodes. However, the MaxRaftId value is not immediately updated and the lock is released in between creating the proposal and sending the proposal to the RAFT node. This can lead to situations where more than one new node is assigned the same ID. To solve this, this change introduces a new field to generate the IDs that is updated immediately, thus preventing multiple nodes from being assigned the same ID. Fixes #5436
Currently, zero uses the MaxRaftId to assign RAFT IDs to new nodes. However, the MaxRaftId value is not immediately updated and the lock is released in between creating the proposal and sending the proposal to the RAFT node. This can lead to situations where more than one new node is assigned the same ID. To solve this, this change introduces a new field to generate the IDs that is updated immediately, thus preventing multiple nodes from being assigned the same ID. Fixes #5436
Currently, zero uses the MaxRaftId to assign RAFT IDs to new nodes. However, the MaxRaftId value is not immediately updated and the lock is released in between creating the proposal and sending the proposal to the RAFT node. This can lead to situations where more than one new node is assigned the same ID. To solve this, this change introduces a new field to generate the IDs that is updated immediately, thus preventing multiple nodes from being assigned the same ID. Fixes dgraph-io#5436
Currently, zero uses the MaxRaftId to assign RAFT IDs to new nodes. However, the
MaxRaftId value is not immediately updated and the lock is released in between
creating the proposal and sending the proposal to the RAFT node. This can lead
to situations where more than one new node is assigned the same ID.
To solve this, this change introduces a new field to generate the IDs that is
updated immediately, thus preventing multiple nodes from being assigned
the same ID.
Fixes #5436
This change is