Compatibility support for standby tenant
This commit is contained in:
@ -239,6 +239,8 @@ int ObTenantRoleTransitionService::do_prepare_flashback_for_switch_to_primary_(
|
||||
|
||||
DEBUG_SYNC(PREPARE_FLASHBACK_FOR_SWITCH_TO_PRIMARY);
|
||||
|
||||
LOG_INFO("start to do_prepare_flashback_for_switch_to_primary_", KR(ret), K_(tenant_id));
|
||||
|
||||
if (OB_FAIL(check_inner_stat())) {
|
||||
LOG_WARN("error unexpected", KR(ret), K(tenant_id_), KP(sql_proxy_), KP(rpc_proxy_));
|
||||
} else if (OB_UNLIKELY(!tenant_info.is_prepare_flashback_for_switch_to_primary_status())) {
|
||||
@ -947,6 +949,8 @@ int ObTenantRoleTransitionService::check_sync_to_latest_(const uint64_t tenant_i
|
||||
bool sys_ls_sync_to_latest = false;
|
||||
share::ObLSStatusInfo ls_status;
|
||||
|
||||
LOG_INFO("start to check_sync_to_latest", KR(ret), K(tenant_id), K(tenant_info));
|
||||
|
||||
if (!is_user_tenant(tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id));
|
||||
@ -1017,6 +1021,8 @@ int ObTenantRoleTransitionService::get_checkpoints_by_rpc_(const uint64_t tenant
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
checkpoints.reset();
|
||||
|
||||
LOG_INFO("start to get_checkpoints_by_rpc_", KR(ret), K(tenant_id), K(check_sync_to_latest), K(status_info_array));
|
||||
if (OB_FAIL(check_inner_stat())) {
|
||||
LOG_WARN("error unexpected", KR(ret), KP(sql_proxy_));
|
||||
} else if (!is_user_tenant(tenant_id) || 0 >= status_info_array.count()) {
|
||||
|
||||
@ -89,6 +89,7 @@ int ObPrimaryStandbyService::switch_tenant(const obrpc::ObSwitchTenantArg &arg)
|
||||
ObSchemaGetterGuard schema_guard;
|
||||
const char *alter_cluster_event = arg.get_alter_type_str();
|
||||
const ObSimpleTenantSchema *tenant_schema = nullptr;
|
||||
uint64_t compat_version = 0;
|
||||
CLUSTER_EVENT_ADD_CONTROL_START(ret, alter_cluster_event, "stmt_str", arg.get_stmt_str());
|
||||
if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("inner stat error", KR(ret), K_(inited));
|
||||
@ -97,6 +98,12 @@ int ObPrimaryStandbyService::switch_tenant(const obrpc::ObSwitchTenantArg &arg)
|
||||
LOG_WARN("invalid arg", K(arg), KR(ret));
|
||||
} else if (OB_FAIL(get_target_tenant_id(arg.get_tenant_name(), arg.get_exec_tenant_id(), switch_tenant_id))) {
|
||||
LOG_WARN("failed to get_target_tenant_id", KR(ret), K(switch_tenant_id), K(arg));
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(switch_tenant_id, compat_version))) {
|
||||
LOG_WARN("fail to get data version", KR(ret), K(switch_tenant_id));
|
||||
} else if (compat_version < DATA_VERSION_4_1_0_0) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("Tenant COMPATIBLE is below 4.1.0.0, switch tenant is not supported", KR(ret));
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Tenant COMPATIBLE is below 4.1.0.0, switch tenant is");
|
||||
} else if (OB_FAIL(schema_service_->get_tenant_schema_guard(OB_SYS_TENANT_ID, schema_guard))) {
|
||||
LOG_WARN("failed to get schema guard", KR(ret));
|
||||
} else if (OB_FAIL(schema_guard.get_tenant_info(switch_tenant_id, tenant_schema))) {
|
||||
@ -234,6 +241,7 @@ int ObPrimaryStandbyService::recover_tenant(const obrpc::ObRecoverTenantArg &arg
|
||||
int64_t begin_time = ObTimeUtility::current_time();
|
||||
uint64_t tenant_id = OB_INVALID_ID;
|
||||
const char *alter_cluster_event = "recover_tenant";
|
||||
uint64_t compat_version = 0;
|
||||
CLUSTER_EVENT_ADD_CONTROL_START(ret, alter_cluster_event, "stmt_str", arg.get_stmt_str());
|
||||
if (OB_FAIL(check_inner_stat_())) {
|
||||
LOG_WARN("inner stat error", KR(ret), K_(inited));
|
||||
@ -242,6 +250,12 @@ int ObPrimaryStandbyService::recover_tenant(const obrpc::ObRecoverTenantArg &arg
|
||||
LOG_WARN("invalid arg", K(arg), KR(ret));
|
||||
} else if (OB_FAIL(get_target_tenant_id(arg.get_tenant_name(), arg.get_exec_tenant_id(), tenant_id))) {
|
||||
LOG_WARN("failed to get_target_tenant_id", KR(ret), K(tenant_id), K(arg));
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
||||
LOG_WARN("fail to get data version", KR(ret), K(tenant_id));
|
||||
} else if (compat_version < DATA_VERSION_4_1_0_0) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("Tenant COMPATIBLE is below 4.1.0.0, recover tenant is not supported", KR(ret));
|
||||
LOG_USER_ERROR(OB_NOT_SUPPORTED, "Tenant COMPATIBLE is below 4.1.0.0, recover tenant is");
|
||||
} else if (OB_FAIL(do_recover_tenant(tenant_id, share::NORMAL_SWITCHOVER_STATUS, arg.get_type(),
|
||||
arg.get_recovery_until_scn()))) {
|
||||
LOG_WARN("failed to do_recover_tenant", KR(ret), K(tenant_id), K(arg));
|
||||
|
||||
@ -554,10 +554,17 @@ int ObAllTenantInfoProxy::update_tenant_recovery_until_scn(
|
||||
ObLSRecoveryStatOperator ls_recovery_operator;
|
||||
ObLSRecoveryStat sys_ls_recovery;
|
||||
ObLogRestoreSourceMgr restore_source_mgr;
|
||||
uint64_t compat_version = 0;
|
||||
|
||||
if (!is_user_tenant(tenant_id) || OB_INVALID_VERSION == switchover_epoch) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(tenant_id), K(switchover_epoch));
|
||||
} else if (OB_FAIL(GET_MIN_DATA_VERSION(tenant_id, compat_version))) {
|
||||
LOG_WARN("fail to get data version", KR(ret), K(tenant_id));
|
||||
} else if (compat_version < DATA_VERSION_4_1_0_0) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("Tenant COMPATIBLE is below 4.1.0.0, update tenant recovery_until_scn is not suppported",
|
||||
KR(ret), K(compat_version));
|
||||
} else if (OB_UNLIKELY(!recovery_until_scn.is_valid_and_not_min())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("recovery_until_scn invalid", KR(ret), K(recovery_until_scn));
|
||||
|
||||
Reference in New Issue
Block a user