Add new error code for restore tenant failed
This commit is contained in:
1
deps/oblib/src/lib/ob_errno.h
vendored
1
deps/oblib/src/lib/ob_errno.h
vendored
@ -396,6 +396,7 @@ constexpr int OB_BACKUP_DEVICE_OUT_OF_SPACE = -9082;
|
||||
constexpr int OB_BACKUP_PWRITE_OFFSET_NOT_MATCH = -9083;
|
||||
constexpr int OB_BACKUP_PWRITE_CONTENT_NOT_MATCH = -9084;
|
||||
constexpr int OB_CLOUD_OBJECT_NOT_APPENDABLE = -9098;
|
||||
constexpr int OB_RESTORE_TENANT_FAILED = -9099;
|
||||
constexpr int OB_ERR_XML_PARSE = -9549;
|
||||
constexpr int OB_ERR_XSLT_PARSE = -9574;
|
||||
constexpr int OB_MAX_RAISE_APPLICATION_ERROR = -20000;
|
||||
|
||||
@ -1016,6 +1016,37 @@ int ObRestoreUtil::check_physical_restore_finish(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObRestoreUtil::get_restore_job_comment(
|
||||
common::ObISQLClient &proxy, const int64_t job_id, char *buf, const int64_t buf_size)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
int real_length = 0;
|
||||
HEAP_VAR(ObMySQLProxy::ReadResult, res) {
|
||||
common::sqlclient::ObMySQLResult *result = nullptr;
|
||||
int64_t cnt = 0;
|
||||
if (OB_FAIL(sql.assign_fmt("select comment from %s where tenant_id=%lu and job_id=%ld",
|
||||
OB_ALL_RESTORE_JOB_HISTORY_TNAME, OB_SYS_TENANT_ID, job_id))) {
|
||||
LOG_WARN("failed to assign fmt", K(ret));
|
||||
} else if (OB_FAIL(proxy.read(res, OB_SYS_TENANT_ID, sql.ptr()))) {
|
||||
LOG_WARN("failed to exec sql", K(ret), K(sql));
|
||||
} else if (OB_ISNULL(result = res.get_result())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("result is null", K(ret));
|
||||
} else if (OB_FAIL(result->next())) {
|
||||
if (OB_ITER_END == ret) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
LOG_WARN("restore job comment not exist", K(ret));
|
||||
} else {
|
||||
LOG_WARN("failed to get next", K(ret), K(job_id));
|
||||
}
|
||||
} else {
|
||||
EXTRACT_STRBUF_FIELD_MYSQL(*result, OB_STR_COMMENT, buf, buf_size, real_length);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObRestoreUtil::get_restore_tenant_cpu_count(
|
||||
common::ObMySQLProxy &proxy, const uint64_t tenant_id, double &cpu_count)
|
||||
{
|
||||
|
||||
@ -72,6 +72,7 @@ public:
|
||||
const share::ObLSID &ls_id,
|
||||
palf::PalfBaseInfo &palf_base_info);
|
||||
static int check_physical_restore_finish(common::ObISQLClient &proxy, const int64_t job_id, bool &is_finish, bool &is_failed);
|
||||
static int get_restore_job_comment(common::ObISQLClient &proxy, const int64_t job_id, char *buf, const int64_t buf_size);
|
||||
static int get_restore_tenant_cpu_count(common::ObMySQLProxy &proxy, const uint64_t tenant_id, double &cpu_count);
|
||||
static int fill_restore_scn_(
|
||||
const share::SCN &src_scn,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -2094,6 +2094,7 @@ DEFINE_ERROR(OB_NO_TABLET_NEED_BACKUP, -9095, -1, "HY000", "No tablet need backu
|
||||
DEFINE_ERROR(OB_ERR_RESTORE_STANDBY_VERSION_LAG, -9096, -1, "HY000", "standby binary version is lower than primary data version, standby need upgrade");
|
||||
DEFINE_ERROR(OB_ERR_RESTORE_PRIMARY_TENANT_DROPPED, -9097, -1, "HY000", "primary tenant has been dropped");
|
||||
DEFINE_ERROR_DEP(OB_CLOUD_OBJECT_NOT_APPENDABLE, -9098, -1, "HY000", "normal object in object_storage(oss,cos,etc.) can't be appended content");
|
||||
DEFINE_ERROR_EXT_DEP(OB_RESTORE_TENANT_FAILED, -9099, -1, "HY000", "restore tenant failed", "%s restore failed, %s");
|
||||
// end of backup and restore error codes 9001 ~ 9099
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -3713,6 +3713,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ERR_RESTORE_STANDBY_VERSION_LAG__USER_ERROR_MSG "standby binary version is lower than primary data version, standby need upgrade"
|
||||
#define OB_ERR_RESTORE_PRIMARY_TENANT_DROPPED__USER_ERROR_MSG "primary tenant has been dropped"
|
||||
#define OB_CLOUD_OBJECT_NOT_APPENDABLE__USER_ERROR_MSG "normal object in object_storage(oss,cos,etc.) can't be appended content"
|
||||
#define OB_RESTORE_TENANT_FAILED__USER_ERROR_MSG "%s restore failed, %s"
|
||||
#define OB_NO_SUCH_FILE_OR_DIRECTORY__USER_ERROR_MSG "no such file or directory"
|
||||
#define OB_FILE_OR_DIRECTORY_EXIST__USER_ERROR_MSG "file or directory already exist"
|
||||
#define OB_FILE_OR_DIRECTORY_PERMISSION_DENIED__USER_ERROR_MSG "file or directory permission denied"
|
||||
@ -5889,6 +5890,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ERR_RESTORE_STANDBY_VERSION_LAG__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9096, standby binary version is lower than primary data version, standby need upgrade"
|
||||
#define OB_ERR_RESTORE_PRIMARY_TENANT_DROPPED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9097, primary tenant has been dropped"
|
||||
#define OB_CLOUD_OBJECT_NOT_APPENDABLE__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9098, normal object in object_storage(oss,cos,etc.) can't be appended content"
|
||||
#define OB_RESTORE_TENANT_FAILED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9099, %s restore failed, %s"
|
||||
#define OB_NO_SUCH_FILE_OR_DIRECTORY__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9100, no such file or directory"
|
||||
#define OB_FILE_OR_DIRECTORY_EXIST__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9101, file or directory already exist"
|
||||
#define OB_FILE_OR_DIRECTORY_PERMISSION_DENIED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9102, file or directory permission denied"
|
||||
@ -6174,7 +6176,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ERR_DATA_TOO_LONG_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-12899: value too large for column %.*s (actual: %ld, maximum: %ld)"
|
||||
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-01861: Incorrect datetime value for column '%.*s' at row %ld"
|
||||
|
||||
extern int g_all_ob_errnos[2172];
|
||||
extern int g_all_ob_errnos[2173];
|
||||
|
||||
const char *ob_error_name(const int oberr);
|
||||
const char* ob_error_cause(const int oberr);
|
||||
|
||||
@ -158,8 +158,13 @@ int ObPhysicalRestoreTenantExecutor::sync_wait_tenant_created_(
|
||||
sleep(1);
|
||||
LOG_DEBUG("restore not finish, wait later", K(ret), K(user_tenant_id));
|
||||
} else if (is_failed) {
|
||||
ret = OB_TASK_STATE_FAILED;
|
||||
LOG_WARN("created tenant failed when restore.", K(ret), K(tenant_name));
|
||||
char comment[OB_INNER_TABLE_DEFAULT_KEY_LENTH] = { 0 };
|
||||
if(OB_FAIL(ObRestoreUtil::get_restore_job_comment(*sql_proxy, job_id, comment, OB_INNER_TABLE_DEFAULT_KEY_LENTH))) {
|
||||
LOG_WARN("failed to get failed restore job comment", K(ret), K(job_id));
|
||||
}
|
||||
ret = OB_RESTORE_TENANT_FAILED;
|
||||
LOG_WARN("restore tenant failed.", K(ret), K(tenant_name), K(comment));
|
||||
LOG_USER_ERROR(OB_RESTORE_TENANT_FAILED, tenant_name.ptr(), comment);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user