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 needs_flush assertion in file ingestion #13045

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jowlyzhang
Copy link
Contributor

@jowlyzhang jowlyzhang commented Oct 1, 2024

This PR adds a flush option wait_for_results_readable to make flush wait a bit further until the flushed files are available for reading. And use this option in file ingestion's flush. Manual flush can use this option too if this is what they need.

File ingestion job's second NeedsFlush call could have been invoked when the memtables are flushed but the SuperVersion hasn't been updated yet, triggering the assertion.

Test plan:
Existing tests
Manually stress tested

@facebook-github-bot
Copy link
Contributor

@jowlyzhang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@jowlyzhang has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@jowlyzhang has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@jowlyzhang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@jowlyzhang has updated the pull request. You must reimport the pull request before landing.

// Check if history trim is needed first, so that we can avoid installing a
// new MemTableListVersion without installing a SuperVersion (installed based
// on return value of this function).
if (!current_->HistoryShouldBeTrimmed(usage)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change relies on the current SuperVersion to always quickly catch up and point to the most recent MemTableListVersion. I did a code audit and found this case where this is not guaranteed, so made this change to make it do the same. This also addressed a comment in the original change: https://github.com/facebook/rocksdb/pull/7296/files#r474976458

@jowlyzhang jowlyzhang marked this pull request as ready for review October 1, 2024 17:30
@facebook-github-bot
Copy link
Contributor

@jowlyzhang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants