From 1077eef94273a87a22d656a2fcd4e47413a29aed Mon Sep 17 00:00:00 2001 From: Raghavendra D Prabhu Date: Thu, 16 Jul 2015 05:24:13 -0700 Subject: 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 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 --- sql/wsrep_hton.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sql/wsrep_hton.cc') diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index c096d2610eb..812d64c8c82 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -69,6 +69,17 @@ void wsrep_register_hton(THD* thd, bool all) { if (thd->wsrep_exec_mode != TOTAL_ORDER && !thd->wsrep_apply_toi) { + if (thd->wsrep_exec_mode == LOCAL_STATE && + (thd_sql_command(thd) == SQLCOM_OPTIMIZE || + thd_sql_command(thd) == SQLCOM_ANALYZE || + thd_sql_command(thd) == SQLCOM_REPAIR) && + thd->lex->no_write_to_binlog == 1) + { + WSREP_DEBUG("Skipping wsrep_register_hton for LOCAL sql admin command : %s", + thd->query()); + return; + } + THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt; for (Ha_trx_info *i= trans->ha_list; WSREP(thd) && i; i = i->next()) { -- cgit v1.2.1