diff options
author | Raghavendra D Prabhu <rprabhu@wnohang.net> | 2015-07-16 05:24:13 -0700 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-02-22 17:59:06 -0500 |
commit | 1077eef94273a87a22d656a2fcd4e47413a29aed (patch) | |
tree | 71cd09bae46d3dd98586e94b499d9a45aa0fcb61 /sql/sql_reload.cc | |
parent | 5be449d014d0bdab4859409860deec669a1f11f3 (diff) | |
download | mariadb-git-1077eef94273a87a22d656a2fcd4e47413a29aed.tar.gz |
PXC-391: Avoid Total Order Isolation (TOI) for LOCAL sql admin commands.
The admin commands in question are:
> OPTIMIZE
> REPAIR
> ANALYZE
For LOCAL or NO_WRITE_TO_BINLOG invocations of these commands, ie
OPTIMIZE LOCAL TABLE <t1>
they are not binlogged as expected.
Also, in addition, they are not executed under TOI.
Hence, they are not propagated to other nodes.
The effect is same as that of wsrep_on=0.
Also added tests for this.
A WSREP_DEBUG for wsrep_register_hton has also been added.
The galera_flush_local test has also been updated for verifying that effects
of NO_WRITE_TO_BINLOG / LOCAL are equivalent to wsrep_on=0 from wsrep
perspective.
(cherry picked from commit 5065122f94a8002d4da231528a46f8d9ddbffdc2)
Conflicts:
sql/sql_admin.cc
sql/sql_reload.cc
sql/wsrep_hton.cc
Diffstat (limited to 'sql/sql_reload.cc')
-rw-r--r-- | sql/sql_reload.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index f3909913c5b..ee05ad7bd36 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -312,6 +312,36 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, } } } +#ifdef WITH_WSREP + if (WSREP(thd) && !thd->lex->no_write_to_binlog + && (options & REFRESH_TABLES) + && !(options & (REFRESH_FOR_EXPORT|REFRESH_READ_LOCK))) + { + /* + This is done here because LOCK TABLES is not replicated in galera, + the upgrade of which is checked above. Hence, done after/if we + are able to upgrade locks. + + Also, note that, in error log with debug you may see + 'thread holds MDL locks at TI' but since this is a flush + tables and is required for LOCK TABLE WRITE + it can be ignored there. + */ + if (tables) + { + if (wsrep_to_isolation_begin(thd, NULL, NULL, tables)) + { + result= 1; + goto cleanup; + } + } + else if (wsrep_to_isolation_begin(thd, WSREP_MYSQL_DB, NULL, NULL)) + { + result= 1; + goto cleanup; + } + } +#endif /* WITH_WSREP */ #ifdef WITH_WSREP if (thd && thd->wsrep_applier) |