[CP] fix parser, not allow to create table with cg during updating
This commit is contained in:
parent
55336b4477
commit
f1dbf3b1b4
@ -1231,6 +1231,17 @@ int ObSchemaUtils::is_drop_column_only(const AlterTableSchema &alter_table_schem
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObSchemaUtils::can_add_column_group(const ObTableSchema &table_schema)
|
||||
{
|
||||
bool can_add_cg = false;
|
||||
if (table_schema.is_user_table()
|
||||
|| table_schema.is_tmp_table()
|
||||
|| table_schema.is_index_table()) {
|
||||
can_add_cg = true;
|
||||
}
|
||||
return can_add_cg;
|
||||
}
|
||||
|
||||
} // end schema
|
||||
} // end share
|
||||
} // end oceanbase
|
||||
|
@ -156,6 +156,7 @@ public:
|
||||
static int mock_default_cg(
|
||||
const uint64_t tenant_id,
|
||||
share::schema::ObTableSchema &new_table_schema);
|
||||
static bool can_add_column_group(const ObTableSchema &table_schema);
|
||||
|
||||
// Optimized method to batch get latest table schemas from cache or inner_table automatically.
|
||||
//
|
||||
|
@ -8690,6 +8690,10 @@ int ObTableSchema::add_column_group(const ObColumnGroupSchema &other)
|
||||
if (!other.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(other));
|
||||
} else if (other.get_column_group_type() != ObColumnGroupType::DEFAULT_COLUMN_GROUP
|
||||
&& !ObSchemaUtils::can_add_column_group(*this)) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("only default column group is allowded to add to not user/tmp table", K(ret), K(other), KPC(this));
|
||||
} else if (OB_FAIL(do_add_column_group(other))) {
|
||||
LOG_WARN("fail to do add column group", KR(ret), K(other));
|
||||
}
|
||||
|
@ -3283,8 +3283,7 @@ int ObCreateTableResolver::resolve_column_group(const ParseNode *cg_node)
|
||||
LOG_WARN("fail to reserve", KR(ret), K(column_cnt));
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
||||
LOG_WARN("fail to get min data version", KR(ret), K(tenant_id));
|
||||
} else if (!(compat_version >= DATA_VERSION_4_3_0_0)
|
||||
&& can_add_column_group(table_schema)) {
|
||||
} else if (!(compat_version >= DATA_VERSION_4_3_0_0)) {
|
||||
if (OB_NOT_NULL(cg_node) && (T_COLUMN_GROUP == cg_node->type_)) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("can't support column store if version less than 4_1_0_0", KR(ret), K(compat_version));
|
||||
@ -3303,7 +3302,8 @@ int ObCreateTableResolver::resolve_column_group(const ParseNode *cg_node)
|
||||
if (OB_SUCC(ret) && OB_LIKELY(tenant_config.is_valid()) && nullptr == cg_node) {
|
||||
|
||||
/* force to build each cg*/
|
||||
if (OB_FAIL(ObTableStoreFormat::find_table_store_type(
|
||||
if (!ObSchemaUtils::can_add_column_group(table_schema)) {
|
||||
} else if (OB_FAIL(ObTableStoreFormat::find_table_store_type(
|
||||
tenant_config->default_table_store_format.get_value_string(),
|
||||
table_store_type))) {
|
||||
LOG_WARN("fail to get table store format", K(ret), K(table_store_type));
|
||||
@ -3321,6 +3321,7 @@ int ObCreateTableResolver::resolve_column_group(const ParseNode *cg_node)
|
||||
/* force to build all cg*/
|
||||
ObColumnGroupSchema all_cg;
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (!ObSchemaUtils::can_add_column_group(table_schema)) {
|
||||
} else if (ObTableStoreFormat::is_row_with_column_store(table_store_type)) {
|
||||
bool is_all_cg_exist = false;
|
||||
if (OB_FAIL(table_schema.is_column_group_exist(OB_ALL_COLUMN_GROUP_NAME, is_all_cg_exist))) {
|
||||
@ -3355,15 +3356,6 @@ int ObCreateTableResolver::resolve_column_group(const ParseNode *cg_node)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObCreateTableResolver::can_add_column_group(const ObTableSchema &table_schema)
|
||||
{
|
||||
bool can_add_cg = false;
|
||||
if (table_schema.is_user_table()
|
||||
|| table_schema.is_tmp_table()) {
|
||||
can_add_cg = true;
|
||||
}
|
||||
return can_add_cg;
|
||||
}
|
||||
|
||||
int ObCreateTableResolver::add_inner_index_for_heap_gtt() {
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -134,7 +134,6 @@ private:
|
||||
uint64_t gen_column_group_id();
|
||||
int resolve_column_group(const ParseNode *cg_node);
|
||||
|
||||
bool can_add_column_group(const ObTableSchema &table_schema);
|
||||
int add_inner_index_for_heap_gtt();
|
||||
int check_max_row_data_length(const ObTableSchema &table_schema);
|
||||
|
||||
|
@ -11929,6 +11929,9 @@ int ObDDLResolver::parse_column_group(const ParseNode *column_group_node,
|
||||
if (OB_ISNULL(column_group_node)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("column gorup node should not be null", K(ret));
|
||||
} else if (!ObSchemaUtils::can_add_column_group(table_schema)) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("not supported table type to add column group", K(ret));
|
||||
} else {
|
||||
dst_table_schema.set_max_used_column_group_id(table_schema.get_max_used_column_group_id());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user