Skip to content

Commit

Permalink
clear tracker for non-background jobs when clean
Browse files Browse the repository at this point in the history
  • Loading branch information
yezizp2012 committed Aug 6, 2024
1 parent 9474aa1 commit a937721
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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 @@ -352,6 +352,18 @@ impl DatabaseManager {
.collect_vec()
}

pub fn list_creating_background_mv_ids(&self) -> HashSet<TableId> {
self.tables
.values()
.filter(|&t| {
t.stream_job_status == PbStreamJobStatus::Creating as i32
&& t.table_type == TableType::MaterializedView as i32
&& t.create_type == CreateType::Background as i32
})
.map(|t| t.id)
.collect()
}

pub fn list_persisted_creating_tables(&self) -> Vec<Table> {
self.tables
.values()
Expand Down
4 changes: 4 additions & 0 deletions src/meta/src/manager/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ impl CatalogManagerCore {
{
let _ = tx.send(Err(err.clone()));
}
let creating_background_mvs = self.database.list_creating_background_mv_ids();
self.database
.in_progress_creation_streaming_job
.retain(|id, _| creating_background_mvs.contains(id));
}
}

Expand Down

0 comments on commit a937721

Please sign in to comment.