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(meta): fix ctrl c cancels streaming job #13415

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/meta/src/manager/catalog/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,18 @@ impl DatabaseManager {
.map(|(k, _)| *k)
}

pub fn find_persisted_creating_table_id(&self, key: &RelationKey) -> Option<TableId> {
self.tables
.iter()
.find(|(_, t)| {
t.stream_job_status == PbStreamJobStatus::Creating as i32
&& t.database_id == key.0
&& t.schema_id == key.1
&& t.name == key.2
})
.map(|(k, _)| *k)
}

pub fn all_creating_streaming_jobs(&self) -> impl Iterator<Item = TableId> + '_ {
self.in_progress_creation_streaming_job.keys().cloned()
}
Expand Down
14 changes: 9 additions & 5 deletions src/meta/src/manager/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2621,11 +2621,15 @@ impl CatalogManager {
infos
.into_iter()
.flat_map(|info| {
guard.database.find_creating_streaming_job_id(&(
info.database_id,
info.schema_id,
info.name,
))
let relation_key = &(info.database_id, info.schema_id, info.name);
guard
.database
.find_creating_streaming_job_id(&relation_key)
.or_else(|| {
guard
.database
.find_persisted_creating_table_id(&relation_key)
})
})
.collect_vec()
}
Expand Down
Loading