Commit 0be70a1b authored by Jan Lindström's avatar Jan Lindström

MDEV-23483: Set Galera SST thd as system thread

Revert change to MDL and set SST donor thread as a system thread.
Joiner thread was already a system thread.
parent 6fa40b85
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <mysql/psi/mysql_stage.h> #include <mysql/psi/mysql_stage.h>
#include "wsrep_mysqld.h" #include "wsrep_mysqld.h"
#include "wsrep_thd.h" #include "wsrep_thd.h"
#include "wsrep_sst.h"
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_MDL_wait_LOCK_wait_status; static PSI_mutex_key key_MDL_wait_LOCK_wait_status;
...@@ -2138,17 +2137,10 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) ...@@ -2138,17 +2137,10 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
wait_status= m_wait.timed_wait(m_owner, &abs_shortwait, FALSE, wait_status= m_wait.timed_wait(m_owner, &abs_shortwait, FALSE,
mdl_request->key.get_wait_state_name()); mdl_request->key.get_wait_state_name());
THD* thd= m_owner->get_thd();
if (wait_status != MDL_wait::EMPTY) if (wait_status != MDL_wait::EMPTY)
break; break;
/* Check if the client is gone while we were waiting. */ /* Check if the client is gone while we were waiting. */
if (! thd_is_connected(thd)) if (! thd_is_connected(m_owner->get_thd()))
{
#if defined(WITH_WSREP) && !defined(EMBEDDED_LIBRARY)
// During SST client might not be connected
if (!wsrep_is_sst_progress())
#endif
{ {
/* /*
* The client is disconnected. Don't wait forever: * The client is disconnected. Don't wait forever:
...@@ -2158,7 +2150,6 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) ...@@ -2158,7 +2150,6 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
wait_status= MDL_wait::TIMEOUT; wait_status= MDL_wait::TIMEOUT;
break; break;
} }
}
mysql_prlock_wrlock(&lock->m_rwlock); mysql_prlock_wrlock(&lock->m_rwlock);
if (lock->needs_notification(ticket)) if (lock->needs_notification(ticket))
......
/* Copyright 2008-2015 Codership Oy <http://www.codership.com> /* Copyright 2008-2020 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -192,7 +192,6 @@ bool wsrep_before_SE() ...@@ -192,7 +192,6 @@ bool wsrep_before_SE()
static bool sst_complete = false; static bool sst_complete = false;
static bool sst_needed = false; static bool sst_needed = false;
static bool sst_in_progress = false;
#define WSREP_EXTEND_TIMEOUT_INTERVAL 30 #define WSREP_EXTEND_TIMEOUT_INTERVAL 30
#define WSREP_TIMEDWAIT_SECONDS 10 #define WSREP_TIMEDWAIT_SECONDS 10
...@@ -1545,11 +1544,11 @@ static void* sst_donor_thread (void* a) ...@@ -1545,11 +1544,11 @@ static void* sst_donor_thread (void* a)
wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED; wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED;
// seqno of complete SST // seqno of complete SST
wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED; wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED;
// SST is now in progress
sst_in_progress= true;
wsp::thd thd(FALSE); // we turn off wsrep_on for this THD so that it can // We turn off wsrep_on for this THD so that it can
// operate with wsrep_ready == OFF // operate with wsrep_ready == OFF
// We also set this SST thread THD as system thread
wsp::thd thd(FALSE, true);
wsp::process proc(arg->cmd, "r", arg->env); wsp::process proc(arg->cmd, "r", arg->env);
err= proc.error(); err= proc.error();
...@@ -1648,8 +1647,6 @@ static void* sst_donor_thread (void* a) ...@@ -1648,8 +1647,6 @@ static void* sst_donor_thread (void* a)
wsrep->sst_sent (wsrep, &state_id, -err); wsrep->sst_sent (wsrep, &state_id, -err);
proc.wait(); proc.wait();
sst_in_progress= false;
return NULL; return NULL;
} }
...@@ -1824,8 +1821,3 @@ void wsrep_SE_initialized() ...@@ -1824,8 +1821,3 @@ void wsrep_SE_initialized()
{ {
SE_initialized = true; SE_initialized = true;
} }
bool wsrep_is_sst_progress()
{
return (sst_in_progress);
}
...@@ -413,7 +413,7 @@ process::wait () ...@@ -413,7 +413,7 @@ process::wait ()
return err_; return err_;
} }
thd::thd (my_bool won) : init(), ptr(new THD(0)) thd::thd (my_bool won, bool system_thread) : init(), ptr(new THD(0))
{ {
if (ptr) if (ptr)
{ {
...@@ -421,6 +421,8 @@ thd::thd (my_bool won) : init(), ptr(new THD(0)) ...@@ -421,6 +421,8 @@ thd::thd (my_bool won) : init(), ptr(new THD(0))
ptr->store_globals(); ptr->store_globals();
ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog ptr->variables.option_bits&= ~OPTION_BIN_LOG; // disable binlog
ptr->variables.wsrep_on = won; ptr->variables.wsrep_on = won;
if (system_thread)
ptr->system_thread= SYSTEM_THREAD_GENERIC;
ptr->security_ctx->master_access= ~(ulong)0; ptr->security_ctx->master_access= ~(ulong)0;
lex_start(ptr); lex_start(ptr);
} }
......
...@@ -298,7 +298,7 @@ class thd ...@@ -298,7 +298,7 @@ class thd
public: public:
thd(my_bool wsrep_on); thd(my_bool wsrep_on, bool system_thread=false);
~thd(); ~thd();
THD* const ptr; THD* const ptr;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment