[CP] Add hidden config _transfer_task_tablet_count_threshold

This commit is contained in:
ZhenNan0
2023-11-01 08:09:23 +00:00
committed by ob-robot
parent f71eee9826
commit 99db3c5d46
5 changed files with 24 additions and 6 deletions

View File

@ -585,10 +585,10 @@ int ObTenantTransferService::lock_table_and_part_(
} }
} }
// Try to limit the number of tablet_list to TABLET_COUNT_THRESHOLD_IN_A_TRANSFER. // Try to limit the number of tablet_list to _transfer_task_tablet_count_threshold.
// This is not a precise limit. In the worst case, there will be // This is not a precise limit. In the worst case, there will be
// TABLET_COUNT_THRESHOLD_IN_A_TRANSFER + 128(max index number) + 2(lob tablet number) tablets in tablet_list. // _transfer_task_tablet_count_threshold + 128(max index number) + 2(lob tablet number) tablets in tablet_list.
if (OB_SUCC(ret) && tablet_ids.count() > TABLET_COUNT_THRESHOLD_IN_A_TRANSFER) { if (OB_SUCC(ret) && tablet_ids.count() >= get_tablet_count_threshold_()) {
break; break;
} }
} // end ARRAY_FOREACH } // end ARRAY_FOREACH
@ -1092,7 +1092,7 @@ int ObTenantTransferService::generate_transfer_task(
trace_id.init(GCONF.self_addr_); trace_id.init(GCONF.self_addr_);
ObTransferStatus status(ObTransferStatus::INIT); ObTransferStatus status(ObTransferStatus::INIT);
ObTransferPartList transfer_part_list; ObTransferPartList transfer_part_list;
const int64_t part_count = min(PART_COUNT_IN_A_TRANSFER, part_list.count()); const int64_t part_count = min(get_tablet_count_threshold_(), part_list.count());
if (OB_FAIL(transfer_part_list.reserve(part_count))) { if (OB_FAIL(transfer_part_list.reserve(part_count))) {
LOG_WARN("reserve failed", KR(ret), K(part_count)); LOG_WARN("reserve failed", KR(ret), K(part_count));
} else if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id_, task_id))) { } else if (OB_FAIL(ObCommonIDUtils::gen_unique_id(tenant_id_, task_id))) {
@ -1641,6 +1641,19 @@ int ObTenantTransferService::update_comment_for_expected_errors_(
return ret; return ret;
} }
int64_t ObTenantTransferService::get_tablet_count_threshold_() const
{
const int64_t DEFAULT_TABLET_COUNT_THRESHOLD = 100;
int64_t tablet_count_threshold = DEFAULT_TABLET_COUNT_THRESHOLD;
if (is_valid_tenant_id(tenant_id_)) {
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id_));
tablet_count_threshold = tenant_config.is_valid()
? tenant_config->_transfer_task_tablet_count_threshold
: DEFAULT_TABLET_COUNT_THRESHOLD;
}
return tablet_count_threshold;
}
#undef TTS_INFO #undef TTS_INFO
} // end namespace rootserver } // end namespace rootserver
} // end namespace oceanbase } // end namespace oceanbase

View File

@ -227,11 +227,11 @@ private:
const int err, const int err,
const share::ObTransferTaskID &task_id, const share::ObTransferTaskID &task_id,
const share::ObTransferTaskComment &result_comment); const share::ObTransferTaskComment &result_comment);
int64_t get_tablet_count_threshold_() const;
private: private:
static const int64_t IDLE_TIME_US = 10 * 1000 * 1000L; // 10s static const int64_t IDLE_TIME_US = 10 * 1000 * 1000L; // 10s
static const int64_t BUSY_IDLE_TIME_US = 100 * 1000L; // 100ms static const int64_t BUSY_IDLE_TIME_US = 100 * 1000L; // 100ms
static const int64_t PART_COUNT_IN_A_TRANSFER = 100; static const int64_t PART_COUNT_IN_A_TRANSFER = 100;
static const int64_t TABLET_COUNT_THRESHOLD_IN_A_TRANSFER = 100;
bool is_inited_; bool is_inited_;
uint64_t tenant_id_; uint64_t tenant_id_;

View File

@ -1477,6 +1477,10 @@ DEF_TIME(_transfer_process_lock_tx_timeout, OB_TENANT_PARAMETER, "100s", "[30s,)
"Range: [30s, +∞)", "Range: [30s, +∞)",
ObParameterAttr(Section::ROOT_SERVICE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); ObParameterAttr(Section::ROOT_SERVICE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_INT(_transfer_task_tablet_count_threshold, OB_TENANT_PARAMETER, "100", "(0,100]",
"Threshold for the count of tablets that can be processed by a transfer task"
"Range: (0, 100]",
ObParameterAttr(Section::ROOT_SERVICE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
// end of transfer // end of transfer

View File

@ -1244,7 +1244,7 @@ int ObTransferHandler::precheck_ls_replay_scn_(const share::ObTransferTaskInfo &
ObTimeoutCtx timeout_ctx; ObTimeoutCtx timeout_ctx;
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(MTL_ID())); omt::ObTenantConfigGuard tenant_config(TENANT_CONF(MTL_ID()));
if (tenant_config.is_valid()) { if (tenant_config.is_valid()) {
const int64_t timeout = tenant_config->_transfer_start_trans_timeout * 0.8; const int64_t timeout = tenant_config->_transfer_start_trans_timeout * 0.5;
if (OB_FAIL(timeout_ctx.set_timeout(timeout))) { if (OB_FAIL(timeout_ctx.set_timeout(timeout))) {
LOG_WARN("set timeout context failed", K(ret)); LOG_WARN("set timeout context failed", K(ret));
} }

View File

@ -398,6 +398,7 @@ _transfer_service_wakeup_interval
_transfer_start_retry_count _transfer_start_retry_count
_transfer_start_rpc_timeout _transfer_start_rpc_timeout
_transfer_start_trans_timeout _transfer_start_trans_timeout
_transfer_task_tablet_count_threshold
_tx_result_retention _tx_result_retention
_upgrade_stage _upgrade_stage
_wait_interval_after_parallel_ddl _wait_interval_after_parallel_ddl