-
Notifications
You must be signed in to change notification settings - Fork 592
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
refactor(meta): clarify the completeness of internal table catalogs #18944
Merged
+83
−22
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -1040,11 +1040,14 @@ impl DdlController { | |
streaming_job.set_dml_fragment_id(fragment_graph.dml_fragment_id()); | ||
|
||
// create internal table catalogs and refill table id. | ||
let internal_tables = fragment_graph.internal_tables().into_values().collect_vec(); | ||
let incomplete_internal_tables = fragment_graph | ||
.incomplete_internal_tables() | ||
.into_values() | ||
.collect_vec(); | ||
let table_id_map = self | ||
.metadata_manager | ||
.catalog_controller | ||
.create_internal_table_catalog(&streaming_job, internal_tables) | ||
.create_internal_table_catalog(&streaming_job, incomplete_internal_tables) | ||
.await?; | ||
fragment_graph.refill_internal_table_ids(table_id_map); | ||
|
||
|
@@ -1560,7 +1563,6 @@ impl DdlController { | |
) -> MetaResult<(CreateStreamingJobContext, TableFragments)> { | ||
let id = stream_job.id(); | ||
let specified_parallelism = fragment_graph.specified_parallelism(); | ||
let internal_tables = fragment_graph.internal_tables(); | ||
let expr_context = stream_ctx.to_expr_context(); | ||
let max_parallelism = NonZeroUsize::new(fragment_graph.max_parallelism()).unwrap(); | ||
|
||
|
@@ -1643,6 +1645,7 @@ impl DdlController { | |
table_parallelism, | ||
max_parallelism.get(), | ||
); | ||
let internal_tables = table_fragments.internal_tables(); | ||
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. The |
||
|
||
if let Some(mview_fragment) = table_fragments.mview_fragment() { | ||
stream_job.set_table_vnode_count(mview_fragment.vnode_count()); | ||
|
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
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
Oops, something went wrong.
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.
As the notification now goes after successfully scheduling and building of the job, a failure here does not always mean that the notification was sent. That's why we changed all
DROP
handlers in the frontend to beDROP .. IF EXISTS
.An alternative could be introducing a new operation like
Cleanup
for this purposes, ensuringDelete
remains strictly applied. But it seems too ad-hoc to me as there's no much other usage of it.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.
Can there be a race condition? Whereby we have
Delete
of some catalog followed byAdd
of that catalog?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.
I think not because
try_abort_creating_streaming_job
is called only aftercreate_streaming_job_inner
has returned with error, whereAdd
is either pushed into the notification queue or not issued at all. After entering thistry_abort
function, no furtherAdd
operations will occur.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.
🤔 We ensured that
CREATE
andDROP
will be properly paired in #18476 .Even if theCREATE
notification fails to send due to either a FE or meta node reboot or a broken connection between them, the creation of the mview and its internal table catalogs will still be synchronized through an initial snapshot.