summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2017-11-22 17:10:34 +0200
committerMonty <monty@mariadb.org>2017-12-18 13:43:37 +0200
commite972125f11d8f37bc263b113e85ed064257a92ee (patch)
treef705082eec5bdb4f274b3e7ceee4714b86c96075 /sql/sql_class.cc
parentabceaa75428f9b2d64ce64629d010af9aa6eae1f (diff)
downloadmariadb-git-e972125f11d8f37bc263b113e85ed064257a92ee.tar.gz
MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality. Semisync is turned to be static instead of plugin so its functions are invoked at the same points as RUN_HOOKS. The RUN_HOOKS and the observer interface remain to be removed by later patch. Todo: React on killed status by repl_semisync_master.wait_after_sync(). Currently Repl_semi_sync_master::commit_trx does not check the killed status. There were few bugfixes found that are present in mysql and its unclear whether/how they are covered. Those include: Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL HAS BAD PERFORMANCE Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 35ed9be74f9..d0aa0818e99 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -706,7 +706,7 @@ extern "C" void thd_kill_timeout(THD* thd)
}
-THD::THD(my_thread_id id, bool is_wsrep_applier)
+THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
:Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
/* statement id */ 0),
rli_fake(0), rgi_fake(0), rgi_slave(NULL),
@@ -893,7 +893,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
/* Call to init() below requires fully initialized Open_tables_state. */
reset_open_tables_state(this);
- init();
+ init(skip_global_sys_var_lock);
#if defined(ENABLED_PROFILING)
profiling.set_thd(this);
#endif
@@ -1264,10 +1264,11 @@ const Type_handler *THD::type_handler_for_date() const
Init common variables that has to be reset on start and on change_user
*/
-void THD::init(void)
+void THD::init(bool skip_lock)
{
DBUG_ENTER("thd::init");
- mysql_mutex_lock(&LOCK_global_system_variables);
+ if (!skip_lock)
+ mysql_mutex_lock(&LOCK_global_system_variables);
plugin_thdvar_init(this);
/*
plugin_thd_var_init() sets variables= global_system_variables, which
@@ -1280,8 +1281,8 @@ void THD::init(void)
::strmake(default_master_connection_buff,
global_system_variables.default_master_connection.str,
variables.default_master_connection.length);
-
- mysql_mutex_unlock(&LOCK_global_system_variables);
+ if (!skip_lock)
+ mysql_mutex_unlock(&LOCK_global_system_variables);
user_time.val= start_time= start_time_sec_part= 0;
@@ -4193,7 +4194,8 @@ my_bool thd_net_is_killed()
void thd_increment_bytes_received(void *thd, ulong length)
{
- ((THD*) thd)->status_var.bytes_received+= length;
+ if (thd != NULL) // MDEV-13073 Ack collector having NULL
+ ((THD*) thd)->status_var.bytes_received+= length;
}