summaryrefslogtreecommitdiff
path: root/sql/wsrep_thd.cc
diff options
context:
space:
mode:
authorEugene Kosov <eugene.kosov@mariadb.com>2019-07-16 15:42:36 +0300
committerEugene Kosov <eugene.kosov@mariadb.com>2019-07-16 18:39:21 +0300
commit0f83c8878dc1389212c134f65d37a43d9d248250 (patch)
tree6950ea9b6c449a6e5d8a0205b3d06ae275a6234c /sql/wsrep_thd.cc
parentaa96e56c55c44d2c20c1cd70325ef88ad0af8f98 (diff)
parentd2f094d9e63e97293915b17b30a73b2552647a38 (diff)
downloadmariadb-git-0f83c8878dc1389212c134f65d37a43d9d248250.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/wsrep_thd.cc')
-rw-r--r--sql/wsrep_thd.cc36
1 files changed, 30 insertions, 6 deletions
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 177124cb0ce..34b39c6d1e3 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -359,6 +359,7 @@ static void wsrep_replication_process(THD *thd)
thd->variables.option_bits|= OPTION_BEGIN;
thd->server_status|= SERVER_STATUS_IN_TRANS;
+ thd_proc_info(thd, "wsrep applier idle");
rcode = wsrep->recv(wsrep, (void *)thd);
DBUG_PRINT("wsrep",("wsrep_repl returned: %d", rcode));
@@ -414,13 +415,12 @@ static void wsrep_replication_process(THD *thd)
DBUG_VOID_RETURN;
}
-static bool create_wsrep_THD(wsrep_thd_processor_fun processor)
+static bool create_wsrep_THD(wsrep_thread_args* args)
{
ulong old_wsrep_running_threads= wsrep_running_threads;
- pthread_t unused;
mysql_mutex_lock(&LOCK_thread_count);
- bool res= pthread_create(&unused, &connection_attrib, start_wsrep_THD,
- (void*)processor);
+ bool res= pthread_create(&args->thread_id, &connection_attrib, start_wsrep_THD,
+ (void*)args);
/*
if starting a thread on server startup, wait until the this thread's THD
is fully initialized (otherwise a THD initialization code might
@@ -450,8 +450,20 @@ void wsrep_create_appliers(long threads)
long wsrep_threads=0;
while (wsrep_threads++ < threads) {
- if (create_wsrep_THD(wsrep_replication_process))
+ wsrep_thread_args* arg;
+ if((arg = (wsrep_thread_args*)my_malloc(sizeof(wsrep_thread_args), MYF(0))) == NULL) {
+ WSREP_ERROR("Can't allocate memory for wsrep replication thread %ld\n", wsrep_threads);
+ assert(0);
+ }
+
+ arg->thread_type = WSREP_APPLIER_THREAD;
+ arg->processor = wsrep_replication_process;
+
+ if (create_wsrep_THD(arg)) {
WSREP_WARN("Can't create thread to manage wsrep replication");
+ my_free(arg);
+ return;
+ }
}
}
@@ -538,9 +550,21 @@ void wsrep_create_rollbacker()
{
if (wsrep_provider && strcasecmp(wsrep_provider, "none"))
{
+ wsrep_thread_args* arg;
+ if((arg = (wsrep_thread_args*)my_malloc(sizeof(wsrep_thread_args), MYF(0))) == NULL) {
+ WSREP_ERROR("Can't allocate memory for wsrep rollbacker thread\n");
+ assert(0);
+ }
+
+ arg->thread_type = WSREP_ROLLBACKER_THREAD;
+ arg->processor = wsrep_rollback_process;
+
/* create rollbacker */
- if (create_wsrep_THD(wsrep_rollback_process))
+ if (create_wsrep_THD(arg)) {
WSREP_WARN("Can't create thread to manage wsrep rollback");
+ my_free(arg);
+ return;
+ }
}
}