Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
dddb6592
Commit
dddb6592
authored
Aug 15, 2007
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: row_mysql_handle_errors(): Replace the if-else with
switch-case.
parent
f2186190
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
43 deletions
+23
-43
row/row0mysql.c
row/row0mysql.c
+23
-43
No files found.
row/row0mysql.c
View file @
dddb6592
...
@@ -469,26 +469,21 @@ row_mysql_handle_errors(
...
@@ -469,26 +469,21 @@ row_mysql_handle_errors(
trx
->
error_state
=
DB_SUCCESS
;
trx
->
error_state
=
DB_SUCCESS
;
if
((
err
==
DB_DUPLICATE_KEY
)
switch
(
err
)
{
||
(
err
==
DB_FOREIGN_DUPLICATE_KEY
))
{
case
DB_LOCK_WAIT_TIMEOUT
:
if
(
savept
)
{
if
(
row_rollback_on_timeout
)
{
/* Roll back the latest, possibly incomplete
trx_general_rollback_for_mysql
(
trx
,
FALSE
,
NULL
);
insertion or update */
break
;
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
);
}
}
/* MySQL will roll back the latest SQL statement */
/* fall through */
}
else
if
(
err
==
DB_ROW_IS_REFERENCED
case
DB_DUPLICATE_KEY
:
||
err
==
DB_NO_REFERENCED_ROW
case
DB_FOREIGN_DUPLICATE_KEY
:
||
err
==
DB_CANNOT_ADD_CONSTRAINT
case
DB_TOO_BIG_RECORD
:
||
err
==
DB_TOO_MANY_CONCURRENT_TRXS
)
{
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
)
{
if
(
savept
)
{
/* Roll back the latest, possibly incomplete
/* Roll back the latest, possibly incomplete
insertion or update */
insertion or update */
...
@@ -496,8 +491,8 @@ row_mysql_handle_errors(
...
@@ -496,8 +491,8 @@ row_mysql_handle_errors(
trx_general_rollback_for_mysql
(
trx
,
TRUE
,
savept
);
trx_general_rollback_for_mysql
(
trx
,
TRUE
,
savept
);
}
}
/* MySQL will roll back the latest SQL statement */
/* MySQL will roll back the latest SQL statement */
}
else
if
(
err
==
DB_LOCK_WAIT
)
{
break
;
case
DB_LOCK_WAIT
:
srv_suspend_mysql_thread
(
thr
);
srv_suspend_mysql_thread
(
thr
);
if
(
trx
->
error_state
!=
DB_SUCCESS
)
{
if
(
trx
->
error_state
!=
DB_SUCCESS
)
{
...
@@ -510,31 +505,15 @@ row_mysql_handle_errors(
...
@@ -510,31 +505,15 @@ row_mysql_handle_errors(
return
(
TRUE
);
return
(
TRUE
);
}
else
if
(
err
==
DB_DEADLOCK
case
DB_DEADLOCK
:
||
err
==
DB_LOCK_TABLE_FULL
case
DB_LOCK_TABLE_FULL
:
||
(
err
==
DB_LOCK_WAIT_TIMEOUT
&&
row_rollback_on_timeout
))
{
/* Roll back the whole transaction; this resolution was added
/* Roll back the whole transaction; this resolution was added
to version 3.23.43 */
to version 3.23.43 */
trx_general_rollback_for_mysql
(
trx
,
FALSE
,
NULL
);
trx_general_rollback_for_mysql
(
trx
,
FALSE
,
NULL
);
break
;
}
else
if
(
err
==
DB_OUT_OF_FILE_SPACE
case
DB_MUST_GET_MORE_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
)
{
fputs
(
"InnoDB: The database cannot continue"
fputs
(
"InnoDB: The database cannot continue"
" operation because of
\n
"
" operation because of
\n
"
"InnoDB: lack of space. You must add"
"InnoDB: lack of space. You must add"
...
@@ -542,8 +521,8 @@ row_mysql_handle_errors(
...
@@ -542,8 +521,8 @@ row_mysql_handle_errors(
"InnoDB: my.cnf and restart the database.
\n
"
,
stderr
);
"InnoDB: my.cnf and restart the database.
\n
"
,
stderr
);
exit
(
1
);
exit
(
1
);
}
else
if
(
err
==
DB_CORRUPTION
)
{
case
DB_CORRUPTION
:
fputs
(
"InnoDB: We detected index corruption"
fputs
(
"InnoDB: We detected index corruption"
" in an InnoDB type table.
\n
"
" in an InnoDB type table.
\n
"
"InnoDB: You have to dump + drop + reimport"
"InnoDB: You have to dump + drop + reimport"
...
@@ -558,7 +537,8 @@ row_mysql_handle_errors(
...
@@ -558,7 +537,8 @@ row_mysql_handle_errors(
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"forcing-recovery.html"
"forcing-recovery.html"
" for help.
\n
"
,
stderr
);
" for help.
\n
"
,
stderr
);
}
else
{
break
;
default:
fprintf
(
stderr
,
"InnoDB: unknown error code %lu
\n
"
,
fprintf
(
stderr
,
"InnoDB: unknown error code %lu
\n
"
,
(
ulong
)
err
);
(
ulong
)
err
);
ut_error
;
ut_error
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment