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

Access groupi.gid atomically #3402

Merged
merged 2 commits into from
May 14, 2019
Merged

Access groupi.gid atomically #3402

merged 2 commits into from
May 14, 2019

Conversation

animesh2049
Copy link
Contributor

@animesh2049 animesh2049 commented May 13, 2019

We were accessing groupi.gid without synchronization. This commit ensures that groupi.gid is always accessed atomically. Fixes #3343

This change is Reviewable

@animesh2049 animesh2049 requested review from manishrjain and a team as code owners May 13, 2019 13:11
@CLAassistant
Copy link

CLAassistant commented May 13, 2019

CLA assistant check
All committers have signed the CLA.

We were accessing groupi.gid without synchronization.
This commit ensures that groupi.gid
is always accessed atomically.
@animesh2049 animesh2049 changed the title atomic read used instead of accessing variable directly Access groupi.gid atomically May 13, 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.

Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @animesh2049, @mangalaman93, and @manishrjain)


dgraph/cmd/alpha/run.go, line 559 at r1 (raw file):

	// TODO (animesh): Not sure why this was done in the first place
	// _ = numShutDownSig

This looks like it's assigning the value of numShutDownSig to an anonymous variable. It shouldn't have any effect. I think it's safe to remove in this PR.


worker/groups.go, line 293 at r1 (raw file):

func (g *groupi) ServesGroup(gid uint32) bool {
	// No need to acquire the lock on g because gid is always
	// accessed atomically via groupId() function

Not sure if this comment is really needed. I suppose it would be useful to someone who remembered the previous version. I'll let you decide if you want to keep it.

In case you want to keep it two comments:

  • Period at the end.
  • Also, if you can fit the whole comment in a single line (100 columns) it'd be better.

@animesh2049
Copy link
Contributor Author


worker/groups.go, line 293 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…

Not sure if this comment is really needed. I suppose it would be useful to someone who remembered the previous version. I'll let you decide if you want to keep it.

In case you want to keep it two comments:

  • Period at the end.
  • Also, if you can fit the whole comment in a single line (100 columns) it'd be better.

I have removed the comment.

Copy link
Contributor

@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: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @manishrjain and @martinmr)


dgraph/cmd/alpha/run.go, line 559 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…
	// TODO (animesh): Not sure why this was done in the first place
	// _ = numShutDownSig

This looks like it's assigning the value of numShutDownSig to an anonymous variable. It shouldn't have any effect. I think it's safe to remove in this PR.

Done


worker/groups.go, line 293 at r1 (raw file):

Previously, animesh2049 (Animesh Chandra Pathak) wrote…

I have removed the comment.

Done

Copy link
Contributor

@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.

Reviewed 2 of 4 files at r1, 2 of 2 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @manishrjain and @martinmr)

@animesh2049 animesh2049 merged commit b36f402 into master May 14, 2019
@manishrjain
Copy link
Contributor

@animesh2049 FYI, this PR needed more approvals before merging. Something to keep in mind for next time.

@mangalaman93 mangalaman93 deleted the animesh2049/issue_3343 branch May 14, 2019 16:24
@mangalaman93
Copy link
Contributor

Martin had approved it, so we went through with it. Will be careful in future.

@animesh2049
Copy link
Contributor Author

sure @manishrjain
I will keep this in mind.

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.

Possible race in alpha
5 participants