[Net Standby] Modify error code when switchover failed

This commit is contained in:
taoshuning
2023-05-11 08:58:25 +00:00
committed by ob-robot
parent 95dc4939b6
commit bfb96123dc
2 changed files with 7 additions and 2 deletions

View File

@ -781,12 +781,12 @@ int ObLogRestoreHandler::check_restore_to_newest_from_service_(
} else if (OB_FAIL(proxy_util.get_tenant_info(tenant_role, tenant_status))) { } else if (OB_FAIL(proxy_util.get_tenant_info(tenant_role, tenant_status))) {
CLOG_LOG(WARN, "get tenant info failed", K(id_), K(service_attr)); CLOG_LOG(WARN, "get tenant info failed", K(id_), K(service_attr));
} else if (! tenant_role.is_standby() || share::schema::ObTenantStatus::TENANT_STATUS_NORMAL != tenant_status) { } else if (! tenant_role.is_standby() || share::schema::ObTenantStatus::TENANT_STATUS_NORMAL != tenant_status) {
ret = OB_EAGAIN; // TODO 错误码 ret = OB_SOURCE_TENANT_STATE_NOT_MATCH;
CLOG_LOG(WARN, "tenant role or status not match", K(id_), K(tenant_role), K(tenant_status), K(service_attr)); CLOG_LOG(WARN, "tenant role or status not match", K(id_), K(tenant_role), K(tenant_status), K(service_attr));
} else if (OB_FAIL(proxy_util.get_max_log_info(share::ObLSID(id_), access_mode, archive_scn))) { } else if (OB_FAIL(proxy_util.get_max_log_info(share::ObLSID(id_), access_mode, archive_scn))) {
CLOG_LOG(WARN, "get max_log info failed", K(id_)); CLOG_LOG(WARN, "get max_log info failed", K(id_));
} else if (!palf::is_valid_access_mode(access_mode) || palf::AccessMode::RAW_WRITE != access_mode) { } else if (!palf::is_valid_access_mode(access_mode) || palf::AccessMode::RAW_WRITE != access_mode) {
ret = OB_EAGAIN; // TODO 错误码 ret = OB_SOURCE_LS_STATE_NOT_MATCH;
CLOG_LOG(WARN, "access_mode not match", K(id_), K(access_mode)); CLOG_LOG(WARN, "access_mode not match", K(id_), K(access_mode));
} else if (end_scn < archive_scn) { } else if (end_scn < archive_scn) {
CLOG_LOG(INFO, "end_scn smaller than archive_scn", K(id_), K(archive_scn), K(end_scn)); CLOG_LOG(INFO, "end_scn smaller than archive_scn", K(id_), K(archive_scn), K(end_scn));

View File

@ -212,6 +212,11 @@ public:
// 2. for standby based on net service, check the max log in primary is restored in the standby // 2. for standby based on net service, check the max log in primary is restored in the standby
// @param[out] end_scn, the end_scn of palf // @param[out] end_scn, the end_scn of palf
// @param[out] archive_scn, the max scn in archive logs // @param[out] archive_scn, the max scn in archive logs
// @ret_code OB_NOT_MASTER the restore_handler is not master
// OB_EAGAIN the restore source not valid
// OB_SOURCE_TENANT_STATE_NOT_MATCH original tenant state not match to switchover
// OB_SOURCE_LS_STATE_NOT_MATCH original ls state not match to switchover
// other code unexpected ret_code
int check_restore_to_newest(share::SCN &end_scn, share::SCN &archive_scn); int check_restore_to_newest(share::SCN &end_scn, share::SCN &archive_scn);
// @brief Remote Fetch Log Workers fetch log from remote source in parallel, but raw write to palf in series // @brief Remote Fetch Log Workers fetch log from remote source in parallel, but raw write to palf in series
// This interface to to sort and cache logs // This interface to to sort and cache logs