summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-07-05 11:14:21 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-07-05 11:14:21 +0530
commit33eeb475b0ced3d962dbb8f136e0aa1376200d5b (patch)
tree310e79fc99f12db8f2d97f3fd805709b526253c7 /sql/sql_class.cc
parent30334771eab57e72c942d555ee466cca83bace00 (diff)
downloadmariadb-git-bb-10.2-MDEV-15855.tar.gz
MDEV-15855 Deadlock between purge thread and DDL statementbb-10.2-MDEV-15855
Problem: ========= Truncate operation holds MDL LOCK on the table (t1) and tries to acquire InnoDB dict_operation_lock. Purge holds InnoDB dict_operation_lock and tries to acquire MDL LOCK on the table (t1) to calculate the virtual column value. It leads to deadlock of purge and truncate table (DDL) Solution: ========= If purge tries to acquire MDL lock on the table then it should do the following: i) Purge should release all innodb locks (including dict_operation_lock) before acquiring metadata lock on the table. ii) After acquiring metadata lock on the table, it should check whether the table is dropped or renamed. If the table is dropped then purge should ignore the record. If the table is renamed then it should release the old table mdl lock and should acquire the new table mdl lock. iii) Once purge acquires mdl lock, it should use the server table for all the remaining virtual index for the purge record. - Introduce new virtual column information in purge_node_t to know whether the mdl lock acquired successfully.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a1010fb4c35..b62d0675145 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -67,6 +67,7 @@
#include "wsrep_thd.h"
#include "sql_connect.h"
#include "my_atomic.h"
+#include "sql_base.h"
#ifdef HAVE_SYS_SYSCALL_H
#include <sys/syscall.h>
@@ -4411,7 +4412,6 @@ TABLE *get_purge_table(THD *thd)
return thd->open_tables;
}
-
/** Find an open table in the list of prelocked tabled
Used for foreign key actions, for example, in UPDATE t1 SET a=1;