From a47f4d3026b1cfec4bf9d02afd8eb5fd3e276c13 Mon Sep 17 00:00:00 2001 From: leftgeek <1094669802@qq.com> Date: Sat, 11 May 2024 11:07:45 +0000 Subject: [PATCH] disable alter partition of materialized view --- deps/oblib/src/lib/container/ob_mask_set2.h | 12 ++++++------ src/rootserver/ob_ddl_service.cpp | 4 ++++ src/sql/resolver/ddl/ob_alter_table_resolver.cpp | 4 ++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/deps/oblib/src/lib/container/ob_mask_set2.h b/deps/oblib/src/lib/container/ob_mask_set2.h index 0aac3f7d06..fc3c640f0a 100644 --- a/deps/oblib/src/lib/container/ob_mask_set2.h +++ b/deps/oblib/src/lib/container/ob_mask_set2.h @@ -31,9 +31,9 @@ public: { int ret = OB_SUCCESS; if (NULL == array) { - ret = OB_INVALID_ARGUMENT; - } else if (OB_FAIL(bitset_.reserve(array->count()))) { - } else { + ret = OB_INVALID_ARGUMENT; + } else if (OB_FAIL(bitset_.reserve(array->count()))) { + } else { array_ = array; is_inited_ = true; } @@ -135,9 +135,9 @@ public: return bool_ret; } int get_not_mask(ObIArray &array) const - { - int ret = OB_SUCCESS; - if (!is_inited_) { + { + int ret = OB_SUCCESS; + if (!is_inited_) { ret = OB_NOT_INIT; } else { array.reset(); diff --git a/src/rootserver/ob_ddl_service.cpp b/src/rootserver/ob_ddl_service.cpp index 65302f64c3..ed7d74e2ee 100755 --- a/src/rootserver/ob_ddl_service.cpp +++ b/src/rootserver/ob_ddl_service.cpp @@ -14431,6 +14431,10 @@ int ObDDLService::check_alter_partitions(const ObTableSchema &orig_table_schema, LOG_WARN("fail to get schema guard with version in inner table", K(ret), K(tenant_id)); } else if (OB_FAIL(ObCompatModeGetter::check_is_oracle_mode_with_tenant_id(tenant_id, is_oracle_mode))) { LOG_WARN("fail to check is oracle mode", K(ret)); + } else if (orig_table_schema.is_materialized_view()) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("alter partition of materialized view is not supported", KR(ret)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "alter partition of materialized view is"); } else if (orig_table_schema.is_interval_part()) { if (PARTITION_LEVEL_TWO == orig_table_schema.get_part_level() && !orig_table_schema.has_sub_part_template_def()) { diff --git a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp index 1b78009fa3..c42ce001ff 100644 --- a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp +++ b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp @@ -4520,6 +4520,10 @@ int ObAlterTableResolver::resolve_partition_options(const ParseNode &node) if (OB_ISNULL(alter_table_stmt)) { ret = OB_ERR_UNEXPECTED; SQL_RESV_LOG(WARN, "alter table stmt should not be null", K(ret)); + } else if (table_schema_->is_materialized_view()) { + ret = OB_NOT_SUPPORTED; + LOG_WARN("alter partition of materialized view is not supported", KR(ret)); + LOG_USER_ERROR(OB_NOT_SUPPORTED, "alter partition of materialized view is"); } if (OB_SUCC(ret)) {