fix bug, set ddl sqc build ctx with fixed schema version get from ddl record and set schema version in index builder

This commit is contained in:
obdev 2024-09-20 06:55:00 +00:00 committed by ob-robot
parent cb54be1718
commit f34e86d630
2 changed files with 9 additions and 3 deletions

View File

@ -910,9 +910,12 @@ int ObPxSubCoord::start_ddl()
const int64_t ref_table_id = location_keys.at(0).ref_table_id_;
const int64_t ddl_table_id = phy_plan->get_ddl_table_id();
const int64_t ddl_task_id = phy_plan->get_ddl_task_id();
const int64_t schema_version = phy_plan->get_ddl_schema_version();
const int64_t ddl_execution_id = phy_plan->get_ddl_execution_id();
if (OB_FAIL(ObDDLUtil::get_data_information(tenant_id, ddl_task_id, data_format_version, snapshot_version, unused_task_status))) {
uint64_t unused_taget_object_id = OB_INVALID_ID;
int64_t schema_version = OB_INVALID_VERSION;
if (OB_FAIL(ObDDLUtil::get_data_information(tenant_id, ddl_task_id, data_format_version, snapshot_version, unused_task_status, unused_taget_object_id, schema_version))) {
LOG_WARN("get ddl cluster version failed", K(ret));
} else if (OB_UNLIKELY(snapshot_version <= 0)) {
ret = OB_NEED_RETRY;
@ -932,7 +935,7 @@ int ObPxSubCoord::start_ddl()
direct_load_param.runtime_only_param_.exec_ctx_ = exec_ctx;
direct_load_param.runtime_only_param_.task_id_ = ddl_task_id;
direct_load_param.runtime_only_param_.table_id_ = ddl_table_id;
direct_load_param.runtime_only_param_.schema_version_ = schema_version;
direct_load_param.runtime_only_param_.schema_version_ = schema_version; /* set schema version as get from ddl record which is a fixed val */
direct_load_param.runtime_only_param_.task_cnt_ = sqc_arg_.sqc_.get_task_count();
if (OB_FAIL(tenant_direct_load_mgr->alloc_execution_context_id(ddl_ctrl_.context_id_))) {
LOG_WARN("alloc execution context id failed", K(ret));

View File

@ -2283,6 +2283,8 @@ int ObTabletDirectLoadMgr::prepare_index_builder_if_need(const ObTableSchema &ta
data_format_version_, get_micro_index_clustered(),
is_full_direct_load(direct_load_type_) ? SCN::invalid_scn() : table_key_.get_end_scn()))) {
LOG_WARN("fail to init data desc", K(ret));
} else if (FALSE_IT(index_block_desc.get_static_desc().schema_version_ = sqc_build_ctx_.build_param_.runtime_only_param_.schema_version_)) {
/* set as a fixed schema version */
} else {
if (GCTX.is_shared_storage_mode() && !is_incremental_direct_load(direct_load_type_)) {
index_block_desc.get_static_desc().exec_mode_ = compaction::EXEC_MODE_OUTPUT;
@ -2306,6 +2308,7 @@ int ObTabletDirectLoadMgr::prepare_index_builder_if_need(const ObTableSchema &ta
is_full_direct_load(direct_load_type_) ? SCN::invalid_scn() : table_key_.get_end_scn()))) {
LOG_WARN("fail to init data block desc", K(ret));
} else {
sqc_build_ctx_.data_block_desc_.get_static_desc().schema_version_ = sqc_build_ctx_.build_param_.runtime_only_param_.schema_version_;
sqc_build_ctx_.data_block_desc_.get_desc().sstable_index_builder_ = sqc_build_ctx_.index_builder_; // for build the tail index block in macro block
if (GCTX.is_shared_storage_mode() && !is_incremental_direct_load(direct_load_type_)) {
sqc_build_ctx_.data_block_desc_.get_static_desc().exec_mode_ = compaction::EXEC_MODE_OUTPUT;