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

feat(storage): per table try wait epoch #18622

Merged
merged 44 commits into from
Sep 27, 2024
Merged

Conversation

wenym1
Copy link
Contributor

@wenym1 wenym1 commented Sep 20, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Previously in try_wait_epoch, we only specify an epoch to wait, and then we wait for the global max committed epoch to bump up. In partial checkpoint, there won't be max committed epoch any more, and we wait on the committed epoch of a specific table id.

For most current calls on try_wait_epoch, there is an associated table id to wait on, such as StorageTable. The only exception is the wait_epoch_commit rpc used in configuration change. In this PR, we will pick a random existing table id to wait on, and if there is no existing table id, we can just skip calling it. After #18312, this logic will be no longer necessary.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@wenym1 wenym1 changed the base branch from main to yiming/per-table-pin-snapshot September 23, 2024 10:14
Base automatically changed from yiming/per-table-pin-snapshot to main September 23, 2024 11:44
@@ -606,10 +620,17 @@ pub(crate) async fn wait_for_epoch(
return Err(HummockError::wait_epoch("tx dropped").into());
}
Ok(Ok(_)) => {
let max_committed_epoch = *receiver.borrow();
if max_committed_epoch >= wait_epoch {
// TODO: should handle the corner case of drop table
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't handle the corner case in this PR, does it mean that wait_for_epoch will be blocked forever? For example, when a batch query is issued to CN but before execution the table is dropped, will the query be blocked at waif_for_epoch forever?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just updated the code.

A separate BatchQueryCommitted variant is introduced to HummockReadEpoch to provide an extra hummock version id to wait on for batch query. In the hummock version of the provided id, the table id must have been registered to hummock. In this way, if the table id does not exist in a later version, the table must have been dropped, and then we will return with an error.

For the wait_epoch in streaming executor, we can assume that when the streaming executor exists, its streaming job will prevent the table from being dropped, and therefore when we see that a table id does exist in the latest version, the table must not be already dropped, and then we can wait for the table id be registered in later version.

@wenym1 wenym1 added this pull request to the merge queue Sep 27, 2024
Merged via the queue into main with commit e9c2161 Sep 27, 2024
31 of 34 checks passed
@wenym1 wenym1 deleted the yiming/per-table-try-wait-epoch branch September 27, 2024 05:34
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.

3 participants