Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-2181 raft: Avoid passing raft_node_t pointers around #21

Merged
merged 2 commits into from
Mar 8, 2019

Conversation

okulkarni
Copy link

Passing around pointers to raft_node_t objects and referencing them
all over the code results in errors and crashes due to dangling
pointers when nodes are removed. It is safer to use the node ID to
look up a node from the server's node list.

In the future, it would be ideal to introduce reference counting and
thread safety to Raft as a whole and the node list in particular.

Signed-off-by: Omkar Kulkarni [email protected]

@okulkarni okulkarni requested a review from liw March 7, 2019 05:49
Passing around pointers to raft_node_t objects and referencing them
all over the code results in errors and crashes due to dangling
pointers when nodes are removed. It is safer to use the node ID to
look up a node from the server's node list.

In the future, it would be ideal to introduce reference counting and
thread safety to Raft as a whole and the node list in particular.

Signed-off-by: Omkar Kulkarni <[email protected]>
Copy link
Collaborator

@liw liw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense; only two nit-picking comments.

include/raft.h Outdated Show resolved Hide resolved
include/raft_private.h Outdated Show resolved Hide resolved
Code Review 001.

Signed-off-by: Omkar Kulkarni <[email protected]>
@liw liw merged commit e6c4369 into daos-stack:master Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants