[Commits] 2af362f8bd7: Dev commit.
revision-id: 2af362f8bd73ab259cc7458e883db6b0d9ea99cf (mariadb-10.1.37-81-g2af362f8bd7) parent(s): 100fd3e4c66a6e066e1ba5e2b1dafccbee301c2e author: Jan Lindström committer: Jan Lindström timestamp: 2019-02-01 14:50:17 +0200 message: Dev commit. --- include/mysql/service_wsrep.h | 3 +++ mysql-test/suite/galera/t/galera_kill_applier.cnf | 10 ++++++++++ mysql-test/suite/galera/t/galera_kill_applier.test | 14 ++++++-------- sql/sql_plugin_services.ic | 3 ++- sql/wsrep_dummy.cc | 3 +++ sql/wsrep_mysqld.cc | 1 - sql/wsrep_thd.cc | 9 +++++++++ storage/innobase/handler/ha_innodb.cc | 6 ++++-- storage/innobase/include/trx0trx.h | 4 ++-- storage/innobase/trx/trx0trx.cc | 3 +++ storage/xtradb/handler/ha_innodb.cc | 6 ++++-- storage/xtradb/include/trx0trx.h | 4 ++-- storage/xtradb/trx/trx0trx.cc | 2 ++ 13 files changed, 50 insertions(+), 18 deletions(-) diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index b51f154422f..6a83feaff55 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -111,6 +111,7 @@ extern struct wsrep_service_st { int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD); void (*wsrep_unlock_rollback_func)(); void (*wsrep_set_data_home_dir_func)(const char *data_dir); + my_bool (*wsrep_thd_is_applier_func)(THD *thd); } *wsrep_service; #ifdef MYSQL_DYNAMIC_PLUGIN @@ -153,6 +154,7 @@ extern struct wsrep_service_st { #define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2) #define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func() #define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A) +#define wsrep_thd_is_applier(T) wsrep_service->wsrep_thd_is_applier_func(T) #define wsrep_debug get_wsrep_debug() #define wsrep_log_conflicts get_wsrep_log_conflicts() @@ -211,6 +213,7 @@ void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state); bool wsrep_thd_ignore_table(THD *thd); void wsrep_unlock_rollback(); void wsrep_set_data_home_dir(const char *data_dir); +my_bool wsrep_thd_is_applier(THD *thd); #endif diff --git a/mysql-test/suite/galera/t/galera_kill_applier.cnf b/mysql-test/suite/galera/t/galera_kill_applier.cnf new file mode 100644 index 00000000000..f2563e66f2e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_kill_applier.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +auto_increment_offset=1 + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +auto_increment_offset=2 + diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test index 48a411d2cf2..5e4a587fe57 100644 --- a/mysql-test/suite/galera/t/galera_kill_applier.test +++ b/mysql-test/suite/galera/t/galera_kill_applier.test @@ -39,17 +39,10 @@ GRANT SELECT on test.* TO foo@localhost; # --connection node_2 ---disable_query_log ---eval KILL $applier_thread ---enable_query_log - ---source include/restart_mysqld.inc - ---connection node_2 --let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE != 'wsrep aborter idle' OR STATE IS NULL LIMIT 1` --disable_query_log ---eval KILL QUERY $applier_thread +--eval KILL $applier_thread --enable_query_log --let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` @@ -61,6 +54,11 @@ GRANT SELECT on test.* TO foo@localhost; --source include/restart_mysqld.inc --connection node_2 +--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE != 'wsrep aborter idle' OR STATE IS NULL LIMIT 1` + +--disable_query_log +--eval KILL QUERY $applier_thread +--enable_query_log --let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic index 95301a5fbe8..a0d42c04dba 100644 --- a/sql/sql_plugin_services.ic +++ b/sql/sql_plugin_services.ic @@ -180,7 +180,8 @@ static struct wsrep_service_st wsrep_handler = { wsrep_trx_is_aborting, wsrep_trx_order_before, wsrep_unlock_rollback, - wsrep_set_data_home_dir + wsrep_set_data_home_dir, + wsrep_thd_is_applier, }; static struct thd_specifics_service_st thd_specifics_handler= diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc index 5837ab4bed5..1f130e2b9a2 100644 --- a/sql/wsrep_dummy.cc +++ b/sql/wsrep_dummy.cc @@ -20,6 +20,9 @@ my_bool wsrep_thd_is_BF(THD *, my_bool) { return 0; } +my_bool wsrep_thd_is_applier(THD *) +{ return 0; } + int wsrep_trx_order_before(THD *, THD *) { return 0; } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 47aea6d3824..85112967b7b 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2469,7 +2469,6 @@ extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode) thd->wsrep_exec_mode= mode; } - extern "C" void wsrep_thd_set_query_state( THD *thd, enum wsrep_query_state state) { diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index eb26da61282..492a3b67c68 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -596,6 +596,15 @@ my_bool wsrep_thd_is_BF(THD *thd, my_bool sync) return status; } +my_bool wsrep_thd_is_applier(THD *thd) +{ + my_bool ret = FALSE; + if (thd) { + ret = thd->wsrep_applier; + } + return ret; +} + extern "C" my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync) { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 702f84a52d1..ca76c31cb68 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4928,7 +4928,8 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) break; #endif case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { + if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE) + || wsrep_thd_is_applier(trx->mysql_thd)) { lock_mutex_enter(); } /* fall through */ @@ -4943,7 +4944,8 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) break; #endif case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { + if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE) + || wsrep_thd_is_applier(trx->mysql_thd)) { lock_mutex_exit(); } /* fall through */ diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index fe16b8272b8..33d2442c471 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -698,9 +698,9 @@ lock_sys->mutex and sometimes by trx->mutex. */ enum trx_abort_t { TRX_SERVER_ABORT = 0, #ifdef WITH_WSREP - TRX_WSREP_ABORT, + TRX_WSREP_ABORT = 1, #endif - TRX_REPLICATION_ABORT + TRX_REPLICATION_ABORT = 2 }; struct trx_t{ diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index f36aabba8b4..88b56f7efb7 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -168,6 +168,9 @@ trx_create(void) #ifdef WITH_WSREP trx->wsrep_event = NULL; #endif /* WITH_WSREP */ + + trx->abort_type = TRX_SERVER_ABORT; + return(trx); } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index d3be5155d27..86299432244 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -5532,7 +5532,8 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) break; #endif case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { + if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE) + || wsrep_thd_is_applier(trx->mysql_thd)) { lock_mutex_enter(); } /* fall through */ @@ -5547,7 +5548,8 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) break; #endif case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { + if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE) + || wsrep_thd_is_applier(trx->mysql_thd)) { lock_mutex_exit(); } /* fall through */ diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index 77afde4c35c..0390b1a838a 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -747,9 +747,9 @@ lock_sys->mutex and sometimes by trx->mutex. */ enum trx_abort_t { TRX_SERVER_ABORT = 0, #ifdef WITH_WSREP - TRX_WSREP_ABORT, + TRX_WSREP_ABORT = 1, #endif - TRX_REPLICATION_ABORT + TRX_REPLICATION_ABORT = 2 }; struct trx_t{ diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index 17cba81daf3..3a594dac4ce 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -304,6 +304,8 @@ trx_create(void) trx->wsrep_event = NULL; #endif /* WITH_WSREP */ + trx->abort_type = TRX_SERVER_ABORT; + return(trx); }
participants (1)
-
jan