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

Check for n.Raft() to be nil #4084

Merged
merged 1 commit into from
Oct 2, 2019
Merged

Check for n.Raft() to be nil #4084

merged 1 commit into from
Oct 2, 2019

Conversation

mangalaman93
Copy link
Member

@mangalaman93 mangalaman93 commented Sep 27, 2019

fixes #4053

This change is Reviewable

@mangalaman93 mangalaman93 requested review from manishrjain and a team as code owners September 27, 2019 17:05
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ A review job has been created and sent to the PullRequest network.


@mangalaman93 you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

1 Message
It looks like the description for this pull request is either blank or very short. Adding a high-level summary will help our reviewers provide better feedback. Feel free to include questions for PullRequest reviewers and make specific feedback requests.

@martinmr martinmr changed the title Check for n.Raft() to be nil, fixes #4053 Check for n.Raft() to be nil Sep 27, 2019
Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @manishrjain)

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

A good straightforward fix. No comments.


Reviewed with ❤️ by PullRequest

worker/snapshot.go Outdated Show resolved Hide resolved
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm: Got a comment.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @balajijinnah and @mangalaman93)


worker/snapshot.go, line 168 at r1 (raw file):

	}

	raftNode := n.Raft()

I like to generally avoid one-time use variables. A good way to do this would be to put an OR next to n == nil.

if n == nil || n.Raft() == nil { ... }

Copy link
Member Author

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @balajijinnah and @manishrjain)


worker/snapshot.go, line 168 at r1 (raw file):

Previously, manishrjain (Manish R Jain) wrote…

I like to generally avoid one-time use variables. A good way to do this would be to put an OR next to n == nil.

if n == nil || n.Raft() == nil { ... }

I was trying to avoid calling n.Raft() twice because it internally acquires a lock. Does it still seem okay to do that?

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @balajijinnah and @mangalaman93)


worker/snapshot.go, line 168 at r1 (raw file):

Previously, mangalaman93 (Aman Mangal) wrote…

I was trying to avoid calling n.Raft() twice because it internally acquires a lock. Does it still seem okay to do that?

Really not a big deal. This func is super expensive already.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

⚠️ Warning

PullRequest detected a force-push on this branch. This may have caused some information to be lost, and additional time may be required to complete review of the code. Read More

@mangalaman93 mangalaman93 merged commit 30de144 into master Oct 2, 2019
@mangalaman93 mangalaman93 deleted the aman/issue_4053 branch October 2, 2019 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Invalid memory address or nil pointer dereference (Kubernetes)
4 participants