[FEAT MERGE]快速恢复优化表级恢复性能

This commit is contained in:
SidewinderAK47
2025-02-06 07:15:17 +00:00
committed by ob-robot
parent aab63693cf
commit 525c146453
5 changed files with 35 additions and 3 deletions

View File

@ -17,6 +17,7 @@
#include "ob_restore_util.h"
#include "share/restore/ob_recover_table_persist_helper.h"
#include "share/restore/ob_import_table_persist_helper.h"
#include "storage/high_availability/ob_storage_ha_utils.h"
using namespace oceanbase;
using namespace share::schema;
@ -170,6 +171,7 @@ int ObRecoverTableInitiator::insert_sys_job_(
} else if (OB_FALSE_IT(physical_restore_job.set_initiator_job_id(job.get_job_id()))) {
} else if (OB_FALSE_IT(physical_restore_job.set_initiator_tenant_id(OB_SYS_TENANT_ID))) {
} else if (OB_FALSE_IT(physical_restore_job.set_recover_table(true))) {
} else if (OB_FAIL(fill_recover_table_restore_type_(physical_restore_job))) {
} else if (OB_FAIL(ObRestoreUtil::record_physical_restore_job(trans, physical_restore_job))) {
LOG_WARN("failed to record physical restore job", K(ret));
}
@ -513,4 +515,27 @@ int ObRecoverTableInitiator::fill_recover_table_arg_(
LOG_WARN("failed to remap tablegroup", K(ret), K(arg.import_arg_));
}
return ret;
}
int ObRecoverTableInitiator::fill_recover_table_restore_type_(share::ObPhysicalRestoreJob &job)
{
int ret = OB_SUCCESS;
/* 4.3.3 share noting mode support quick restore; 4.3.5 support mds table standby tenant read.
* In share noting mode, backup set data_version >= 4.3.5, recover table use quick physical restore.
* In other condition, recover table use full physical restore. */
/* tenant_compatible_ & backup_compatible has been check in fill physical restore job */
const uint64_t source_data_version = job.get_source_data_version();
const ObBackupSetFileDesc::Compatible backup_compatible =
static_cast<ObBackupSetFileDesc::Compatible>(job.get_backup_compatible());
const bool is_allow_quick_restore = ObBackupSetFileDesc::is_allow_quick_restore(backup_compatible);
const bool is_allow_mds_standby_read = ObTransferUtils::enable_transfer_dml_ctrl(source_data_version);
// use quick restore should set table cnt display mode.
if (is_allow_quick_restore && is_allow_mds_standby_read) {
job.set_restore_type(QUICK_RESTORE_TYPE);
job.set_progress_display_mode(TABLET_CNT_DISPLAY_MODE);
}
LOG_INFO("[RECOVER_TABLE] set recover table restore type", "restore_type", QUICK_RESTORE_TYPE,
"progress_display_mode", TABLET_CNT_DISPLAY_MODE);
return ret;
}

View File

@ -83,6 +83,7 @@ private:
share::ObImportRemapArg &import_remap_arg);
int fill_remap_tablegroup(const share::ObImportArg &import_arg,
share::ObImportRemapArg &import_remap_arg);
int fill_recover_table_restore_type_(share::ObPhysicalRestoreJob &job);
private:
bool is_inited_;

View File

@ -626,7 +626,8 @@ int ObRecoverTableJobScheduler::active_aux_tenant_(share::ObRecoverTableJob &job
"initiator_job_id", job.get_job_id(), "initiator_tenant_id", job.get_tenant_id());
} else if (OB_FAIL(ban_multi_version_recycling_(job, restore_history_info.restore_tenant_id_))) {
LOG_WARN("failed to ban multi version cecycling", K(ret));
} else if (OB_FAIL(failover_to_primary_(job, restore_history_info.restore_tenant_id_))) {
} else if (restore_history_info.get_restore_type().is_full_restore()
&& OB_FAIL(failover_to_primary_(job, restore_history_info.restore_tenant_id_))) {
LOG_WARN("failed to failover to primary", K(ret), K(restore_history_info));
}
if (OB_FAIL(ret)) {

View File

@ -362,6 +362,9 @@ struct ObHisRestoreJobPersistInfo final : public ObIInnerTableRow
{
return status_ == SUCCESS;
}
const ObRestoreType &get_restore_type() const {
return restore_type_;
}
const char *get_status_str() const;
int get_status(const ObString &str_str) const;

View File

@ -1149,9 +1149,11 @@ int ObSSTableCopyFinishTask::get_space_optimization_mode_(
LOG_WARN("sstable_param is null", K(ret));
} else if (sstable_param->table_key_.is_ddl_sstable()) {
mode = ObSSTableIndexBuilder::DISABLE;
} else if (sstable_param->is_small_sstable_) {
} else if (ObTabletRestoreAction::is_restore_remote_sstable(copy_ctx_.restore_action_)) {
mode = ObSSTableIndexBuilder::DISABLE;
} else if (ObTabletRestoreAction::is_restore_replace_remote_sstable(copy_ctx_.restore_action_)) {
mode = ObSSTableIndexBuilder::ENABLE;
} else if (sstable_param->basic_meta_.table_backup_flag_.has_backup()) {
} else if (sstable_param->is_small_sstable_) {
mode = ObSSTableIndexBuilder::ENABLE;
} else {
mode = ObSSTableIndexBuilder::DISABLE;