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

Bugfix: Set found to false to avoid deleting index edge when value doesn't match. #3843

Merged
merged 3 commits into from
Aug 21, 2019

Conversation

pawanrawal
Copy link
Contributor

@pawanrawal pawanrawal commented Aug 21, 2019

Fixes #3803

Return found as false to avoid deleting index corresponding to a uid when the value doesn't match. For scalar values, after fingerprinting found is always true as values get fingerprinted to math.MaxUint64. Hence we return found as false from this second check.


This change is Reviewable

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.


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

This changes seems to match the description and nice job updating the unit tests to match the expected
functionality.


Reviewed with ❤️ by PullRequest

@@ -331,7 +331,7 @@ func (txn *Txn) addMutationHelper(ctx context.Context, l *List, doUpdateIndex bo

if pFound && !(bytes.Equal(currPost.Value, newPost.Value) &&
types.TypeID(currPost.ValType) == types.TypeID(newPost.ValType)) {
return val, found, emptyCountParams, err
return val, false, emptyCountParams, nil
Copy link

Choose a reason for hiding this comment

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

Would it be worth adding part of the comment from your PR description here just to help future readers of the code have that context? Otherwise it sticks out a little bit because every where else you return the found variable.

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: Merge after addressing the comments.

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @manishrjain, @martinmr, and @pullrequest[bot])


posting/index.go, line 334 at r1 (raw file):

Previously, pullrequest[bot] wrote…

Would it be worth adding part of the comment from your PR description here just to help future readers of the code have that context? Otherwise it sticks out a little bit because every where else you return the found variable.

Agreed. Please add a comment here.

@pawanrawal pawanrawal merged commit 2f18d10 into master Aug 21, 2019
@pawanrawal pawanrawal deleted the pawan/fix-3803 branch August 22, 2019 00:06
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.

Delete mutation on non-existing triple deletes index entry
2 participants