fix bug, add column fail due to update_single_column_group
This commit is contained in:
parent
22d187b462
commit
75713132e5
@ -4078,11 +4078,6 @@ int ObDDLOperator::update_single_column(common::ObMySQLTransaction &trans,
|
||||
trans, origin_table_schema, new_table_schema, column_schema,
|
||||
true /* record_ddl_operation */))) {
|
||||
RS_LOG(WARN, "failed to update single column", K(ret));
|
||||
} else if (OB_ISNULL(orig_column_schema)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
RS_LOG(WARN, "failed to get orig column schema", K(ret), K(origin_table_schema), K(column_schema));
|
||||
} else if (OB_FAIL(update_single_column_group(trans, origin_table_schema, *orig_column_schema, column_schema))) {
|
||||
RS_LOG(WARN, "fail to update single column group", K(ret));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -4090,20 +4085,24 @@ int ObDDLOperator::update_single_column(common::ObMySQLTransaction &trans,
|
||||
|
||||
int ObDDLOperator::update_single_column_group(common::ObMySQLTransaction &trans,
|
||||
const ObTableSchema &origin_table_schema,
|
||||
const ObColumnSchemaV2 &origin_column_schema,
|
||||
const ObColumnSchemaV2 &column_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_each_cg_exist = false;
|
||||
const ObColumnSchemaV2 *orig_column_schema = nullptr;
|
||||
char cg_name[OB_MAX_COLUMN_GROUP_NAME_LENGTH] = {'\0'};
|
||||
ObString cg_name_str(OB_MAX_COLUMN_GROUP_NAME_LENGTH, 0, cg_name);
|
||||
const uint64_t tenant_id = origin_table_schema.get_tenant_id();
|
||||
ObColumnGroupSchema *ori_cg = nullptr;
|
||||
ObSchemaService *schema_service_impl = schema_service_.get_schema_service();
|
||||
if (!origin_table_schema.is_valid() || !origin_column_schema.is_valid() || !column_schema.is_valid()) {
|
||||
orig_column_schema = origin_table_schema.get_column_schema(column_schema.get_column_id());
|
||||
if (!origin_table_schema.is_valid() || !column_schema.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
RS_LOG(WARN, "Invalid arguemnt", K(ret), K(origin_table_schema), K(origin_column_schema), K(column_schema));
|
||||
} else if (origin_column_schema.get_column_name_str() == column_schema.get_column_name_str()) {
|
||||
RS_LOG(WARN, "Invalid arguemnt", K(ret), K(origin_table_schema), K(column_schema));
|
||||
} else if (OB_ISNULL(orig_column_schema)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
RS_LOG(WARN, "column should not be null", K(ret), K(column_schema), K(origin_table_schema));
|
||||
} else if (orig_column_schema->get_column_name_str() == column_schema.get_column_name_str()) {
|
||||
/* now only rename column will use this func, other skip*/
|
||||
} else if (!origin_table_schema.is_column_store_supported()) {
|
||||
/* only support table need column group*/
|
||||
@ -4113,14 +4112,14 @@ int ObDDLOperator::update_single_column_group(common::ObMySQLTransaction &trans,
|
||||
/* if each cg not exist skip*/
|
||||
} else if (column_schema.is_virtual_generated_column()) {
|
||||
/* skip virtual generated_column*/
|
||||
} else if (OB_FAIL(origin_column_schema.get_each_column_group_name(cg_name_str))) {
|
||||
} else if (OB_FAIL(orig_column_schema->get_each_column_group_name(cg_name_str))) {
|
||||
RS_LOG(WARN, "fail to get each column group name", K(ret));
|
||||
} else if (OB_FAIL(origin_table_schema.get_column_group_by_name(cg_name_str, ori_cg))) {
|
||||
RS_LOG(WARN, "column group cannot get", K(cg_name_str), K(origin_table_schema));
|
||||
} else if (OB_ISNULL(ori_cg)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
RS_LOG(WARN, "column group should not be null", K(ret), K(cg_name_str),
|
||||
K(origin_column_schema), K(origin_table_schema));
|
||||
KPC(orig_column_schema), K(origin_table_schema));
|
||||
} else {
|
||||
ObColumnGroupSchema new_cg;
|
||||
if (OB_FAIL(new_cg.assign(*ori_cg))) {
|
||||
|
@ -976,7 +976,6 @@ public:
|
||||
share::schema::ObColumnSchemaV2 &column_schema);
|
||||
int update_single_column_group(common::ObMySQLTransaction &trans,
|
||||
const ObTableSchema &origin_table_schema,
|
||||
const ObColumnSchemaV2 &origin_column_schema,
|
||||
const ObColumnSchemaV2 &new_column_schema);
|
||||
int update_partition_option(common::ObMySQLTransaction &trans,
|
||||
share::schema::ObTableSchema &table_schema);
|
||||
|
@ -9065,6 +9065,8 @@ int ObDDLService::alter_table_update_aux_column(
|
||||
new_aux_column_schema))) {
|
||||
RS_LOG(WARN, "schema service update aux column failed failed",
|
||||
"table schema", *aux_table_schema, K(ret));
|
||||
} else if (OB_FAIL(ddl_operator.update_single_column_group(trans, *aux_table_schema, new_aux_column_schema))) {
|
||||
RS_LOG(WARN, "fail to update column group schema name ", K(ret));
|
||||
} else if (OB_FAIL(ddl_operator.sync_aux_schema_version_for_history(
|
||||
trans,
|
||||
*aux_table_schema))) {
|
||||
@ -10145,6 +10147,8 @@ int ObDDLService::alter_table_column(const ObTableSchema &origin_table_schema,
|
||||
} else if (OB_FAIL(ddl_operator.update_single_column(
|
||||
trans, origin_table_schema, new_table_schema, new_column_schema))) {
|
||||
RS_LOG(WARN, "failed to alter column", K(alter_column_schema), K(ret));
|
||||
} else if (OB_FAIL(ddl_operator.update_single_column_group(trans, origin_table_schema, new_column_schema))) {
|
||||
RS_LOG(WARN, "failed to update column group", K(ret));
|
||||
} else if (OB_FAIL(alter_shadow_column_for_index(idx_schema_array, alter_column_schema, new_column_schema, ddl_operator, trans))) {
|
||||
RS_LOG(WARN, "failed to alter shadow column for index", K(ret));
|
||||
} else if (OB_FAIL(alter_table_update_index_and_view_column(
|
||||
@ -37216,6 +37220,8 @@ int ObDDLService::pre_rename_mysql_columns_online(
|
||||
if (OB_FAIL(ddl_operator.update_single_column(trans, origin_table_schema, new_table_schema,
|
||||
new_col_schemas.at(i)))) {
|
||||
LOG_WARN("failed to alter column", K(ret), K(new_col_schemas.at(i)));
|
||||
} else if (OB_FAIL(ddl_operator.update_single_column_group(trans, origin_table_schema, new_col_schemas.at(i)))) {
|
||||
LOG_WARN("failed to alter column", K(ret), K(new_col_schemas.at(i)));
|
||||
} else if (OB_FAIL(alter_table_update_index_and_view_column(
|
||||
new_table_schema, new_col_schemas.at(i), ddl_operator, trans,
|
||||
global_idx_schema_array))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user