fix get root key error
This commit is contained in:
@ -496,7 +496,8 @@ int ObTabletTableUpdater::batch_process_tasks(
|
|||||||
update_tablet_checksums,
|
update_tablet_checksums,
|
||||||
update_tablet_tasks,
|
update_tablet_tasks,
|
||||||
remove_tablet_tasks))) {
|
remove_tablet_tasks))) {
|
||||||
LOG_ERROR("generate_tasks failed", KR(ret), "batch_tasks count", batch_tasks.count(),
|
//There is a situation where there are too many tablet holds and cannot be obtained
|
||||||
|
LOG_WARN("generate_tasks failed", KR(ret), "batch_tasks count", batch_tasks.count(),
|
||||||
"update_tablet_replicas", update_tablet_replicas.count(),
|
"update_tablet_replicas", update_tablet_replicas.count(),
|
||||||
"remove_tablet_replicas", remove_tablet_replicas.count(),
|
"remove_tablet_replicas", remove_tablet_replicas.count(),
|
||||||
"update_tablet_checksums", update_tablet_checksums.count(),
|
"update_tablet_checksums", update_tablet_checksums.count(),
|
||||||
|
|||||||
@ -22325,14 +22325,15 @@ int ObDDLService::standby_create_root_key(
|
|||||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(arg));
|
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(arg));
|
||||||
} else {
|
} else {
|
||||||
obrpc::RootKeyType key_type = obrpc::RootKeyType::INVALID;
|
obrpc::RootKeyType key_type = obrpc::RootKeyType::INVALID;
|
||||||
RootKeyValue root_key;
|
common::ObString root_key;
|
||||||
if (OB_FAIL(get_root_key_from_primary(arg, tenant_id, key_type, root_key))) {
|
ObArenaAllocator allocator("root_key");
|
||||||
|
|
||||||
|
if (OB_FAIL(get_root_key_from_primary(arg, tenant_id, key_type, root_key, allocator))) {
|
||||||
LOG_WARN("failed to get root key", KR(ret), K(arg), K(tenant_id));
|
LOG_WARN("failed to get root key", KR(ret), K(arg), K(tenant_id));
|
||||||
} else {
|
} else {
|
||||||
obrpc::ObRootKeyArg root_key_arg;
|
obrpc::ObRootKeyArg root_key_arg;
|
||||||
obrpc::ObRootKeyResult dummy_result;
|
obrpc::ObRootKeyResult dummy_result;
|
||||||
ObString key_value_str(root_key.ptr());
|
if (OB_FAIL(root_key_arg.init(tenant_id, key_type, root_key))) {
|
||||||
if (OB_FAIL(root_key_arg.init(tenant_id, key_type, key_value_str))) {
|
|
||||||
LOG_WARN("failed to init root key arg", KR(ret), K(tenant_id), K(key_type), K(root_key));
|
LOG_WARN("failed to init root key arg", KR(ret), K(tenant_id), K(key_type), K(root_key));
|
||||||
} else if (OB_FAIL(notify_root_key(*rpc_proxy_, root_key_arg, addrs, dummy_result))) {
|
} else if (OB_FAIL(notify_root_key(*rpc_proxy_, root_key_arg, addrs, dummy_result))) {
|
||||||
LOG_WARN("fail to notify root key", K(ret), K(root_key_arg));
|
LOG_WARN("fail to notify root key", K(ret), K(root_key_arg));
|
||||||
@ -22344,7 +22345,8 @@ int ObDDLService::standby_create_root_key(
|
|||||||
|
|
||||||
int ObDDLService::get_root_key_from_primary(const obrpc::ObCreateTenantArg &arg,
|
int ObDDLService::get_root_key_from_primary(const obrpc::ObCreateTenantArg &arg,
|
||||||
const uint64_t tenant_id, obrpc::RootKeyType &key_type,
|
const uint64_t tenant_id, obrpc::RootKeyType &key_type,
|
||||||
RootKeyValue &key_value)
|
common::ObString &key_value,
|
||||||
|
common::ObIAllocator &allocator)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_FAIL(check_inner_stat())) {
|
if (OB_FAIL(check_inner_stat())) {
|
||||||
@ -22368,7 +22370,7 @@ int ObDDLService::get_root_key_from_primary(const obrpc::ObCreateTenantArg &arg,
|
|||||||
LOG_WARN("failed to init for get", KR(ret), K(primary_tenant_id));
|
LOG_WARN("failed to init for get", KR(ret), K(primary_tenant_id));
|
||||||
}
|
}
|
||||||
if (FAILEDx(get_root_key_from_obs(cluster_id, *rpc_proxy_, root_key_arg,
|
if (FAILEDx(get_root_key_from_obs(cluster_id, *rpc_proxy_, root_key_arg,
|
||||||
addr_list, key_type, key_value))) {
|
addr_list, key_type, key_value, allocator))) {
|
||||||
LOG_WARN("failed to get root key from obs", KR(ret), K(cluster_id),
|
LOG_WARN("failed to get root key from obs", KR(ret), K(cluster_id),
|
||||||
K(root_key_arg), K(addr_list));
|
K(root_key_arg), K(addr_list));
|
||||||
}
|
}
|
||||||
@ -22413,7 +22415,8 @@ int ObDDLService::get_root_key_from_obs(
|
|||||||
const obrpc::ObRootKeyArg &arg,
|
const obrpc::ObRootKeyArg &arg,
|
||||||
const common::ObIArray<common::ObAddr> &addrs,
|
const common::ObIArray<common::ObAddr> &addrs,
|
||||||
obrpc::RootKeyType &key_type,
|
obrpc::RootKeyType &key_type,
|
||||||
RootKeyValue &key_value)
|
common::ObString &key_value,
|
||||||
|
common::ObIAllocator &allocator)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
key_type = obrpc::RootKeyType::INVALID;
|
key_type = obrpc::RootKeyType::INVALID;
|
||||||
@ -22465,12 +22468,13 @@ int ObDDLService::get_root_key_from_obs(
|
|||||||
if (OB_UNLIKELY(obrpc::RootKeyType::INVALID != key_type)) {
|
if (OB_UNLIKELY(obrpc::RootKeyType::INVALID != key_type)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("root key type is conflict", KR(ret), K(key_type), KPC(rpc_result));
|
LOG_WARN("root key type is conflict", KR(ret), K(key_type), KPC(rpc_result));
|
||||||
} else if (OB_FAIL(key_value.assign(rpc_result->root_key_))) {
|
} else if (OB_FAIL(deep_copy_ob_string(allocator, rpc_result->root_key_, key_value))) {
|
||||||
LOG_WARN("failed to assign result", KR(ret), KPC(rpc_result));
|
LOG_WARN("failed to assign result", KR(ret), KPC(rpc_result));
|
||||||
} else {
|
}
|
||||||
|
if (OB_SUCC(ret)) {
|
||||||
key_type = rpc_result->key_type_;
|
key_type = rpc_result->key_type_;
|
||||||
}
|
}
|
||||||
} else if (OB_UNLIKELY(0 != key_value.str().compare(rpc_result->root_key_))) {
|
} else if (OB_UNLIKELY(0 != key_value.compare(rpc_result->root_key_))) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("root key is conflict", KR(ret), K(key_value), KPC(rpc_result));
|
LOG_WARN("root key is conflict", KR(ret), K(key_value), KPC(rpc_result));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,6 @@ class ObDDLService
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::pair<share::ObLSID, common::ObTabletID> LSTabletID;
|
typedef std::pair<share::ObLSID, common::ObTabletID> LSTabletID;
|
||||||
typedef ObFixedLengthString<OB_ROOT_KEY_LEN + 1> RootKeyValue;
|
|
||||||
public:
|
public:
|
||||||
friend class ObTableGroupHelp;
|
friend class ObTableGroupHelp;
|
||||||
friend class ObStandbyClusterSchemaProcessor;
|
friend class ObStandbyClusterSchemaProcessor;
|
||||||
@ -1924,14 +1923,16 @@ public:
|
|||||||
int check_need_create_root_key(const obrpc::ObCreateTenantArg &arg, bool &need_create);
|
int check_need_create_root_key(const obrpc::ObCreateTenantArg &arg, bool &need_create);
|
||||||
int get_root_key_from_primary(const obrpc::ObCreateTenantArg &arg,
|
int get_root_key_from_primary(const obrpc::ObCreateTenantArg &arg,
|
||||||
const uint64_t tenant_id, obrpc::RootKeyType &key_type,
|
const uint64_t tenant_id, obrpc::RootKeyType &key_type,
|
||||||
RootKeyValue &key_value);
|
common::ObString &key_value,
|
||||||
|
common::ObIAllocator &allocator);
|
||||||
static int get_root_key_from_obs(
|
static int get_root_key_from_obs(
|
||||||
const uint64_t &cluster_id,
|
const uint64_t &cluster_id,
|
||||||
obrpc::ObSrvRpcProxy &rpc_proxy,
|
obrpc::ObSrvRpcProxy &rpc_proxy,
|
||||||
const obrpc::ObRootKeyArg &arg,
|
const obrpc::ObRootKeyArg &arg,
|
||||||
const common::ObIArray<common::ObAddr> &addrs,
|
const common::ObIArray<common::ObAddr> &addrs,
|
||||||
obrpc::RootKeyType &key_type,
|
obrpc::RootKeyType &key_type,
|
||||||
RootKeyValue &key_value);
|
common::ObString &key_value,
|
||||||
|
common::ObIAllocator &allocator);
|
||||||
int standby_create_root_key(
|
int standby_create_root_key(
|
||||||
const uint64_t tenant_id,
|
const uint64_t tenant_id,
|
||||||
const obrpc::ObCreateTenantArg &arg,
|
const obrpc::ObCreateTenantArg &arg,
|
||||||
|
|||||||
Reference in New Issue
Block a user