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 discard stats moved by GC bug (#929) #1098

Merged
merged 1 commit into from
Oct 24, 2019

Conversation

jarifibrahim
Copy link
Contributor

@jarifibrahim jarifibrahim commented Oct 24, 2019

The discard stats are stored like normal keys in badger, which means if
the size of the value of discard stats key is greater the value threshold it
will be stored in the value log. When value log GC happens, we insert
the same key in badger with a !badger!move prefix which points to the
new value log file. So when searching for the value of a key, if the value
points to a value log file which doesn't exist, we search for the same
key with !badger!move prefix.

The above logic was missing from the populateDiscardStats function. The
earlier implementation would never search for the key with !badger!move
prefix. It would return error on the first attempt to find the key. This
commit ensures we search for a key with prefix badger move if the value
for the existing key pointed to a value log file that no longer exists.

Original PR #929


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.


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

Copy link
Contributor

@danielmai danielmai 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 r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ashish-goswami and @manishrjain)

@jarifibrahim
Copy link
Contributor Author

Adding #929 to release/1.6 branch.

The discard stats are stored like normal keys in badger, which means if
the size of the value of discard stats key is greater the value threshold it
will be stored in the value log. When value log GC happens, we insert
the same key in badger with a !badger!move prefix which points to the
new value log file. So when searching for the value of a key, if the value
points to a value log file which doesn't exist, we search for the same
key with !badger!move prefix.

The above logic was missing from the populateDiscardStats function. The
earlier implementation would never search for the key with !badger!move
prefix. It would return error on the first attempt to find the key. This
commit ensures we search for a key with prefix badger move if the value
for the existing key pointed to a value log file that no longer exists.
@jarifibrahim jarifibrahim force-pushed the ibrahim/1.6-disard-stats-moved-bug branch from c9212f1 to 596d5ef Compare October 24, 2019 15:30
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

@coveralls
Copy link

coveralls commented Oct 24, 2019

Coverage Status

Coverage decreased (-0.3%) to 78.415% when pulling 596d5ef on ibrahim/1.6-disard-stats-moved-bug into 64eb1df on release/v1.6.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 78.208% when pulling 596d5ef on ibrahim/1.6-disard-stats-moved-bug into 64eb1df on release/v1.6.

@jarifibrahim
Copy link
Contributor Author

This branch does not contain the fixes for windows build and that's why it's failing.

Copy link
Contributor

@danielmai danielmai left a comment

Choose a reason for hiding this comment

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

Windows fixes can go in a separate PR. This looks good to merge on my side to fix the issue on Linux environments.

Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @ashish-goswami, @danielmai, and @manishrjain)

@jarifibrahim jarifibrahim merged commit efb9d9d into release/v1.6 Oct 24, 2019
@jarifibrahim jarifibrahim deleted the ibrahim/1.6-disard-stats-moved-bug branch October 24, 2019 17:21
danielmai added a commit to dgraph-io/dgraph that referenced this pull request Oct 24, 2019
This vendors in Badger v1.6.0 with dgraph-io/badger#929 cherry-picked
into it (dgraph-io/badger#1098) to avoid any breaking changes to the
data format.
danielmai added a commit to dgraph-io/dgraph that referenced this pull request Oct 24, 2019
This vendors in Badger v1.6.0 with dgraph-io/badger#929 cherry-picked
into it (dgraph-io/badger#1098) to avoid any breaking changes to the
data format.

Vendor in Badger to fix a bug that prevents Alpha from starting
up successfully. This happens in v1.0.16 and v1.0.17.

    Error while creating badger KV posting store error: Unable to find log file. Please retry

The release/v1.0 branch uses the vendor directory for
dependencies. Badger was pulled in with the following command:

    govendor fetch github.com/dgraph-io/badger/...@efb9d9d15d7f7baa656e04933058f006c33a8d0f
danielmai added a commit to dgraph-io/dgraph that referenced this pull request Oct 24, 2019
This vendors in Badger v1.6.0 with dgraph-io/badger#929 cherry-picked
into it (dgraph-io/badger#1098) to avoid any breaking changes to the
data format.

Vendor in Badger to fix a bug that prevents Alpha from starting
up successfully. This happens in v1.0.16 and v1.0.17.

    Error while creating badger KV posting store error: Unable to find log file. Please retry

The release/v1.0 branch uses the vendor directory for
dependencies. Badger was pulled in with the following command:

    govendor fetch github.com/dgraph-io/badger/...@efb9d9d15d7f7baa656e04933058f006c33a8d0f
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.

3 participants