[OBCDC] Fix the exception when adding restore tenant
This commit is contained in:
parent
830b1e3d76
commit
21746f8b25
@ -1449,9 +1449,10 @@ int ObLogDDLProcessor::handle_ddl_stmt_add_tenant_(
|
||||
ObLogSchemaGuard schema_guard;
|
||||
const char *tenant_name = NULL;
|
||||
int64_t valid_schema_version = new_schema_version;
|
||||
|
||||
if (OB_ISNULL(tenant_mgr)) {
|
||||
LOG_ERROR("invalid tenant mgr", K(tenant_mgr));
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("invalid tenant mgr", KR(ret), K(tenant_mgr));
|
||||
} else if (OB_FAIL(parse_tenant_ddl_stmt_for_restore_(ddl_stmt, valid_schema_version, start_serve_tstamp, is_new_tenant_by_restore))) {
|
||||
LOG_ERROR("parse_tenant_ddl_stmt_for_restore_ failed", KR(ret), K(ddl_stmt), K(valid_schema_version), K(start_serve_tstamp), K(is_new_tenant_by_restore));
|
||||
} else {
|
||||
@ -1466,8 +1467,8 @@ int ObLogDDLProcessor::handle_ddl_stmt_add_tenant_(
|
||||
DATA_OP_TIMEOUT,
|
||||
tenant_is_chosen);
|
||||
|
||||
// If the schema error is encountered, it means that the tenant may be deleted in the future, so the schema of table,
|
||||
// database, tenant or table group cannot be obtained, in this case, the DDL will be ignored.
|
||||
// If the schema error is encountered, it means that the tenant may be deleted in the future, so the schema of table,
|
||||
// database, tenant or table group cannot be obtained, in this case, the DDL will be ignored.
|
||||
IGNORE_SCHEMA_ERROR(ret, K(valid_schema_version), K(start_serve_tstamp),
|
||||
K(target_tenant_id), K(ddl_stmt));
|
||||
|
||||
@ -1735,12 +1736,13 @@ int ObLogDDLProcessor::parse_tenant_ddl_stmt_for_restore_(
|
||||
} else {
|
||||
is_create_tenant_by_restore_ddl = true;
|
||||
schema_version = tenant_schema_version_from_ddl > schema_version ? tenant_schema_version_from_ddl : schema_version;
|
||||
tenant_gts_value = tenant_gts_from_ddl;
|
||||
tenant_gts_value = std::max(tenant_gts_from_ddl, tenant_gts_value);
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
mark_stmt_binlog_record_invalid_(ddl_stmt);
|
||||
LOG_INFO("mark create_tenant_end_ddl invalid for restore tenant", KR(ret), K(is_create_tenant_by_restore_ddl),
|
||||
K(schema_version), K(tenant_gts_value), K(ddl_stmt));
|
||||
LOG_INFO("mark create_tenant_end_ddl invalid for restore tenant", K(is_create_tenant_by_restore_ddl),
|
||||
K(schema_version), K(tenant_gts_value), K(tenant_gts_from_ddl), K(ddl_stmt));
|
||||
} else if (skip_dirty_data) {
|
||||
LOG_WARN("parse_tenant_ddl_stmt_for_restore_ fail!", KR(ret), K(is_create_tenant_by_restore_ddl), K(schema_version), K(tenant_gts_value),
|
||||
K(value_gts), K(value_version), K(ddl_stmt), K(kv_c));
|
||||
|
@ -909,7 +909,7 @@ int ObLogFetcher::next_heartbeat_timestamp_(int64_t &heartbeat_tstamp, const int
|
||||
min_progress_tls_id = TenantLSID(ddl_min_progress_tenant_id, share::SYS_LS);
|
||||
}
|
||||
|
||||
_LOG_INFO("[STAT] [FETCHER] [HEARTBEAT] DELAY=[%.3lf, %.3lf](sec) PART_COUNT=%ld "
|
||||
_LOG_INFO("[STAT] [FETCHER] [HEARTBEAT] DELAY=[%.3lf, %.3lf](sec) LS_COUNT=%ld "
|
||||
"MIN_DELAY=%s(%ld) MAX_DELAY=%s(%ld) DATA_PROGRESS=%s(%ld) "
|
||||
"DDL_PROGRESS=%s(%ld) DDL_TENANT=%lu DDL_LOG_LSN=%s",
|
||||
get_delay_sec(max_progress),
|
||||
|
@ -47,27 +47,8 @@ int ObLogLsGetter::init(const common::ObIArray<uint64_t> &tenant_ids)
|
||||
if (OB_SYS_TENANT_ID == tenant_id
|
||||
|| is_meta_tenant(tenant_id)) {
|
||||
// do nothing
|
||||
} else {
|
||||
ObLogSysTableHelper::TenantLSIDs tenant_ls_ids;
|
||||
LSIDArray ls_ids;
|
||||
|
||||
if (OB_FAIL(query_tenant_ls_info_(tenant_id, tenant_ls_ids))) {
|
||||
LOG_ERROR("query_tenant_ls_info_ failed", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
ARRAY_FOREACH_N(tenant_ls_ids, ls_ids_idx, ls_ids_count) {
|
||||
if (OB_FAIL(ls_ids.push_back(tenant_ls_ids.at(ls_ids_idx)))) {
|
||||
LOG_ERROR("ls_ids push_back failed", KR(ret), K(ls_ids), K(tenant_ls_ids));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(tenant_ls_ids_cache_.insert(tenant_id, ls_ids))) {
|
||||
LOG_ERROR("tenant_ls_ids_cache_ insert failed", KR(ret), K(tenant_id), K(ls_ids));
|
||||
} else {
|
||||
LOG_INFO("tenant_ls_ids_cache_ insert succ", K(tenant_id), K(ls_ids));
|
||||
}
|
||||
} // OB_SUCC
|
||||
}
|
||||
} else if (OB_FAIL(query_and_set_tenant_ls_info_(tenant_id))) {
|
||||
LOG_ERROR("query_and_set_tenant_ls_info_ failed", KR(ret), K(tenant_id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +79,15 @@ int ObLogLsGetter::get_ls_ids(
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_ERROR("ObLogLsGetter has not been inited", KR(ret));
|
||||
} else if (OB_FAIL(tenant_ls_ids_cache_.get(tenant_id, ls_ids))) {
|
||||
LOG_ERROR("tenant_ls_ids_cache_ get failed", KR(ret), K(tenant_id), K(ls_ids));
|
||||
if (OB_ENTRY_NOT_EXIST != ret) {
|
||||
LOG_ERROR("tenant_ls_ids_cache_ get failed", KR(ret), K(tenant_id), K(ls_ids));
|
||||
} else {
|
||||
ret = OB_SUCCESS;
|
||||
// query and set
|
||||
if (OB_FAIL(query_and_set_tenant_ls_info_(tenant_id))) {
|
||||
LOG_ERROR("query_and_set_tenant_ls_info_ failed", KR(ret), K(tenant_id));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ARRAY_FOREACH_N(ls_ids, idx, count) {
|
||||
if (OB_FAIL(ls_id_array.push_back(ls_ids.at(idx)))) {
|
||||
@ -110,6 +99,34 @@ int ObLogLsGetter::get_ls_ids(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogLsGetter::query_and_set_tenant_ls_info_(
|
||||
const uint64_t tenant_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObLogSysTableHelper::TenantLSIDs tenant_ls_ids;
|
||||
LSIDArray ls_ids;
|
||||
|
||||
if (OB_FAIL(query_tenant_ls_info_(tenant_id, tenant_ls_ids))) {
|
||||
LOG_ERROR("query_tenant_ls_info_ failed", KR(ret), K(tenant_id));
|
||||
} else {
|
||||
ARRAY_FOREACH_N(tenant_ls_ids, ls_ids_idx, ls_ids_count) {
|
||||
if (OB_FAIL(ls_ids.push_back(tenant_ls_ids.at(ls_ids_idx)))) {
|
||||
LOG_ERROR("ls_ids push_back failed", KR(ret), K(ls_ids), K(tenant_ls_ids));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(tenant_ls_ids_cache_.insert(tenant_id, ls_ids))) {
|
||||
LOG_ERROR("tenant_ls_ids_cache_ insert failed", KR(ret), K(tenant_id), K(ls_ids));
|
||||
} else {
|
||||
LOG_INFO("tenant_ls_ids_cache_ insert succ", K(tenant_id), K(ls_ids));
|
||||
}
|
||||
} // OB_SUCC
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogLsGetter::query_tenant_ls_info_(
|
||||
const uint64_t tenant_id,
|
||||
ObLogSysTableHelper::TenantLSIDs &tenant_ls_ids)
|
||||
|
@ -34,6 +34,9 @@ public:
|
||||
common::ObIArray<share::ObLSID> &ls_id_array);
|
||||
|
||||
private:
|
||||
int query_and_set_tenant_ls_info_(
|
||||
const uint64_t tenant_id);
|
||||
|
||||
int query_tenant_ls_info_(
|
||||
const uint64_t tenant_id,
|
||||
ObLogSysTableHelper::TenantLSIDs &tenant_ls_ids);
|
||||
|
Loading…
x
Reference in New Issue
Block a user