summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorRaghavendra D Prabhu <rprabhu@wnohang.net>2015-06-29 16:42:58 +0530
committerNirbhay Choubey <nirbhay@mariadb.com>2015-09-09 22:33:52 -0400
commitfbe739cbb15d6a50e5ec6494528fe0441667eb75 (patch)
tree89fe710c38c20f96a01dd04be776564834fb8596 /sql
parent5a002adb5fda82df8f6bfe7b4f49f07585e13c39 (diff)
downloadmariadb-git-fbe739cbb15d6a50e5ec6494528fe0441667eb75.tar.gz
Bug#1421360: Add 'FLUSH TABLES' to Total Order Isolation execution.
Before this, FLUSH TABLES and FLUSH TABLES t1 (REFRESH_TABLES hereafter) were executed locally, which also had implications for GTID. MySQL async replication does replicate FLUSH TABLES. Hence, this commit a) Adds REFRESH_TABLES to TOI. b) Skips LOCK-based REFRESH_TABLES from TOI, ie. FLUSH TABLES WITH READ LOCK and FLUSH TABLES FOR EXPORT. c) Executes them after reload_acl_and_cache. This is done since reload_acl_and_cache checks for thd->locked_tables_mode and does upgrade of MDL locks accordingly. A failure here means REFRESH_TABLES cannot run. i) This is also important since LOCK TABLES is not replicated in galera. d) Test galera_flush has been modified for i) wsrep_replicate_myisam SESSION variable. ii) Testing REFRESH_TABLES. iii) Testing REFRESH_TABLES + LOCK TABLES. e) Use different WSREP_TO_ISOLATION_BEGIN for global FLUSH TABLES and FLUSH TABLES <table,>.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index f1a3e7cb58e..af35a2a3b55 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4695,6 +4695,25 @@ end_with_restore_list:
*/
if (!reload_acl_and_cache(thd, lex->type, first_table, &write_to_binlog))
{
+#ifdef WITH_WSREP
+ if ((lex->type & REFRESH_TABLES) && !(lex->type & (REFRESH_FOR_EXPORT|REFRESH_READ_LOCK)))
+ {
+ /*
+ This is done after reload_acl_and_cache is because
+ LOCK TABLES is not replicated in galera, the upgrade of which
+ is checked in reload_acl_and_cache.
+ Hence, done after/if we are able to upgrade locks.
+ */
+ if (first_table)
+ {
+ WSREP_TO_ISOLATION_BEGIN(NULL, NULL, first_table);
+ }
+ else
+ {
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
+ }
+ }
+#endif /* WITH_WSREP */
/*
We WANT to write and we CAN write.
! we write after unlocking the table.