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
b1fabf6c
Commit
b1fabf6c
authored
Apr 28, 2020
by
Monty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Performance improvements to test if WSREP if active
parent
93281221
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
56 deletions
+81
-56
sql/sql_parse.cc
sql/sql_parse.cc
+59
-40
sql/wsrep_mysqld.cc
sql/wsrep_mysqld.cc
+21
-16
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+1
-0
No files found.
sql/sql_parse.cc
View file @
b1fabf6c
...
...
@@ -1291,7 +1291,7 @@ bool do_command(THD *thd)
Aborted by background rollbacker thread.
Handle error here and jump straight to out
*/
if
(
wsrep_before_command
(
thd
))
if
(
unlikely
(
wsrep_service_started
)
&&
wsrep_before_command
(
thd
))
{
thd
->
store_globals
();
WSREP_LOG_THD
(
thd
,
"enter found BF aborted"
);
...
...
@@ -1368,6 +1368,7 @@ bool do_command(THD *thd)
if
(
packet_length
!=
packet_error
)
{
/* there was a command to process, and before_command() has been called */
if
(
unlikely
(
wsrep_service_started
))
wsrep_after_command_after_result
(
thd
);
}
#endif
/* WITH_WSREP */
...
...
@@ -1659,14 +1660,20 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
thd
->
status_var
.
com_other
++
;
#ifdef WITH_WSREP
if
(
unlikely
(
wsrep_service_started
))
{
wsrep_after_command_ignore_result
(
thd
);
wsrep_close
(
thd
);
}
#endif
/* WITH_WSREP */
thd
->
change_user
();
thd
->
clear_error
();
// if errors from rollback
#ifdef WITH_WSREP
if
(
unlikely
(
wsrep_service_started
))
{
wsrep_open
(
thd
);
wsrep_before_command
(
thd
);
}
#endif
/* WITH_WSREP */
/* Restore original charset from client authentication packet.*/
if
(
thd
->
org_charset
)
...
...
@@ -1680,13 +1687,19 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
status_var_increment
(
thd
->
status_var
.
com_other
);
#ifdef WITH_WSREP
if
(
unlikely
(
wsrep_service_started
))
{
wsrep_after_command_ignore_result
(
thd
);
wsrep_close
(
thd
);
}
#endif
/* WITH_WSREP */
thd
->
change_user
();
#ifdef WITH_WSREP
if
(
unlikely
(
wsrep_service_started
))
{
wsrep_open
(
thd
);
wsrep_before_command
(
thd
);
}
#endif
/* WITH_WSREP */
thd
->
clear_error
();
// if errors from rollback
...
...
@@ -2376,7 +2389,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
dispatch_end:
do_end_of_statement
=
true
;
#ifdef WITH_WSREP
/*
Next test should really be WSREP(thd), but that causes a failure when doing
'set WSREP_ON=0'
*/
if
(
unlikely
(
wsrep_service_started
))
{
/*
BF aborted before sending response back to client
*/
...
...
@@ -2411,11 +2431,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
do_end_of_statement
=
thd_is_connection_alive
(
thd
);
mysql_mutex_unlock
(
&
thd
->
LOCK_thd_kill
);
}
else
do_end_of_statement
=
true
;
}
#endif
/* WITH_WSREP */
if
(
do_end_of_statement
)
{
DBUG_ASSERT
(
thd
->
derived_tables
==
NULL
&&
...
...
sql/wsrep_mysqld.cc
View file @
b1fabf6c
...
...
@@ -99,6 +99,7 @@ my_bool wsrep_desync; // De(re)synchronize the node fr
my_bool
wsrep_strict_ddl
;
// Reject DDL to
// effected tables not
// supporting Galera replication
bool
wsrep_service_started
;
// If Galera was initialized
long
wsrep_slave_threads
;
// No. of slave appliers threads
ulong
wsrep_retry_autocommit
;
// Retry aborted autocommit trx
ulong
wsrep_max_ws_size
;
// Max allowed ws (RBR buffer) size
...
...
@@ -831,10 +832,6 @@ int wsrep_init()
return
err
;
}
global_system_variables
.
wsrep_on
=
1
;
WSREP_ON_
=
wsrep_provider
&&
strcmp
(
wsrep_provider
,
WSREP_NONE
);
if
(
wsrep_gtid_mode
&&
opt_bin_log
&&
!
opt_log_slave_updates
)
{
WSREP_ERROR
(
"Option --log-slave-updates is required if "
...
...
@@ -866,6 +863,11 @@ int wsrep_init()
return
1
;
}
/* Now WSREP is fully initialized */
global_system_variables
.
wsrep_on
=
1
;
WSREP_ON_
=
wsrep_provider
&&
strcmp
(
wsrep_provider
,
WSREP_NONE
);
wsrep_service_started
=
1
;
wsrep_init_provider_status_variables
();
wsrep_capabilities_export
(
Wsrep_server_state
::
instance
().
provider
().
capabilities
(),
&
wsrep_provider_capabilities
);
...
...
@@ -1162,7 +1164,9 @@ bool wsrep_start_replication()
bool
wsrep_must_sync_wait
(
THD
*
thd
,
uint
mask
)
{
bool
ret
;
bool
ret
=
0
;
if
(
thd
->
variables
.
wsrep_on
)
{
mysql_mutex_lock
(
&
thd
->
LOCK_thd_data
);
ret
=
(
thd
->
variables
.
wsrep_sync_wait
&
mask
)
&&
thd
->
wsrep_client_thread
&&
...
...
@@ -1174,6 +1178,7 @@ bool wsrep_must_sync_wait (THD* thd, uint mask)
wsrep
::
transaction
::
s_replaying
&&
thd
->
wsrep_cs
().
sync_wait_gtid
().
is_undefined
();
mysql_mutex_unlock
(
&
thd
->
LOCK_thd_data
);
}
return
ret
;
}
...
...
sql/wsrep_mysqld.h
View file @
b1fabf6c
...
...
@@ -186,6 +186,7 @@ void wsrep_recover_sr_from_storage(THD *);
// Other wsrep global variables
extern
my_bool
wsrep_inited
;
// whether wsrep is initialized ?
extern
bool
wsrep_service_started
;
extern
"C"
void
wsrep_fire_rollbacker
(
THD
*
thd
);
extern
"C"
uint32
wsrep_thd_wsrep_rand
(
THD
*
thd
);
...
...
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