Skip to content

Commit

Permalink
fix: DROP DATABASE doesn't clean up the source stream job (in v1) (#…
Browse files Browse the repository at this point in the history
…18033)

Signed-off-by: xxchan <[email protected]>
  • Loading branch information
xxchan authored Sep 3, 2024
1 parent 5ab2a59 commit 51d3c63
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/meta/src/manager/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,20 +625,21 @@ impl CatalogManager {
.notify_frontend(Operation::Delete, Info::Database(database))
.await;

let catalog_deleted_ids = tables_to_drop
let streaming_job_deleted_ids = tables_to_drop
.into_iter()
.filter(|table| valid_table_name(&table.name))
.map(|table| StreamingJobId::new(table.id))
.chain(sources_to_drop.iter().filter_map(|source| {
source
.info
.as_ref()
.and_then(|info| info.is_shared().then(|| StreamingJobId::new(source.id)))
}))
.chain(
sinks_to_drop
.into_iter()
.map(|sink| StreamingJobId::new(sink.id)),
)
.chain(
subscriptions_to_drop
.into_iter()
.map(|subscription| StreamingJobId::new(subscription.id)),
)
.collect_vec();
let source_deleted_ids = sources_to_drop
.into_iter()
Expand All @@ -647,7 +648,7 @@ impl CatalogManager {

Ok((
version,
catalog_deleted_ids,
streaming_job_deleted_ids,
source_deleted_ids,
connections_dropped,
))
Expand Down

0 comments on commit 51d3c63

Please sign in to comment.