[CP] update target table's encryption when remap tablespace

This commit is contained in:
hamstersox 2023-09-21 08:40:27 +00:00 committed by ob-robot
parent 62210063dd
commit 99eb951103
3 changed files with 21 additions and 5 deletions

View File

@ -2750,12 +2750,16 @@ int ObDDLService::set_raw_table_options(
break;
}
case ObAlterTableArg::ENCRYPTION: {
new_table_schema.set_encryption_str(alter_table_schema.get_encryption_str());
if (OB_FAIL(new_table_schema.set_encryption_str(alter_table_schema.get_encryption_str()))) {
LOG_WARN("fail to set encryption_str", K(ret), K(alter_table_schema.get_encryption_str()));
}
break;
}
case ObAlterTableArg::TABLESPACE_ID: {
new_table_schema.set_tablespace_id(alter_table_schema.get_tablespace_id());
new_table_schema.set_encryption_str(alter_table_schema.get_encryption_str());
if (OB_FAIL(new_table_schema.set_encryption_str(alter_table_schema.get_encryption_str()))) {
LOG_WARN("fail to set encryption_str", K(ret), K(alter_table_schema.get_encryption_str()));
}
break;
}
case ObAlterTableArg::TTL_DEFINITION: {
@ -15397,6 +15401,7 @@ int ObDDLService::reconstruct_index_schema(obrpc::ObAlterTableArg &alter_table_a
} else if (OB_FAIL(generate_tablet_id(new_index_schema))) {
LOG_WARN("fail to generate tablet id for hidden table", K(ret), K(new_index_schema));
} else {
bool is_exist = false;
new_index_schema.set_max_used_column_id(max(
new_index_schema.get_max_used_column_id(), hidden_table_schema.get_max_used_column_id()));
new_index_schema.set_table_id(new_idx_tid);
@ -15405,7 +15410,13 @@ int ObDDLService::reconstruct_index_schema(obrpc::ObAlterTableArg &alter_table_a
new_index_schema.set_tenant_id(hidden_table_schema.get_tenant_id());
new_index_schema.set_database_id(hidden_table_schema.get_database_id());
new_index_schema.set_table_state_flag(target_flag);
bool is_exist = false;
if (is_recover_restore_table) {
if (OB_FAIL(new_index_schema.set_encryption_str(hidden_table_schema.get_encryption_str()))) {
LOG_WARN("set encryption str failed", K(ret), K(hidden_table_schema.get_encryption_str()));
} else {
new_index_schema.set_tablespace_id(hidden_table_schema.get_tablespace_id());
}
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(dest_schema_guard.check_table_exist(new_index_schema.get_tenant_id(),
new_index_schema.get_database_id(),

View File

@ -880,7 +880,9 @@ int ObIndexBuilder::set_basic_infos(const ObCreateIndexArg &arg,
schema.set_store_format(data_schema.get_store_format());
schema.set_storage_format_version(data_schema.get_storage_format_version());
schema.set_tablespace_id(arg.index_schema_.get_tablespace_id());
schema.set_encryption_str(arg.index_schema_.get_encryption_str());
if (OB_FAIL(schema.set_encryption_str(arg.index_schema_.get_encryption_str()))) {
LOG_WARN("fail to set set_encryption_str", K(ret), K(arg));
}
if (data_schema.get_max_used_column_id() > schema.get_max_used_column_id()) {
schema.set_max_used_column_id(data_schema.get_max_used_column_id());
@ -889,7 +891,8 @@ int ObIndexBuilder::set_basic_infos(const ObCreateIndexArg &arg,
schema.set_autoinc_column_id(0);
schema.set_progressive_merge_num(data_schema.get_progressive_merge_num());
schema.set_progressive_merge_round(data_schema.get_progressive_merge_round());
if (OB_FAIL(schema.set_compress_func_name(data_schema.get_compress_func_name()))) {
if (OB_FAIL(ret)) {
} else if (OB_FAIL(schema.set_compress_func_name(data_schema.get_compress_func_name()))) {
LOG_WARN("set_compress_func_name failed", K(data_schema));
} else if (OB_INVALID_ID != schema.get_tablespace_id()) {
if (OB_FAIL(schema_guard.get_tablespace_schema(

View File

@ -770,6 +770,8 @@ int ObImportTableTaskScheduler::construct_import_table_schema_(
} else if (OB_ISNULL(schema)) {
ret = OB_TABLESPACE_NOT_EXIST;
LOG_WARN("tablespace must not be null", K(ret), KPC_(import_task));
} else if (OB_FAIL(target_table_schema.set_encryption_str(schema->get_encryption_name()))) {
LOG_WARN("failed to set encryption str", K(ret));
} else {
target_table_schema.set_tablespace_id(schema->get_tablespace_id());
}