summaryrefslogtreecommitdiff
path: root/sql/mdl.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2020-08-10 11:44:42 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2020-08-11 09:58:26 +0300
commit57d1a5fa8ed925b03d28aea3fab82de0823e68a8 (patch)
tree1977501e45f8c6ce73d02c4a78bde71a4211ab26 /sql/mdl.cc
parent78ea8ad425f2dc650b07e33d4724bbb21a9d1f17 (diff)
downloadmariadb-git-57d1a5fa8ed925b03d28aea3fab82de0823e68a8.tar.gz
MDEV-22543 : Galera SST donation fails, FLUSH TABLES WITH READ LOCK times out
During SST we need to let FTWRL to use normal timeout method even when client is disconnected.
Diffstat (limited to 'sql/mdl.cc')
-rw-r--r--sql/mdl.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 9eeb82eeffd..14a1f17fe86 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -25,6 +25,7 @@
#include <mysql/psi/mysql_stage.h>
#include "wsrep_mysqld.h"
#include "wsrep_thd.h"
+#include "wsrep_sst.h"
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_MDL_wait_LOCK_wait_status;
@@ -2137,18 +2138,26 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
wait_status= m_wait.timed_wait(m_owner, &abs_shortwait, FALSE,
mdl_request->key.get_wait_state_name());
+ THD* thd= m_owner->get_thd();
+
if (wait_status != MDL_wait::EMPTY)
break;
/* Check if the client is gone while we were waiting. */
- if (! thd_is_connected(m_owner->get_thd()))
+ if (! thd_is_connected(thd))
{
- /*
- * The client is disconnected. Don't wait forever:
- * assume it's the same as a wait timeout, this
- * ensures all error handling is correct.
- */
- wait_status= MDL_wait::TIMEOUT;
- break;
+#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:
+ * assume it's the same as a wait timeout, this
+ * ensures all error handling is correct.
+ */
+ wait_status= MDL_wait::TIMEOUT;
+ break;
+ }
}
mysql_prlock_wrlock(&lock->m_rwlock);