summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-08-12 20:02:23 +0300
committerMonty <monty@mariadb.org>2016-08-12 20:02:23 +0300
commit98e36b299915fe30bc935380d6bc1f6a1986eb52 (patch)
tree30deaa47ef147b2fa8d41e12fce9252380b80bc6 /sql/sql_class.cc
parent66ac894c40ad089175aaf6d4922f7250c23b9b3d (diff)
downloadmariadb-git-98e36b299915fe30bc935380d6bc1f6a1986eb52.tar.gz
With parallel replication we have had a couple of bugs where DDL's
(like DROP TABLE) has been scheduled before conflicting DDL's (like INSERT) are commited. What makes these bugs hard to detect is that in most cases any wrong schduling are caught by MDL locks. It's only when there are timing issues that the bugs (usually deadlocks) are noticed. This patch adds a DBUG_ASSERT() that detects, in parallel replication, if a DDL is scheduled before any depending DML'S are commited. It does this be checking if there are any conflicting replication locks when the DDL is about to wait for getting it's MDL lock. I also did some minor code cleanups in sql_base.cc to make this code similar to other related code.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 1ee5e4b4113..94462924686 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -6477,10 +6477,18 @@ void THD::rgi_lock_temporary_tables()
temporary_tables= rgi_slave->rli->save_temporary_tables;
}
-void THD::rgi_unlock_temporary_tables()
+void THD::rgi_unlock_temporary_tables(bool clear)
{
rgi_slave->rli->save_temporary_tables= temporary_tables;
mysql_mutex_unlock(&rgi_slave->rli->data_lock);
+ if (clear)
+ {
+ /*
+ Temporary tables are shared with other by sql execution threads.
+ As a safety messure, clear the pointer to the common area.
+ */
+ temporary_tables= 0;
+ }
}
bool THD::rgi_have_temporary_tables()