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

fix(Dgraph): check for deleteBelowTs in pIterator.valid #7288

Merged
merged 6 commits into from
Jan 19, 2021

Conversation

ajeetdsouza
Copy link
Contributor

@ajeetdsouza ajeetdsouza commented Jan 13, 2021

Fixes DGRAPH-2705.

To reproduce, first insert a large number of edges of the form:

<0x1> <follows> <0x2> .
<0x1> <follows> <0x3> .
<0x1> <follows> <0x4> .
...

and then delete all of them:

<0x1> <follows> * .

After this, we can still see a few edges left despite the delete succeeding.

The reason this happens is that each part in a pIterator is initialized with a valid function, which checks if the iterator is currently on a valid block of UIDs, and skips to the next valid block if not. In contrast, the next function advances to the next valid block regardless of whether the current block is valid or not.

The next function checks the deleteBelowTs to ensure that we don't end up reading deleted data from the disk, however, the valid function did not earlier include that check. As a result, we would end up reading one deleted UID from each part in the split posting list, after which we would call next, which would discard the rest of the part. This PR adds the same deleteBelowTs check to the valid function as well, to ensure that this does not happen.

This change is Reviewable

@ajeetdsouza ajeetdsouza marked this pull request as ready for review January 13, 2021 02:46
Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

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

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

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

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

Can you add a test for this?

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @manishrjain and @martinmr)

Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

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

This PR needs a better description.

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:

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @martinmr and @vvbalaji-dgraph)

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.

4 participants