Fix bug that unitmanager hung when creating tenant.

This commit is contained in:
obdev
2024-02-07 06:08:33 +00:00
committed by ob-robot
parent 6f26466a92
commit 7784e69392
16 changed files with 501 additions and 245 deletions

View File

@ -22818,7 +22818,8 @@ int ObDDLService::get_root_key_from_primary(const obrpc::ObCreateTenantArg &arg,
LOG_WARN("failed to init for get", KR(ret), K(primary_tenant_id));
}
if (FAILEDx(notify_root_key(*rpc_proxy_, root_key_arg,
addr_list, result, true, cluster_id, &allocator))) {
addr_list, result, true/*enable_default*/, false/*need_call_rs*/,
cluster_id, &allocator))) {
LOG_WARN("failed to get root key from obs", KR(ret), K(cluster_id),
K(root_key_arg), K(addr_list));
} else {
@ -22866,6 +22867,7 @@ int ObDDLService::notify_root_key(
const common::ObIArray<common::ObAddr> &addrs,
obrpc::ObRootKeyResult &result,
const bool enable_default /*=true*/,
bool need_call_rs /*=true*/,
const uint64_t &cluster_id /*=OB_INVALID_CLUSTER_ID*/,
common::ObIAllocator *allocator /*=NULL*/)
{
@ -22873,6 +22875,8 @@ int ObDDLService::notify_root_key(
ObTimeoutCtx ctx;
bool has_failed = false;
const int64_t DEFAULT_TIMEOUT = 10 * 1000 * 1000L; // 10s
// need_to_call_rs is true only if given value is not false and not notify cross-cluster
need_call_rs = need_call_rs && (OB_INVALID_CLUSTER_ID == cluster_id);
if (OB_UNLIKELY(!arg.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", KR(ret), K(arg));
@ -22884,12 +22888,13 @@ int ObDDLService::notify_root_key(
rpc_proxy, &obrpc::ObSrvRpcProxy::set_root_key);
int tmp_ret = OB_SUCCESS;
int return_ret = OB_SUCCESS;
bool need_call_rs = OB_INVALID_CLUSTER_ID == cluster_id;
ObAddr rs_addr = GCONF.self_addr_;
int64_t timeout = ctx.get_timeout();
for (int64_t i = 0; OB_SUCC(ret) && i < addrs.count(); i++) {
const ObAddr &addr = addrs.at(i);
if (OB_TMP_FAIL(proxy.call(addr, timeout, cluster_id, OB_SYS_TENANT_ID, arg))) {
if (rs_addr == addr && !need_call_rs) {
// skip rs_addr if need_call_rs is false
} else if (OB_TMP_FAIL(proxy.call(addr, timeout, cluster_id, OB_SYS_TENANT_ID, arg))) {
has_failed = true;
return_ret= tmp_ret;
LOG_WARN("send rpc failed", KR(ret), KR(tmp_ret), K(addr), K(timeout), K(cluster_id));