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
edd1de3d
Commit
edd1de3d
authored
Sep 28, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: introduce CF_SKIP_WSREP_CHECK
remove if() over many COM_xxx values
parent
b3469520
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
31 deletions
+34
-31
sql/sql_class.h
sql/sql_class.h
+5
-0
sql/sql_parse.cc
sql/sql_parse.cc
+29
-31
No files found.
sql/sql_class.h
View file @
edd1de3d
...
...
@@ -4894,6 +4894,11 @@ class select_dumpvar :public select_result_interceptor {
*/
#define CF_SKIP_QUESTIONS (1U << 1)
/**
Do not check that wsrep snapshot is ready before allowing this command
*/
#define CF_SKIP_WSREP_CHECK (1U << 2)
void
mark_transaction_to_rollback
(
THD
*
thd
,
bool
all
);
/* Inline functions */
...
...
sql/sql_parse.cc
View file @
edd1de3d
...
...
@@ -265,11 +265,26 @@ void init_update_queries(void)
/* Initialize the server command flags array. */
memset
(
server_command_flags
,
0
,
sizeof
(
server_command_flags
));
server_command_flags
[
COM_STATISTICS
]
=
CF_SKIP_QUERY_ID
|
CF_SKIP_QUESTIONS
;
server_command_flags
[
COM_PING
]
=
CF_SKIP_QUERY_ID
|
CF_SKIP_QUESTIONS
;
server_command_flags
[
COM_STATISTICS
]
=
CF_SKIP_QUERY_ID
|
CF_SKIP_QUESTIONS
|
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_PING
]
=
CF_SKIP_QUERY_ID
|
CF_SKIP_QUESTIONS
|
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_PREPARE
]
=
CF_SKIP_QUESTIONS
;
server_command_flags
[
COM_STMT_CLOSE
]
=
CF_SKIP_QUESTIONS
;
server_command_flags
[
COM_STMT_RESET
]
=
CF_SKIP_QUESTIONS
;
server_command_flags
[
COM_STMT_CLOSE
]
=
CF_SKIP_QUESTIONS
|
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_STMT_RESET
]
=
CF_SKIP_QUESTIONS
|
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_QUIT
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_PROCESS_INFO
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_PROCESS_KILL
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_SHUTDOWN
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_SLEEP
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_TIME
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_END
]
=
CF_SKIP_WSREP_CHECK
;
/*
COM_QUERY and COM_SET_OPTION are allowed to pass the early COM_xxx filter,
they're checked later in mysql_execute_command().
*/
server_command_flags
[
COM_QUERY
]
=
CF_SKIP_WSREP_CHECK
;
server_command_flags
[
COM_SET_OPTION
]
=
CF_SKIP_WSREP_CHECK
;
/* Initialize the sql command flags array. */
memset
(
sql_command_flags
,
0
,
sizeof
(
sql_command_flags
));
...
...
@@ -874,9 +889,11 @@ void cleanup_items(Item *item)
}
#ifdef WITH_WSREP
#ifndef EMBEDDED_LIBRARY
static
bool
wsrep_node_is_ready
(
THD
*
thd
)
{
#ifdef WITH_WSREP
if
(
thd
->
variables
.
wsrep_on
&&
!
thd
->
wsrep_applier
&&
!
wsrep_ready
)
{
my_message
(
ER_UNKNOWN_COM_ERROR
,
...
...
@@ -884,12 +901,9 @@ static bool wsrep_node_is_ready(THD *thd)
MYF
(
0
));
return
false
;
}
#endif
return
true
;
}
#endif
#ifndef EMBEDDED_LIBRARY
/**
Read one command from connection and execute it (query or simple command).
...
...
@@ -1069,29 +1083,13 @@ bool do_command(THD *thd)
vio_description
(
net
->
vio
),
command
,
command_name
[
command
].
str
));
if
(
WSREP
(
thd
))
/* bail out if DB snapshot has not been installed. */
if
(
!
(
server_command_flags
[
command
]
&
CF_SKIP_WSREP_CHECK
)
&&
!
wsrep_node_is_ready
(
thd
))
{
/*
* bail out if DB snapshot has not been installed. We however,
* allow queries "SET" and "SHOW", they are trapped later in execute_command
*/
if
(
command
!=
COM_QUERY
&&
command
!=
COM_PING
&&
command
!=
COM_QUIT
&&
command
!=
COM_PROCESS_INFO
&&
command
!=
COM_PROCESS_KILL
&&
command
!=
COM_SET_OPTION
&&
command
!=
COM_SHUTDOWN
&&
command
!=
COM_SLEEP
&&
command
!=
COM_STATISTICS
&&
command
!=
COM_TIME
&&
command
!=
COM_END
&&
!
wsrep_node_is_ready
(
thd
))
{
thd
->
protocol
->
end_statement
();
return_value
=
FALSE
;
goto
out
;
}
thd
->
protocol
->
end_statement
();
return_value
=
FALSE
;
goto
out
;
}
/* Restore read timeout value */
my_net_set_read_timeout
(
net
,
thd
->
variables
.
net_read_timeout
);
...
...
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