Commit dddb6592 authored by marko's avatar marko

branches/zip: row_mysql_handle_errors(): Replace the if-else with

switch-case.
parent f2186190
......@@ -469,26 +469,21 @@ row_mysql_handle_errors(
trx->error_state = DB_SUCCESS;
if ((err == DB_DUPLICATE_KEY)
|| (err == DB_FOREIGN_DUPLICATE_KEY)) {
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
trx_general_rollback_for_mysql(trx, TRUE, savept);
}
} else if (err == DB_TOO_BIG_RECORD) {
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
trx_general_rollback_for_mysql(trx, TRUE, savept);
switch (err) {
case DB_LOCK_WAIT_TIMEOUT:
if (row_rollback_on_timeout) {
trx_general_rollback_for_mysql(trx, FALSE, NULL);
break;
}
/* MySQL will roll back the latest SQL statement */
} else if (err == DB_ROW_IS_REFERENCED
|| err == DB_NO_REFERENCED_ROW
|| err == DB_CANNOT_ADD_CONSTRAINT
|| err == DB_TOO_MANY_CONCURRENT_TRXS) {
/* fall through */
case DB_DUPLICATE_KEY:
case DB_FOREIGN_DUPLICATE_KEY:
case DB_TOO_BIG_RECORD:
case DB_ROW_IS_REFERENCED:
case DB_NO_REFERENCED_ROW:
case DB_CANNOT_ADD_CONSTRAINT:
case DB_TOO_MANY_CONCURRENT_TRXS:
case DB_OUT_OF_FILE_SPACE:
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
......@@ -496,8 +491,8 @@ row_mysql_handle_errors(
trx_general_rollback_for_mysql(trx, TRUE, savept);
}
/* MySQL will roll back the latest SQL statement */
} else if (err == DB_LOCK_WAIT) {
break;
case DB_LOCK_WAIT:
srv_suspend_mysql_thread(thr);
if (trx->error_state != DB_SUCCESS) {
......@@ -510,31 +505,15 @@ row_mysql_handle_errors(
return(TRUE);
} else if (err == DB_DEADLOCK
|| err == DB_LOCK_TABLE_FULL
|| (err == DB_LOCK_WAIT_TIMEOUT
&& row_rollback_on_timeout)) {
case DB_DEADLOCK:
case DB_LOCK_TABLE_FULL:
/* Roll back the whole transaction; this resolution was added
to version 3.23.43 */
trx_general_rollback_for_mysql(trx, FALSE, NULL);
break;
} else if (err == DB_OUT_OF_FILE_SPACE
|| err == DB_LOCK_WAIT_TIMEOUT) {
ut_ad(!(err == DB_LOCK_WAIT_TIMEOUT
&& row_rollback_on_timeout));
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
trx_general_rollback_for_mysql(trx, TRUE, savept);
}
/* MySQL will roll back the latest SQL statement */
} else if (err == DB_MUST_GET_MORE_FILE_SPACE) {
case DB_MUST_GET_MORE_FILE_SPACE:
fputs("InnoDB: The database cannot continue"
" operation because of\n"
"InnoDB: lack of space. You must add"
......@@ -542,8 +521,8 @@ row_mysql_handle_errors(
"InnoDB: my.cnf and restart the database.\n", stderr);
exit(1);
} else if (err == DB_CORRUPTION) {
case DB_CORRUPTION:
fputs("InnoDB: We detected index corruption"
" in an InnoDB type table.\n"
"InnoDB: You have to dump + drop + reimport"
......@@ -558,7 +537,8 @@ row_mysql_handle_errors(
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html"
" for help.\n", stderr);
} else {
break;
default:
fprintf(stderr, "InnoDB: unknown error code %lu\n",
(ulong) err);
ut_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment