fix(ob_error): add forward mapping information of OB error code (#327)
This commit is contained in:
@ -156,6 +156,12 @@ void ObErrorInfoMgr::print_oracle_error()
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_special_oracle_error_compatible(int ob_error_code) {
|
||||
// These three errors have no argument in Oracle error msg
|
||||
return OB_AUTOINC_SERVICE_BUSY == ob_error_code || OB_ROWID_TYPE_MISMATCH == ob_error_code ||
|
||||
OB_ROWID_NUM_MISMATCH == ob_error_code;
|
||||
}
|
||||
|
||||
bool ObErrorInfoMgr::insert_ob_error(
|
||||
const char* name, const char* msg, const char* cause, const char* solution, int error_code)
|
||||
{
|
||||
@ -190,6 +196,40 @@ void ObErrorInfoMgr::print_ob_error()
|
||||
ob_error_[i].error_msg_,
|
||||
ob_error_[i].cause_,
|
||||
ob_error_[i].solution_);
|
||||
static const char* compatiable_header = "Compatible Error Code:";
|
||||
bool is_compat_header_printed = false;
|
||||
int ob_error_code = -ob_error_[i].error_code_;
|
||||
int mysql_errno = ob_mysql_errno(ob_error_code);
|
||||
if (-1 != mysql_errno) {
|
||||
const char *sqlstate = ob_sqlstate(ob_error_code);
|
||||
printf("\t%s\n", compatiable_header);
|
||||
is_compat_header_printed = true;
|
||||
printf("\t\tMySQL: %d(%s)\n", mysql_errno, sqlstate);
|
||||
}
|
||||
bool need_oracle_print = false;
|
||||
int oracle_errno = ob_errpkt_errno(ob_error_code, true);
|
||||
if (oracle_errno != -ob_error_code) {
|
||||
if (ORACLE_SPECIAL_ERROR_CODE == oracle_errno) {
|
||||
// Compatible error for ORA-00600
|
||||
if (is_special_oracle_error_compatible(ob_error_code)) {
|
||||
need_oracle_print = true;
|
||||
}
|
||||
} else {
|
||||
need_oracle_print = true;
|
||||
}
|
||||
if (need_oracle_print) {
|
||||
const char *oracle_err_msg = ob_errpkt_strerror(ob_error_code, true);
|
||||
if (nullptr != oracle_err_msg) {
|
||||
if (false == is_compat_header_printed) {
|
||||
printf("\t%s\n", compatiable_header);
|
||||
is_compat_header_printed = true;
|
||||
}
|
||||
char oracle_error_code[ORACLE_MSG_PREFIX] = {0};
|
||||
strncpy(oracle_error_code, oracle_err_msg, ORACLE_MSG_PREFIX-2);
|
||||
printf("\t\tOracle: %s\n", oracle_error_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
@ -630,8 +670,7 @@ static bool insert_oracle_error_slot_ora(int err_map[][OB_MAX_SAME_ERROR_COUNT],
|
||||
if (-1 == err_map[error_code][k]) {
|
||||
if (ORACLE_SPECIAL_ERROR_CODE == error_code) {
|
||||
// Compatible error for ORA-00600
|
||||
if (OB_AUTOINC_SERVICE_BUSY == -ob_error || OB_ROWID_TYPE_MISMATCH == -ob_error ||
|
||||
OB_ROWID_NUM_MISMATCH == -ob_error) {
|
||||
if (is_special_oracle_error_compatible(-ob_error)) {
|
||||
err_map[error_code][k] = ob_error;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -47,6 +47,8 @@ OceanBase:
|
||||
Message: Conflicting declarations
|
||||
Cause: Internal Error
|
||||
Solution: Contact OceanBase Support
|
||||
Compatible Error Code:
|
||||
MySQL: 1302(42000)
|
||||
$ob_error 4001
|
||||
|
||||
OceanBase:
|
||||
@ -123,6 +125,43 @@ MySQL:
|
||||
OB_INVALID_ARGUMENT(-4002)
|
||||
OB_MISS_ARGUMENT(-4277)
|
||||
INCORRECT_ARGUMENTS_TO_ESCAPE(-5832)
|
||||
$ob_error 5794
|
||||
|
||||
OceanBase:
|
||||
OceanBase Error Code: OB_AUTOINC_SERVICE_BUSY(-5794)
|
||||
Message: auto increment service busy
|
||||
Cause: Internal Error
|
||||
Solution: Contact OceanBase Support
|
||||
Compatible Error Code:
|
||||
Oracle: ORA-00600
|
||||
$ob_error 5870
|
||||
|
||||
OceanBase:
|
||||
OceanBase Error Code: OB_ROWID_TYPE_MISMATCH(-5870)
|
||||
Message: rowid type mismatch
|
||||
Cause: Internal Error
|
||||
Solution: Contact OceanBase Support
|
||||
Compatible Error Code:
|
||||
Oracle: ORA-00600
|
||||
$ob_error 5871
|
||||
|
||||
OceanBase:
|
||||
OceanBase Error Code: OB_ROWID_NUM_MISMATCH(-5871)
|
||||
Message: rowid num mismatch
|
||||
Cause: Internal Error
|
||||
Solution: Contact OceanBase Support
|
||||
Compatible Error Code:
|
||||
Oracle: ORA-00600
|
||||
$ob_error 4228
|
||||
|
||||
OceanBase:
|
||||
OceanBase Error Code: OB_ERR_FIELD_SPECIFIED_TWICE(-4228)
|
||||
Message: Column specified twice
|
||||
Cause: Internal Error
|
||||
Solution: Contact OceanBase Support
|
||||
Compatible Error Code:
|
||||
MySQL: 1110(42000)
|
||||
Oracle: ORA-00957
|
||||
$ob_error 700 -a 1000
|
||||
error: '-a ARG' is unsupport in this scene
|
||||
Use 'ob_error ora 600 -a ARG'.
|
||||
@ -179,6 +218,8 @@ OceanBase:
|
||||
Message: Conflicting declarations
|
||||
Cause: Internal Error
|
||||
Solution: Contact OceanBase Support
|
||||
Compatible Error Code:
|
||||
MySQL: 1302(42000)
|
||||
|
||||
Oracle:
|
||||
Oracle Error Code: ORA-00600
|
||||
|
||||
@ -10,6 +10,10 @@ ob_error 24761
|
||||
ob_error 5727
|
||||
ob_error 5133
|
||||
ob_error 1210
|
||||
ob_error 5794
|
||||
ob_error 5870
|
||||
ob_error 5871
|
||||
ob_error 4228
|
||||
ob_error 700 -a 1000
|
||||
ob_error my 6000
|
||||
ob_error my 4000
|
||||
|
||||
Reference in New Issue
Block a user