Skip to content

Commit

Permalink
show background_ddl in mv catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Oct 24, 2024
1 parent e6f830b commit f1b77fb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions e2e_test/ddl/drop/drop_creating_mv.slt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ risedev psql -c 'create materialized view m1 as select * from t;' &
onlyif can-use-recover
sleep 5s

query I
select background_ddl from rw_catalog.rw_materialized_views where name='m1';
----
f

onlyif can-use-recover
statement ok
drop materialized view m1;
Expand All @@ -33,6 +38,11 @@ create materialized view m1 as select * from t;
onlyif can-use-recover
sleep 5s

query I
select background_ddl from rw_catalog.rw_materialized_views where name='m1';
----
t

onlyif can-use-recover
statement ok
drop materialized view m1;
Expand All @@ -48,13 +58,23 @@ create materialized view m1 as select * from t;
onlyif can-use-recover
sleep 5s

query I
select background_ddl from rw_catalog.rw_materialized_views where name='m1';
----
t

onlyif can-use-recover
statement ok
recover;

onlyif can-use-recover
sleep 10s

query I
select background_ddl from rw_catalog.rw_materialized_views where name='m1';
----
t

onlyif can-use-recover
statement ok
drop materialized view m1;
Expand All @@ -69,6 +89,11 @@ set background_ddl=false;
statement ok
create materialized view m1 as select * from t;

query I
select background_ddl from rw_catalog.rw_materialized_views where name='m1';
----
f

statement ok
drop materialized view m1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use risingwave_common::catalog::CreateType;
use risingwave_common::types::{Fields, Timestamptz};
use risingwave_frontend_macro::system_catalog;
use risingwave_pb::user::grant_privilege::Object;
Expand All @@ -33,6 +34,7 @@ struct RwMaterializedView {
created_at: Option<Timestamptz>,
initialized_at_cluster_version: Option<String>,
created_at_cluster_version: Option<String>,
background_ddl: bool,
}

#[system_catalog(table, "rw_catalog.rw_materialized_views")]
Expand Down Expand Up @@ -62,6 +64,7 @@ fn read_rw_materialized_views(reader: &SysCatalogReaderImpl) -> Result<Vec<RwMat
created_at: table.created_at_epoch.map(|e| e.as_timestamptz()),
initialized_at_cluster_version: table.initialized_at_cluster_version.clone(),
created_at_cluster_version: table.created_at_cluster_version.clone(),
background_ddl: table.create_type == CreateType::Background,
})
})
.collect())
Expand Down

0 comments on commit f1b77fb

Please sign in to comment.