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
4bd8c634
Commit
4bd8c634
authored
Apr 08, 2020
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: don't repeat common code
parent
364e7a9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
49 deletions
+41
-49
sql/sql_base.cc
sql/sql_base.cc
+41
-49
No files found.
sql/sql_base.cc
View file @
4bd8c634
...
...
@@ -3103,65 +3103,57 @@ Open_table_context::recover_from_failed_open()
switch
(
m_action
)
{
case
OT_BACKOFF_AND_RETRY
:
break
;
case
OT_REOPEN_TABLES
:
break
;
case
OT_DISCOVER
:
{
if
((
result
=
lock_table_names
(
m_thd
,
m_thd
->
lex
->
create_info
,
m_failed_table
,
NULL
,
get_timeout
(),
0
)))
break
;
tdc_remove_table
(
m_thd
,
m_failed_table
->
db
.
str
,
m_failed_table
->
table_name
.
str
);
m_thd
->
get_stmt_da
()
->
clear_warning_info
(
m_thd
->
query_id
);
m_thd
->
clear_error
();
// Clear error message
case
OT_REPAIR
:
if
((
result
=
lock_table_names
(
m_thd
,
m_thd
->
lex
->
create_info
,
m_failed_table
,
NULL
,
get_timeout
(),
0
)))
break
;
No_such_table_error_handler
no_such_table_handler
;
bool
open_if_exists
=
m_failed_table
->
open_strategy
==
TABLE_LIST
::
OPEN_IF_EXISTS
;
tdc_remove_table
(
m_thd
,
m_failed_table
->
db
.
str
,
m_failed_table
->
table_name
.
str
)
;
if
(
open_if_exists
)
m_thd
->
push_internal_handler
(
&
no_such_table_handler
);
result
=
!
tdc_acquire_share
(
m_thd
,
m_failed_table
,
GTS_TABLE
|
GTS_FORCE_DISCOVERY
|
GTS_NOLOCK
);
if
(
open_if_exists
)
switch
(
m_action
)
{
case
OT_DISCOVER
:
{
m_thd
->
pop_internal_handler
();
if
(
result
&&
no_such_table_handler
.
safely_trapped_errors
())
result
=
FALSE
;
}
m_thd
->
get_stmt_da
()
->
clear_warning_info
(
m_thd
->
query_id
);
m_thd
->
clear_error
();
// Clear error message
/*
Rollback to start of the current statement to release exclusive lock
on table which was discovered but preserve locks from previous statements
in current transaction.
*/
m_thd
->
mdl_context
.
rollback_to_savepoint
(
start_of_statement_svp
());
break
;
}
case
OT_REPAIR
:
{
if
((
result
=
lock_table_names
(
m_thd
,
m_thd
->
lex
->
create_info
,
m_failed_table
,
NULL
,
get_timeout
(),
0
)))
break
;
No_such_table_error_handler
no_such_table_handler
;
bool
open_if_exists
=
m_failed_table
->
open_strategy
==
TABLE_LIST
::
OPEN_IF_EXISTS
;
tdc_remove_table
(
m_thd
,
m_failed_table
->
db
.
str
,
m_failed_table
->
table_name
.
st
r
);
if
(
open_if_exists
)
m_thd
->
push_internal_handler
(
&
no_such_table_handle
r
);
result
=
auto_repair_table
(
m_thd
,
m_failed_table
);
/*
Rollback to start of the current statement to release exclusive lock
on table which was discovered but preserve locks from previous statements
in current transaction.
*/
m_thd
->
mdl_context
.
rollback_to_savepoint
(
start_of_statement_svp
());
break
;
result
=
!
tdc_acquire_share
(
m_thd
,
m_failed_table
,
GTS_TABLE
|
GTS_FORCE_DISCOVERY
|
GTS_NOLOCK
);
if
(
open_if_exists
)
{
m_thd
->
pop_internal_handler
();
if
(
result
&&
no_such_table_handler
.
safely_trapped_errors
())
result
=
FALSE
;
}
break
;
}
case
OT_REPAIR
:
result
=
auto_repair_table
(
m_thd
,
m_failed_table
);
break
;
case
OT_BACKOFF_AND_RETRY
:
case
OT_REOPEN_TABLES
:
case
OT_NO_ACTION
:
DBUG_ASSERT
(
0
);
}
default:
/*
Rollback to start of the current statement to release exclusive lock
on table which was discovered but preserve locks from previous statements
in current transaction.
*/
m_thd
->
mdl_context
.
rollback_to_savepoint
(
start_of_statement_svp
());
break
;
case
OT_NO_ACTION
:
DBUG_ASSERT
(
0
);
}
m_thd
->
pop_internal_handler
();
...
...
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