add dba_command group

This commit is contained in:
maosy
2023-09-09 13:23:54 +00:00
committed by ob-robot
parent 4a94dfea00
commit ac2b9a8aae
4 changed files with 21 additions and 7 deletions

View File

@ -609,6 +609,8 @@ OB_INLINE int64_t ObResourceGroup::min_worker_cnt() const
cnt = std::max(cnt, 8L); cnt = std::max(cnt, 8L);
} else if (share::OBCG_WR == group_id_) { } else if (share::OBCG_WR == group_id_) {
cnt = 2; // one for take snapshot, one for purge cnt = 2; // one for take snapshot, one for purge
} else if (share::OBCG_DBA_COMMAND == group_id_) {
cnt = 1;
} }
return cnt; return cnt;
} }
@ -623,6 +625,8 @@ OB_INLINE int64_t ObResourceGroup::max_worker_cnt() const
cnt = std::max(cnt, tenant_->max_worker_cnt()); cnt = std::max(cnt, tenant_->max_worker_cnt());
} else if (share::OBCG_WR == group_id_) { } else if (share::OBCG_WR == group_id_) {
cnt = 2; // one for take snapshot, one for purge cnt = 2; // one for take snapshot, one for purge
} else if (share::OBCG_DBA_COMMAND == group_id_) {
cnt = 1;
} }
return cnt; return cnt;
} }

View File

@ -422,11 +422,13 @@ int ObPrimaryLSService::check_ls_can_offline_by_rpc_(const share::ObLSStatusInfo
const int64_t timeout = GCONF.rpc_timeout; const int64_t timeout = GCONF.rpc_timeout;
obrpc::ObCheckLSCanOfflineArg arg; obrpc::ObCheckLSCanOfflineArg arg;
can_offline = false; can_offline = false;
const uint64_t group_id = info.ls_is_tenant_dropping() ? OBCG_DBA_COMMAND : OBCG_DEFAULT;
if (OB_FAIL(arg.init(info.tenant_id_, info.ls_id_, info.status_))) { if (OB_FAIL(arg.init(info.tenant_id_, info.ls_id_, info.status_))) {
LOG_WARN("failed to init arg", KR(ret), K(arg)); LOG_WARN("failed to init arg", KR(ret), K(arg));
} else if (OB_FAIL(GCTX.srv_rpc_proxy_->to(leader) } else if (OB_FAIL(GCTX.srv_rpc_proxy_->to(leader)
.by(info.tenant_id_) .by(info.tenant_id_)
.timeout(timeout) .timeout(timeout)
.group_id(group_id)
.check_ls_can_offline(arg))) { .check_ls_can_offline(arg))) {
can_offline = false; can_offline = false;
LOG_WARN("failed to check ls can offline", KR(ret), K(arg), K(info), LOG_WARN("failed to check ls can offline", KR(ret), K(arg), K(info),

View File

@ -745,6 +745,7 @@ int ObTenantRoleTransitionService::get_ls_access_mode_(
int64_t rpc_count = 0; int64_t rpc_count = 0;
ObArray<int> return_code_array; ObArray<int> return_code_array;
int tmp_ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS;
const uint64_t group_id = share::OBCG_DBA_COMMAND;
for (int64_t i = 0; OB_SUCC(ret) && i < status_info_array.count(); ++i) { for (int64_t i = 0; OB_SUCC(ret) && i < status_info_array.count(); ++i) {
return_code_array.reset(); return_code_array.reset();
const ObLSStatusInfo &info = status_info_array.at(i); const ObLSStatusInfo &info = status_info_array.at(i);
@ -755,9 +756,10 @@ int ObTenantRoleTransitionService::get_ls_access_mode_(
} else if (OB_FAIL(arg.init(tenant_id_, info.ls_id_))) { } else if (OB_FAIL(arg.init(tenant_id_, info.ls_id_))) {
LOG_WARN("failed to init arg", KR(ret), K(tenant_id_), K(info)); LOG_WARN("failed to init arg", KR(ret), K(tenant_id_), K(info));
// use meta rpc process thread // use meta rpc process thread
} else if (OB_FAIL(proxy.call(leader, timeout, GCONF.cluster_id, gen_meta_tenant_id(tenant_id_), arg))) { } else if (OB_FAIL(proxy.call(leader, timeout, GCONF.cluster_id, tenant_id_, group_id, arg))) {
//can not ignore error of each ls //can not ignore error of each ls
LOG_WARN("failed to send rpc", KR(ret), K(leader), K(timeout), K(tenant_id_), K(arg)); LOG_WARN("failed to send rpc", KR(ret), K(leader), K(timeout),
K(tenant_id_), K(arg), K(group_id));
} else { } else {
rpc_count++; rpc_count++;
} }
@ -841,6 +843,7 @@ int ObTenantRoleTransitionService::do_change_ls_access_mode_(
ObChangeLSAccessModeProxy proxy(*rpc_proxy_, &obrpc::ObSrvRpcProxy::change_ls_access_mode); ObChangeLSAccessModeProxy proxy(*rpc_proxy_, &obrpc::ObSrvRpcProxy::change_ls_access_mode);
ObAddr leader; ObAddr leader;
obrpc::ObLSAccessModeInfo arg; obrpc::ObLSAccessModeInfo arg;
const uint64_t group_id = share::OBCG_DBA_COMMAND;
for (int64_t i = 0; OB_SUCC(ret) && i < ls_access_info.count(); ++i) { for (int64_t i = 0; OB_SUCC(ret) && i < ls_access_info.count(); ++i) {
const obrpc::ObLSAccessModeInfo &info = ls_access_info.at(i); const obrpc::ObLSAccessModeInfo &info = ls_access_info.at(i);
const int64_t timeout = ctx.get_timeout(); const int64_t timeout = ctx.get_timeout();
@ -851,9 +854,10 @@ int ObTenantRoleTransitionService::do_change_ls_access_mode_(
} else if (OB_FAIL(arg.init(tenant_id_, info.get_ls_id(), info.get_mode_version(), } else if (OB_FAIL(arg.init(tenant_id_, info.get_ls_id(), info.get_mode_version(),
target_access_mode, ref_scn, sys_ls_sync_scn))) { target_access_mode, ref_scn, sys_ls_sync_scn))) {
LOG_WARN("failed to init arg", KR(ret), K(info), K(target_access_mode), K(ref_scn), K(sys_ls_sync_scn)); LOG_WARN("failed to init arg", KR(ret), K(info), K(target_access_mode), K(ref_scn), K(sys_ls_sync_scn));
} else if (OB_FAIL(proxy.call(leader, timeout, GCONF.cluster_id, gen_meta_tenant_id(tenant_id_), arg))) { } else if (OB_FAIL(proxy.call(leader, timeout, GCONF.cluster_id, tenant_id_, group_id, arg))) {
//can not ignore of each ls //can not ignore of each ls
LOG_WARN("failed to send rpc", KR(ret), K(arg), K(timeout), K(tenant_id_), K(info)); LOG_WARN("failed to send rpc", KR(ret), K(arg), K(timeout),
K(tenant_id_), K(info), K(group_id));
} }
}//end for }//end for
//result //result
@ -1244,6 +1248,7 @@ int ObTenantRoleTransitionService::get_checkpoints_by_rpc(const uint64_t tenant_
*GCTX.srv_rpc_proxy_, &obrpc::ObSrvRpcProxy::get_ls_sync_scn); *GCTX.srv_rpc_proxy_, &obrpc::ObSrvRpcProxy::get_ls_sync_scn);
obrpc::ObGetLSSyncScnArg arg; obrpc::ObGetLSSyncScnArg arg;
int64_t rpc_count = 0; int64_t rpc_count = 0;
const uint64_t group_id = share::OBCG_DBA_COMMAND;
for (int64_t i = 0; OB_SUCC(ret) && i < status_info_array.count(); ++i) { for (int64_t i = 0; OB_SUCC(ret) && i < status_info_array.count(); ++i) {
const ObLSStatusInfo &info = status_info_array.at(i); const ObLSStatusInfo &info = status_info_array.at(i);
const int64_t timeout_us = !THIS_WORKER.is_timeout_ts_valid() ? const int64_t timeout_us = !THIS_WORKER.is_timeout_ts_valid() ?
@ -1254,8 +1259,9 @@ int ObTenantRoleTransitionService::get_checkpoints_by_rpc(const uint64_t tenant_
} else if (OB_FAIL(arg.init(tenant_id, info.ls_id_, check_sync_to_latest))) { } else if (OB_FAIL(arg.init(tenant_id, info.ls_id_, check_sync_to_latest))) {
LOG_WARN("failed to init arg", KR(ret), K(tenant_id), K(info)); LOG_WARN("failed to init arg", KR(ret), K(tenant_id), K(info));
// use meta rpc process thread // use meta rpc process thread
} else if (OB_FAIL(proxy.call(leader, timeout_us, gen_meta_tenant_id(tenant_id), arg))) { } else if (OB_FAIL(proxy.call(leader, timeout_us, GCONF.cluster_id, tenant_id, group_id, arg))) {
LOG_WARN("failed to send rpc", KR(ret), K(leader), K(timeout_us), K(tenant_id), K(arg)); LOG_WARN("failed to send rpc", KR(ret), K(leader), K(timeout_us),
K(tenant_id), K(arg), K(group_id));
} else { } else {
rpc_count++; rpc_count++;
} }
@ -1418,6 +1424,7 @@ void ObTenantRoleTransitionService::broadcast_tenant_info(const char* const log_
} else if (OB_FAIL(unit_operator.get_units_by_tenant(tenant_id_, units))) { } else if (OB_FAIL(unit_operator.get_units_by_tenant(tenant_id_, units))) {
LOG_WARN("failed to get tenant unit", KR(ret), K_(tenant_id)); LOG_WARN("failed to get tenant unit", KR(ret), K_(tenant_id));
} else { } else {
//no need user special group OBCG_DBA_COMMAND
ObRefreshTenantInfoProxy proxy( ObRefreshTenantInfoProxy proxy(
*GCTX.srv_rpc_proxy_, &obrpc::ObSrvRpcProxy::refresh_tenant_info); *GCTX.srv_rpc_proxy_, &obrpc::ObSrvRpcProxy::refresh_tenant_info);
int64_t rpc_count = 0; int64_t rpc_count = 0;
@ -1433,7 +1440,7 @@ void ObTenantRoleTransitionService::broadcast_tenant_info(const char* const log_
} else if (OB_FAIL(arg.init(tenant_id_))) { } else if (OB_FAIL(arg.init(tenant_id_))) {
LOG_WARN("failed to init arg", KR(ret), K_(tenant_id)); LOG_WARN("failed to init arg", KR(ret), K_(tenant_id));
// use meta rpc process thread // use meta rpc process thread
} else if (OB_FAIL(proxy.call(unit.server_, timeout_us, gen_meta_tenant_id(tenant_id_), arg))) { } else if (OB_FAIL(proxy.call(unit.server_, timeout_us, GCONF.cluster_id, gen_meta_tenant_id(tenant_id_), arg))) {
LOG_WARN("failed to send rpc", KR(ret), K(unit), K(timeout_us), K_(tenant_id), K(arg)); LOG_WARN("failed to send rpc", KR(ret), K(unit), K(timeout_us), K_(tenant_id), K(arg));
} else { } else {
rpc_count++; rpc_count++;

View File

@ -18,4 +18,5 @@ CGID_DEF(OBCG_DIAG_TENANT, 14)
CGID_DEF(OBCG_WR, 15) CGID_DEF(OBCG_WR, 15)
CGID_DEF(OBCG_STORAGE_HA_LEVEL1, 16) CGID_DEF(OBCG_STORAGE_HA_LEVEL1, 16)
CGID_DEF(OBCG_STORAGE_HA_LEVEL2, 17) CGID_DEF(OBCG_STORAGE_HA_LEVEL2, 17)
CGID_DEF(OBCG_DBA_COMMAND, 18, 1)
CGID_DEF(OBCG_LQ, 100) CGID_DEF(OBCG_LQ, 100)