Skip to content

Commit be12e12

Browse files
[vibe coding] [Enhancement]: delete the codes oracle related (#116) (#145)
Remove Oracle-related code from seekdb as it no longer supports Oracle compatibility mode. Changes: - Remove ob_oracle_errno, ob_oracle_errno_with_check, ob_oracle_strerror, and ob_oracle_str_user_error function declarations from ob_errno.h - Remove corresponding function definitions from ob_errno.cpp - Modify ob_errpkt_* functions to only use MySQL error handling - Update callers to use MySQL error functions instead of Oracle ones: - src/pl/ob_pl.cpp - src/sql/resolver/ddl/ob_create_view_resolver.cpp - src/observer/mysql/obmp_packet_sender.cpp - src/observer/mysql/obmp_stmt_prexecute.cpp - src/sql/engine/dml/ob_err_log_service.cpp - Remove Oracle error support from tools/ob_error Closes #116 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d3741c6 commit be12e12

File tree

8 files changed

+26
-195
lines changed

8 files changed

+26
-195
lines changed

src/observer/mysql/obmp_packet_sender.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,7 @@ int ObMPPacketSender::send_error_packet(int err,
371371
sql::ObSQLSessionInfo *session = NULL;
372372
BACKTRACE(ERROR, (OB_SUCCESS == err), "BUG send error packet but err code is 0");
373373
if (OB_ERR_PROXY_REROUTE != err) {
374-
int client_error = lib::is_oracle_mode() ? common::ob_oracle_errno(err) :
375-
common::ob_mysql_errno(err);
374+
int client_error = common::ob_mysql_errno(err);
376375
// OB error codes that are not compatible with mysql will be displayed using
377376
// OB error codes
378377
client_error = lib::is_mysql_mode() && client_error == -1 ? err : client_error;

src/observer/mysql/obmp_stmt_prexecute.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ int ObMPStmtPrexecute::response_fail_result(sql::ObSQLSessionInfo &session, int
10031003
for (int64_t i = 2; i < (arraybinding_row_->get_count() - 1); i++) {
10041004
arraybinding_row_->get_cell(i).set_null();
10051005
}
1006-
arraybinding_row_->get_cell(arraybinding_row_->get_count() - 1).set_varchar(ob_oracle_strerror(err_ret));
1006+
arraybinding_row_->get_cell(arraybinding_row_->get_count() - 1).set_varchar(ob_strerror(err_ret));
10071007
if (OB_FAIL(response_row(session, *arraybinding_row_, arraybinding_columns_, false))) {
10081008
LOG_WARN("fail to response fail row to client", K(ret));
10091009
}
@@ -1052,7 +1052,7 @@ int ObMPStmtPrexecute::response_returning_rows(ObSQLSessionInfo &session,
10521052
for (int i = 0; i < result_row->get_count(); i++) {
10531053
arraybinding_row_->get_cell(i+2).set_null();
10541054
}
1055-
arraybinding_row_->get_cell(arraybinding_row_->get_count() - 1).set_varchar(ob_oracle_strerror(ret));
1055+
arraybinding_row_->get_cell(arraybinding_row_->get_count() - 1).set_varchar(ob_strerror(ret));
10561056
LOG_DEBUG("error occured before send arraybinding_row_", KPC(arraybinding_row_));
10571057
if (OB_SUCCESS != (response_ret = response_row(session, *arraybinding_row_, arraybinding_columns_, false, &result.get_exec_context()))) {
10581058
LOG_WARN("fail to response row to client", K(response_ret));

src/pl/ob_pl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2718,7 +2718,7 @@ int ObPL::insert_error_msg(int errcode)
27182718
if (err_txt.empty()) {
27192719
ObWarningBuffer *wb = common::ob_get_tsi_warning_buffer();
27202720
if (OB_NOT_NULL(wb)) {
2721-
wb->set_error(common::ob_oracle_strerror(errcode), errcode);
2721+
wb->set_error(common::ob_strerror(errcode), errcode);
27222722
}
27232723
}
27242724
return ret;

src/share/ob_errno.cpp

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -36776,70 +36776,17 @@ int g_all_ob_errnos[2440] = {0, -4000, -4001, -4002, -4003, -4004, -4005, -4006,
3677636776
}
3677736777
return ret;
3677836778
}
36779-
const char *ob_oracle_strerror(const int err)
36779+
int ob_errpkt_errno(const int err, const bool /* is_oracle_mode - deprecated */)
3678036780
{
36781-
const char *ret = "Unknown error";
36782-
if (OB_LIKELY(0 >= err && err > -OB_MAX_ERROR_CODE)) {
36783-
if (!g_enable_ob_error_msg_style) {
36784-
ret = get_error(-err)->oracle_str_error;
36785-
} else {
36786-
ret = get_error(-err)->ob_str_error;
36787-
}
36788-
if (OB_UNLIKELY(NULL == ret || '\0' == ret[0]))
36789-
{
36790-
ret = "Unknown Error";
36791-
}
36792-
}
36793-
return ret;
36794-
}
36795-
const char *ob_oracle_str_user_error(const int err)
36796-
{
36797-
const char *ret = NULL;
36798-
if (OB_LIKELY(0 >= err && err > -OB_MAX_ERROR_CODE)) {
36799-
if (!g_enable_ob_error_msg_style) {
36800-
ret = get_error(-err)->oracle_str_user_error;
36801-
} else {
36802-
ret = get_error(-err)->ob_str_user_error;
36803-
}
36804-
if (OB_UNLIKELY(NULL == ret || '\0' == ret[0])) {
36805-
ret = NULL;
36806-
}
36807-
}
36808-
return ret;
36809-
}
36810-
int ob_oracle_errno(const int err)
36811-
{
36812-
int ret = -1;
36813-
if (OB_ERR_PROXY_REROUTE == err) {
36814-
// Oracle Mode and MySQL mode should return same errcode for reroute sql
36815-
// thus we make the specialization here
36816-
ret = -1;
36817-
} else if (err >= OB_MIN_RAISE_APPLICATION_ERROR && err <= OB_MAX_RAISE_APPLICATION_ERROR) {
36818-
ret = err; // PL/SQL Raise Application Error
36819-
} else if (OB_LIKELY(0 >= err && err > -OB_MAX_ERROR_CODE)) {
36820-
ret = get_error(-err)->oracle_errno;
36821-
}
36822-
return ret;
36823-
}
36824-
int ob_oracle_errno_with_check(const int err)
36825-
{
36826-
int ret = ob_oracle_errno(err);
36827-
if (ret < 0) {
36828-
ret = -err;
36829-
}
36830-
return ret;
36831-
}
36832-
int ob_errpkt_errno(const int err, const bool is_oracle_mode)
36833-
{
36834-
return (is_oracle_mode ? ob_oracle_errno_with_check(err) : ob_mysql_errno_with_check(err));
36781+
return ob_mysql_errno_with_check(err);
3683536782
}
36836-
const char *ob_errpkt_strerror(const int err, const bool is_oracle_mode)
36783+
const char *ob_errpkt_strerror(const int err, const bool /* is_oracle_mode - deprecated */)
3683736784
{
36838-
return (is_oracle_mode ? ob_oracle_strerror(err) : ob_strerror(err));
36785+
return ob_strerror(err);
3683936786
}
36840-
const char *ob_errpkt_str_user_error(const int err, const bool is_oracle_mode)
36787+
const char *ob_errpkt_str_user_error(const int err, const bool /* is_oracle_mode - deprecated */)
3684136788
{
36842-
return (is_oracle_mode ? ob_oracle_str_user_error(err) : ob_str_user_error(err));
36789+
return ob_str_user_error(err);
3684336790
}
3684436791

3684536792
} // end namespace common

src/share/ob_errno.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9351,14 +9351,9 @@ extern int g_all_ob_errnos[2440];
93519351
const char *ob_strerror(const int oberr);
93529352
const char *ob_str_user_error(const int oberr);
93539353

9354-
int ob_oracle_errno(const int oberr);
9355-
int ob_oracle_errno_with_check(const int oberr);
9356-
const char *ob_oracle_strerror(const int oberr);
9357-
const char *ob_oracle_str_user_error(const int oberr);
9354+
// Note: Oracle-related functions (ob_oracle_errno, ob_oracle_strerror, etc.) have been removed
9355+
// as seekdb no longer supports Oracle compatibility mode.
93589356

9359-
#ifndef __ERROR_CODE_PARSER_
9360-
int get_ob_errno_from_oracle_errno(const int error_no, const char *error_msg, int &ob_errno);
9361-
#endif
93629357
int ob_errpkt_errno(const int oberr, const bool is_oracle_mode);
93639358
const char *ob_errpkt_strerror(const int oberr, const bool is_oracle_mode);
93649359
const char *ob_errpkt_str_user_error(const int oberr, const bool is_oracle_mode);

src/sql/engine/dml/ob_err_log_service.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ int ObErrLogService::gen_insert_sql_str(ObIAllocator &alloc,
5050
int64_t default_column_name_pos = 0;
5151
int64_t default_column_value_pos = 0;
5252

53-
const int err_no = ob_oracle_errno(first_err_ret);
53+
const int err_no = ob_mysql_errno(first_err_ret);
5454
// ObString msg = ob_get_tsi_err_msg(first_err_ret);
5555
// Because there are escape characters in dynamic_msg, use static error messages now
56-
ObString msg = ObString::make_string(ob_oracle_strerror(first_err_ret));
56+
ObString msg = ObString::make_string(ob_strerror(first_err_ret));
5757

5858
// %.*s 1:database_name
5959
// %.*s 2:table_name

src/sql/resolver/ddl/ob_create_view_resolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ int ObCreateViewResolver::try_add_error_info(const uint64_t error_number,
436436
if (ERROR_STATUS_HAS_ERROR == error_info.get_error_status()) {
437437
/* do nothing */
438438
} else {
439-
ObString err_txt(common::ob_oracle_strerror(error_number));
439+
ObString err_txt(common::ob_strerror(error_number));
440440
error_info.set_error_number(error_number);
441441
error_info.set_error_status(ERROR_STATUS_HAS_ERROR);
442442
if (err_txt.empty()) {

tools/ob_error/src/ob_error.cpp

Lines changed: 11 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -210,54 +210,22 @@ void ObErrorInfoMgr::print_ob_error()
210210
is_compat_header_printed = true;
211211
printf("\t\tMySQL: %d(%s)\n", mysql_errno, sqlstate);
212212
}
213-
bool need_oracle_print = false;
214-
int oracle_errno = ob_errpkt_errno(ob_error_code, true);
215-
if (oracle_errno != -ob_error_code) {
216-
if (ORACLE_SPECIAL_ERROR_CODE == oracle_errno) {
217-
// Compatible error for ORA-00600
218-
if (is_special_oracle_error_compatible(ob_error_code)) {
219-
need_oracle_print = true;
220-
}
221-
} else {
222-
need_oracle_print = true;
223-
}
224-
if (need_oracle_print) {
225-
const char *oracle_err_msg = ob_errpkt_strerror(ob_error_code, true);
226-
if (nullptr != oracle_err_msg) {
227-
if (false == is_compat_header_printed) {
228-
printf("\t%s\n", compatiable_header);
229-
is_compat_header_printed = true;
230-
}
231-
char oracle_error_code[ORACLE_MSG_PREFIX] = {0};
232-
strncpy(oracle_error_code, oracle_err_msg, ORACLE_MSG_PREFIX-2);
233-
printf("\t\tOracle: %s\n", oracle_error_code);
234-
}
235-
}
236-
}
213+
// Oracle error code printing removed - seekdb no longer supports Oracle compatibility mode
237214
}
238215
}
239216
//////////////////////////////////////////////////////////////
240217
static void print_help()
241218
{
242219
printf("This is the ob_error tool. Usage:\n\n"
243220
" ob_error [option]\n"
244-
" ob_error [facility] error_code [-a ARGUMENT]\n"
245-
" ob_error [facility] error_code [--argument ARGUMENT]\n"
221+
" ob_error [facility] error_code\n"
246222
"Get the error information, reasons and possible solutions.\n\n"
247223
"Query an error:\n\n"
248224
" ob_error error_code\n\n"
249225
"Query an error in MySQL mode:\n\n"
250226
" ob_error MY error_code\n\n"
251-
"Query an error in ORACLE mode:\n\n"
252-
" ob_error facility error_code\n"
253-
" ob_error facility error_code -a ARGUMENT\n"
254-
" ob_error facility error_code --argument ARGUMENT\n\n"
255-
"ARGUMENT: \n\n"
256-
" Positive number OceanBase error_code in ORA-00600 error output.\n\n"
257227
"facility:\n\n"
258-
" MY MySQL mode.\n"
259-
" ORA ORACLE mode. Error from database.\n"
260-
" PLS ORACLE mode. Error from the stored procedure.\n\n"
228+
" MY MySQL mode.\n\n"
261229
"Normal options:\n\n"
262230
" --help, -h Print this message and then exit.\n"
263231
" --version, -V Print version information and then exit.\n\n");
@@ -473,74 +441,13 @@ bool add_mysql_info(int error_code, ObErrorInfoMgr* mgr)
473441

474442
bool add_oracle_info(Fac oracle_facility, int error_code, int argument, ObErrorInfoMgr* mgr)
475443
{
476-
bool bret = false;
477-
if (nullptr == mgr) {
478-
ERROR_PRINT("ObErrorInfoMgr *mgr is null.\n");
479-
bret = true;
480-
} else if (0 <= error_code && ORACLE_MAX_ERROR_CODE > error_code) {
481-
int info_count = 0;
482-
int ob_error = -1;
483-
// Before being called, ensure that argument cannot be set when nullptr == oracle_facility
484-
if (NONE == oracle_facility) {
485-
// Handle the case where error is ORA-error_code
486-
bret |= add_error_info(error_code, ORA, g_oracle_ora, mgr);
487-
// Handle the case where error is PLS-error_code
488-
bret |= add_error_info(error_code, PLS, g_oracle_pls, mgr);
489-
} else {
490-
if (ORA == oracle_facility) {
491-
if (ORACLE_SPECIAL_ERROR_CODE == error_code) {
492-
// 600 is a special error code.
493-
// If there is no '-a ARG' parameter, the original possible error of ora-00600 will be output
494-
if (-1 == argument) {
495-
bret = add_error_info(error_code, ORA, g_oracle_ora, mgr);
496-
} else {
497-
ob_error = argument;
498-
const char* error_usr_msg = ob_errpkt_str_user_error(-ob_error, true);
499-
if (nullptr != error_usr_msg) {
500-
// verify that the error is ora-00600
501-
if (-OB_ERR_PROXY_REROUTE == ob_errpkt_errno(-ob_error, true) ||
502-
ORACLE_SPECIAL_ERROR_CODE == ob_errpkt_errno(-ob_error, true)) {
503-
const char* error_msg = ob_errpkt_strerror(-ob_error, true);
504-
const char* error_name = ob_error_name(-ob_error);
505-
const char* error_cause = ob_error_cause(-ob_error);
506-
const char* error_solution = ob_error_solution(-ob_error);
507-
if (mgr->insert_oracle_error(error_name,
508-
error_msg + ORACLE_MSG_PREFIX,
509-
error_cause,
510-
error_solution,
511-
ORA,
512-
error_code,
513-
ob_error)) {
514-
bret = true;
515-
}
516-
}
517-
}
518-
}
519-
} else {
520-
// '-a ARG' parameter only supports ora-00600 error
521-
if (-1 != argument) {
522-
printf("error: '-a ARG' is unsupport in this scene\n"
523-
"Use 'ob_error ora 600 -a=ARG'.\n"
524-
"Use 'ob_error --help' for help.\n");
525-
bret = true;
526-
} else {
527-
bret = add_error_info(error_code, ORA, g_oracle_ora, mgr);
528-
}
529-
}
530-
} else if (PLS == oracle_facility) {
531-
// '-a ARG' parameter only supports ora-00600 error
532-
if (-1 != argument) {
533-
printf("error: '-a ARG' is unsupport in this scene\n"
534-
"Use 'ob_error ora 600 -a ARG'.\n"
535-
"Use 'ob_error --help' for help.\n");
536-
bret = true;
537-
} else {
538-
bret = add_error_info(error_code, PLS, g_oracle_pls, mgr);
539-
}
540-
}
541-
}
542-
}
543-
return bret;
444+
// Oracle support has been removed from seekdb
445+
// This function now returns false to indicate no Oracle error info is available
446+
(void)oracle_facility;
447+
(void)error_code;
448+
(void)argument;
449+
(void)mgr;
450+
return false;
544451
}
545452

546453
// prevent the atoi parse "123abc"
@@ -777,24 +684,7 @@ static bool ob_init_error_to_oberror(int ora_err[][OB_MAX_SAME_ERROR_COUNT], int
777684
bret = false;
778685
}
779686
}
780-
// init ora_err/pls_err map
781-
const char* error_usr_msg = ob_oracle_str_user_error(-i);
782-
error_code = ob_oracle_errno(-i);
783-
if (-1 != error_code && NULL != error_usr_msg) {
784-
if (0 > error_code)
785-
error_code = -error_code;
786-
if (0 == strncmp(error_usr_msg, facility_str[ORA], strlen(facility_str[ORA]))) {
787-
if (!insert_oracle_error_slot_ora(ora_err, error_code, i)) {
788-
ERROR_PRINT("error: OB_MAX_SAME_ERROR_COUNT is not enough for ORA-%05d(OB Error %d)\n", error_code, i);
789-
bret = false;
790-
}
791-
} else if (0 == strncmp(error_usr_msg, facility_str[PLS], strlen(facility_str[PLS]))) {
792-
if (!insert_oracle_error_slot_pls(pls_err, error_code, i)) {
793-
ERROR_PRINT("error: OB_MAX_SAME_ERROR_COUNT is not enough for PLS-%05d(OB Error %d)\n", error_code, i);
794-
bret = false;
795-
}
796-
}
797-
}
687+
// Oracle error mapping removed - seekdb no longer supports Oracle compatibility mode
798688
}
799689
return bret;
800690
}

0 commit comments

Comments
 (0)