-
Notifications
You must be signed in to change notification settings - Fork 590
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(batch): release epoch at the end of the distributed query if it contains lookup join #6997
Merged
mergify
merged 4 commits into
main
from
dylan/release_epoch_at_the_end_of_distributed_query
Dec 21, 2022
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8874cdf
release epoch at the end of the distributed query
chenzl25 36b6694
Revert "release epoch at the end of the distributed query"
chenzl25 70d4a7e
delay epoch unpin util the end of the distributed query
chenzl25 4ab9958
Merge branch 'main' into dylan/release_epoch_at_the_end_of_distribute…
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
delay epoch unpin util the end of the distributed query
- Loading branch information
commit 70d4a7e659fcbef3dc630a5f7b8976ae5a021d03
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,6 +236,7 @@ impl QueryRunner { | |
); | ||
} | ||
let mut stages_with_table_scan = self.query.stages_with_table_scan(); | ||
let has_lookup_join_stage = self.query.has_lookup_join_stage(); | ||
// To convince the compiler that `pinned_snapshot` will only be dropped once. | ||
let mut pinned_snapshot_to_drop = Some(pinned_snapshot); | ||
while let Some(msg_inner) = self.msg_receiver.recv().await { | ||
|
@@ -248,7 +249,9 @@ impl QueryRunner { | |
); | ||
self.scheduled_stages_count += 1; | ||
stages_with_table_scan.remove(&stage_id); | ||
if stages_with_table_scan.is_empty() { | ||
// If query contains lookup join we need to delay epoch unpin util the end of | ||
// the query. | ||
if !has_lookup_join_stage && stages_with_table_scan.is_empty() { | ||
// We can be sure here that all the Hummock iterators have been created, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will there be race cases previously? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks fine. I can't tell. |
||
// thus they all successfully pinned a HummockVersion. | ||
// So we can now unpin their epoch. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to add some comments for why remove the early unpin.