[Commits] a64a8226851: Merge remote-tracking branch 'origin/10.0-galera' into 10.1
revision-id: a64a8226851fbad856d14cf91e8a1ea1159ddfd9 (mariadb-10.1.33-11-ga64a8226851) parent(s): 3b99a274a845edddeb2234108d0978d57f447c3d 215d652c66474c4578b0476385d055e7feae2d3a author: Jan Lindström committer: Jan Lindström timestamp: 2018-05-14 13:18:17 +0300 message: Merge remote-tracking branch 'origin/10.0-galera' into 10.1 .gitignore | 1 + include/my_global.h | 2 + include/mysql/psi/mysql_socket.h | 6 + mysql-test/r/read_only_innodb.result | 8 -- mysql-test/suite/galera/disabled.def | 3 + .../suite/galera/galera_2nodes_as_master_slave.cnf | 83 ------------- .../galera_2nodes_as_master_with_repl_filter.cnf | 87 ------------- mysql-test/suite/galera/r/MW-416.result | 114 ++++++++++++++++++ mysql-test/suite/galera/r/galera#500.result | 10 ++ mysql-test/suite/galera/t/MW-416.test | 134 +++++++++++++++++++++ mysql-test/suite/galera/t/galera#500.test | 38 ++++++ .../suite/galera/t/galera_concurrent_ctas.test | 2 +- .../galera/t/galera_gcache_recover_manytrx.test | 13 +- .../suite/galera/t/galera_many_tables_pk.test | 4 +- .../r/galera_evs_suspect_timeout.result | 1 + .../t/galera_evs_suspect_timeout.test | 1 + mysql-test/suite/wsrep/r/variables.result | 7 ++ mysql-test/suite/wsrep/t/variables.test | 14 +++ mysql-test/t/read_only_innodb.test | 9 -- mysys/my_symlink.c | 2 +- scripts/wsrep_sst_common.sh | 40 ++++-- sql/log.cc | 8 +- sql/slave.cc | 2 +- sql/sql_class.h | 1 + sql/sql_parse.cc | 3 +- sql/sql_trigger.cc | 1 + sql/sys_vars.cc | 13 +- sql/wsrep_hton.cc | 36 ++++-- sql/wsrep_mysqld.cc | 56 +++++---- sql/wsrep_mysqld.h | 2 + sql/wsrep_priv.h | 2 +- storage/innobase/handler/ha_innodb.cc | 64 +++++----- storage/innobase/os/os0file.cc | 8 +- storage/maria/ma_control_file.c | 2 +- storage/maria/ma_loghandler.c | 6 +- storage/maria/ma_open.c | 8 +- storage/myisam/mi_open.c | 8 +- storage/xtradb/handler/ha_innodb.cc | 15 ++- storage/xtradb/os/os0file.cc | 10 +- support-files/mysql.server.sh | 1 - support-files/policy/selinux/mariadb-server.fc | 2 +- support-files/policy/selinux/mariadb-server.te | 2 +- support-files/wsrep.cnf.sh | 3 + 43 files changed, 525 insertions(+), 307 deletions(-) diff --cc .gitignore index c3c140bb99a,a328a85b8cc..45617838c87 --- a/.gitignore +++ b/.gitignore @@@ -120,11 -114,9 +120,12 @@@ scripts/myto scripts/wsrep_sst_common scripts/wsrep_sst_mysqldump scripts/wsrep_sst_rsync + scripts/wsrep_sst_rsync_wan +scripts/wsrep_sst_mariabackup scripts/wsrep_sst_xtrabackup scripts/wsrep_sst_xtrabackup-v2 +scripts/maria_add_gis_sp.sql +scripts/maria_add_gis_sp_bootstrap.sql sql-bench/bench-count-distinct sql-bench/bench-init.pl sql-bench/compare-results diff --cc mysql-test/suite/galera/disabled.def index 513f9ac2c88,fad1e69d4d7..397ad22dab8 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@@ -23,7 -31,23 +23,10 @@@ galera_as_slave_replication_bundle : MD galera_gcache_recover : MDEV-13549 Galera test failures galera_gcache_recover_full_gcache : MDEV-13549 Galera test failures galera_gcache_recover_manytrx : MDEV-13549 Galera test failures -galera_ist_mysqldump : MDEV-13549 Galera test failures -mysql-wsrep#31 : MDEV-13549 Galera test failures -galera_migrate : MariaDB 10.0 does not support START SLAVE USER -galera_concurrent_ctas : MDEV-13549 Galera test failures -galera_bf_abort_for_update : MDEV-13549 Galera test failures -galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures galera_ssl_upgrade : MDEV-13549 Galera test failures -mysql-wsrep#33 : MDEV-13549 Galera test failures -galera_var_auto_inc_control_on : MDEV-13549 Galera test failures -MW-44 : MDEV-13549 Galera test failures -galera_var_retry_autocommit : MDEV-13549 Galera test failures -pxc-421 : MDEV-13549 Galera test failures -lp1376747-2 : MDEV-13549 Galera test failures -lp1376747 : MDEV-13549 Galera test failures -galera_toi_ddl_nonconflicting : MDEV-13549 Galera test failures -galera_parallel_simple : MDEV-13549 Galera test failures -galera_admin : MDEV-13549 Galera test failures +galera.MW-329 : wsrep_local_replays not stable +galera.MW-328A : have_deadlocks test not stable +query_cache : MDEV-15805 Test failure on galera.query_cache + MW-416 : MDEV-13549 Galera test failures + galera_wan : MDEV-13549 Galera test failures + MW-388 : MDEV-13549 Galera test failures diff --cc mysql-test/suite/galera/t/galera_concurrent_ctas.test index 6c4e8be68a7,8b9b461d0fd..13dc9fea079 --- a/mysql-test/suite/galera/t/galera_concurrent_ctas.test +++ b/mysql-test/suite/galera/t/galera_concurrent_ctas.test @@@ -44,9 -44,9 +44,9 @@@ while($run { --error 0,1 exec $MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_1 test \ - < $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql & \ - $MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_2 test \ + < $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql & \ + $MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_2 test \ - < $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql; + < $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql; dec $run; } diff --cc scripts/wsrep_sst_common.sh index 47d9021fe55,d20e3bc36c9..54d8cfb9e8e --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@@ -126,17 -129,17 +133,28 @@@ don readonly WSREP_SST_OPT_BYPASS readonly WSREP_SST_OPT_BINLOG + if [ -n "${WSREP_SST_OPT_ADDR_PORT:-}" ]; then + if [ -n "${WSREP_SST_OPT_PORT:-}" ]; then + if [ "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then + echo "WSREP_SST: [ERROR] port in --port=$WSREP_SST_OPT_PORT differs from port in --address=$WSREP_SST_OPT_ADDR" >&2 + exit 2 + fi + else + readonly WSREP_SST_OPT_PORT="$WSREP_SST_OPT_ADDR_PORT" + fi + fi + +if [ -n "${WSREP_SST_OPT_ADDR:-}" ]; then + if [ -n "${WSREP_SST_OPT_PORT:-}" ]; then + if [ -n "$WSREP_SST_OPT_ADDR_PORT" -a "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then + wsrep_log_error "port in --port=$WSREP_SST_OPT_PORT differs from port in --address=$WSREP_SST_OPT_ADDR" + exit 2 + fi + else + readonly WSREP_SST_OPT_PORT="$WSREP_SST_OPT_ADDR_PORT" + fi +fi + # try to use my_print_defaults, mysql and mysqldump that come with the sources # (for MTR suite) SCRIPTS_DIR="$(cd $(dirname "$0"); pwd -P)" diff --cc sql/slave.cc index ed679dfdf80,3dee39ad65f..6fe6de6872a --- a/sql/slave.cc +++ b/sql/slave.cc @@@ -5126,9 -4948,9 +5126,9 @@@ err_during_init If slave stopped due to node going non primary, we set global flag to trigger automatic restart of slave when node joins back to cluster. */ - if (wsrep_node_dropped && wsrep_restart_slave) + if (WSREP_ON && wsrep_node_dropped && wsrep_restart_slave) { - if (wsrep_ready) + if (wsrep_ready_get()) { WSREP_INFO("Slave error due to node temporarily non-primary" "SQL slave will continue"); diff --cc sql/sql_parse.cc index f83e51409ab,c353c50d8c0..3e84efd407f --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@@ -3963,13 -3783,9 +3964,13 @@@ end_with_restore_list case SQLCOM_INSERT_SELECT: { WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE); - select_result *sel_result; + select_insert *sel_result; bool explain= MY_TEST(lex->describe); DBUG_ASSERT(first_table == all_tables && first_table != 0); + if (WSREP_CLIENT(thd) && + wsrep_sync_wait(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE)) + goto error; + if ((res= insert_precheck(thd, all_tables))) break; #ifdef WITH_WSREP diff --cc sql/sys_vars.cc index 9f87d66fef1,2348cb4d45d..cf5cfa8b9a4 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@@ -4891,12 -4642,11 +4891,19 @@@ static Sys_var_mybool Sys_wsrep_sst_don GLOBAL_VAR(wsrep_sst_donor_rejects_queries), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); ++static bool wsrep_on_check_super(sys_var *self, THD* thd, set_var *var) ++{ ++ if (check_has_super(self, thd, var)) ++ return true; ++ return (wsrep_on_check(self, thd, var)); ++} ++ static Sys_var_mybool Sys_wsrep_on ( "wsrep_on", "To enable wsrep replication ", SESSION_VAR(wsrep_on), - CMD_LINE(OPT_ARG), DEFAULT(TRUE), - NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super), + CMD_LINE(OPT_ARG), DEFAULT(FALSE), + NO_MUTEX_GUARD, NOT_IN_BINLOG, - ON_CHECK(wsrep_on_check), ++ ON_CHECK(wsrep_on_check_super), ON_UPDATE(wsrep_on_update)); static Sys_var_charptr Sys_wsrep_start_position ( @@@ -4942,9 -4690,9 +4949,9 @@@ static Sys_var_mybool Sys_wsrep_causal_ static Sys_var_uint Sys_wsrep_sync_wait( "wsrep_sync_wait", "Ensure \"synchronous\" read view before executing " "an operation of the type specified by bitmask: 1 - READ(includes " - "SELECT, SHOW and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - " - "INSERT and REPLACE", + "SELECT and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - " + "INSERT and REPLACE; 8 - SHOW", - SESSION_VAR(wsrep_sync_wait), CMD_LINE(OPT_ARG), + SESSION_VAR(wsrep_sync_wait), CMD_LINE(OPT_ARG, OPT_WSREP_SYNC_WAIT), VALID_RANGE(WSREP_SYNC_WAIT_NONE, WSREP_SYNC_WAIT_MAX), DEFAULT(WSREP_SYNC_WAIT_NONE), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), diff --cc sql/wsrep_mysqld.cc index 08a32f943f5,bd397a9a012..f1ea0a10e4f --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@@ -11,8 -11,9 +11,9 @@@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ + #include <sql_plugin.h> // SHOW_MY_BOOL #include <mysqld.h> #include <sql_class.h> #include <sql_parse.h> @@@ -478,17 -413,8 +496,8 @@@ void wsrep_ready_wait ( static void wsrep_synced_cb(void* app_ctx) { WSREP_INFO("Synchronized with group, ready for connections"); - bool signal_main= false; - if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); - if (!wsrep_ready) - { - wsrep_ready= TRUE; - mysql_cond_signal (&COND_wsrep_ready); - signal_main= true; - - } + my_bool signal_main= wsrep_ready_set(TRUE); - local_status.set(WSREP_MEMBER_SYNCED); + wsrep_config_state.set(WSREP_MEMBER_SYNCED); - mysql_mutex_unlock (&LOCK_wsrep_ready); if (signal_main) { @@@ -1007,17 -867,7 +1018,16 @@@ bool wsrep_sync_wait (THD* thd, uint ma return false; } +/* + * Helpers to deal with TOI key arrays + */ +typedef struct wsrep_key_arr +{ + wsrep_key_t* keys; + size_t keys_len; +} wsrep_key_arr_t; + - - static void wsrep_keys_free(wsrep_key_arr_t* key_arr) + void wsrep_keys_free(wsrep_key_arr_t* key_arr) { for (size_t i= 0; i < key_arr->keys_len; ++i) { @@@ -1814,9 -1681,9 +1824,9 @@@ wsrep_grant_mdl_exception(MDL_context * } else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) { - WSREP_DEBUG("DROP caused BF abort"); + WSREP_DEBUG("DROP caused BF abort, conf %d", granted_thd->wsrep_conflict_state); ticket->wsrep_report(wsrep_debug); - mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); + mysql_mutex_unlock(&granted_thd->LOCK_thd_data); wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); ret = FALSE; } diff --cc sql/wsrep_mysqld.h index 57630ed8284,94c97f04aab..eeed9c6a297 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@@ -128,16 -139,12 +128,17 @@@ extern const char* wsrep_provider_name extern const char* wsrep_provider_version; extern const char* wsrep_provider_vendor; -int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff); +int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff, + enum enum_var_type scope); + int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff); -void wsrep_free_status(THD *thd); - int wsrep_init(); void wsrep_deinit(bool free_options); + +/* Initialize wsrep thread LOCKs and CONDs */ +void wsrep_thr_init(); +/* Destroy wsrep thread LOCKs and CONDs */ +void wsrep_thr_deinit(); + void wsrep_recover(); bool wsrep_before_SE(); // initialize wsrep before storage // engines (true) or after (false) @@@ -234,8 -258,18 +235,9 @@@ extern wsrep_seqno_t wsrep_locked_seqno #define WSREP_QUERY(thd) (thd->query()) + extern my_bool wsrep_ready_get(); extern void wsrep_ready_wait(); -enum wsrep_trx_status { - WSREP_TRX_OK, - WSREP_TRX_CERT_FAIL, /* certification failure, must abort */ - WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */ - WSREP_TRX_ERROR, /* native mysql error */ -}; - -extern enum wsrep_trx_status -wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all); class Ha_trx_info; struct THD_TRANS; void wsrep_register_hton(THD* thd, bool all); diff --cc storage/innobase/handler/ha_innodb.cc index 961166fed9a,ec039915121..241d5e1ade9 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@@ -8436,14 -8005,12 +8440,14 @@@ report_error user_thd); #ifdef WITH_WSREP - if (!error_result && - wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && - wsrep_on(user_thd) && - !wsrep_consistency_check(user_thd) && - !wsrep_thd_ignore_table(user_thd)) + if (!error_result + && wsrep_on(user_thd) + && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE + && !wsrep_consistency_check(user_thd) - && !wsrep_thd_skip_append_keys(user_thd)) { - if (wsrep_append_keys(user_thd, false, record, NULL)) { ++ && !wsrep_thd_ignore_table(user_thd)) + { + if (wsrep_append_keys(user_thd, false, record, NULL)) + { DBUG_PRINT("wsrep", ("row key failed")); error_result = HA_ERR_INTERNAL_ERROR; goto wsrep_error; @@@ -18609,14 -17687,15 +18613,16 @@@ wsrep_innobase_kill_one_trx WSREP_LOG_CONFLICT(bf_thd, thd, TRUE); - WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: %lu", + WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: " + TRX_ID_FMT, signal, (long long)bf_seqno, - wsrep_thd_thread_id(thd), + thd_get_thread_id(thd), victim_trx->id); - WSREP_DEBUG("Aborting query: %s", - (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void"); + WSREP_DEBUG("Aborting query: %s conf %d trx: %lu", + (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void", - wsrep_thd_conflict_state(thd), ++ wsrep_thd_get_conflict_state(thd), + wsrep_thd_ws_handle(thd)->trx_id); wsrep_thd_LOCK(thd); DBUG_EXECUTE_IF("sync.wsrep_after_BF_victim_lock", @@@ -18676,10 -17754,9 +18682,10 @@@ wsrep_abort_slave_trx(bf_seqno, wsrep_thd_trx_seqno(thd)); } else { + wsrep_t *wsrep= get_wsrep(); rcode = wsrep->abort_pre_commit( wsrep, bf_seqno, - (wsrep_trx_id_t)victim_trx->id + (wsrep_trx_id_t)wsrep_thd_ws_handle(thd)->trx_id ); switch (rcode) { @@@ -18802,12 -17894,14 +18808,14 @@@ wsrep_abort_transaction my_bool signal) { DBUG_ENTER("wsrep_innobase_abort_thd"); - trx_t* victim_trx = thd_to_trx(victim_thd); - trx_t* bf_trx = (bf_thd) ? thd_to_trx(bf_thd) : NULL; + + trx_t* victim_trx = thd_to_trx(victim_thd); + trx_t* bf_trx = (bf_thd) ? thd_to_trx(bf_thd) : NULL; - WSREP_DEBUG("abort transaction: BF: %s victim: %s", - wsrep_thd_query(bf_thd), - wsrep_thd_query(victim_thd)); + WSREP_DEBUG("abort transaction: BF: %s victim: %s victim conf: %d", + wsrep_thd_query(bf_thd), + wsrep_thd_query(victim_thd), - wsrep_thd_conflict_state(victim_thd)); ++ wsrep_thd_get_conflict_state(victim_thd)); if (victim_trx) { lock_mutex_enter(); diff --cc storage/innobase/os/os0file.cc index 81614549702,d4b8e82b0d8..cf4645458cc --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@@ -1604,9 -1428,9 +1604,9 @@@ os_file_create_simple_no_error_handling return(file); } - file = open(name, create_flag, os_innodb_umask); - file.m_file = ::open(name, create_flag | O_CLOEXEC, os_innodb_umask); ++ file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); - *success = file.m_file == -1 ? FALSE : TRUE; + *success = file != -1; /* This function is always called for data files, we should disable OS caching (O_DIRECT) here as we do in os_file_create_func(), so @@@ -1969,9 -1755,9 +1969,9 @@@ os_file_create_func #endif /* O_SYNC */ do { - file = open(name, create_flag, os_innodb_umask); - file.m_file = ::open(name, create_flag | O_CLOEXEC, os_innodb_umask); ++ file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); - if (file.m_file == -1) { + if (file == -1) { const char* operation; operation = (create_mode == OS_FILE_CREATE diff --cc storage/xtradb/handler/ha_innodb.cc index 238627ce003,2548c821aac..290ff59d0ff --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@@ -9022,14 -8730,12 +9027,14 @@@ report_error user_thd); #ifdef WITH_WSREP - if (!error_result && - wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && - wsrep_on(user_thd) && - !wsrep_consistency_check(user_thd) && - !wsrep_thd_ignore_table(user_thd)) + if (!error_result + && wsrep_on(user_thd) - && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE ++ && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE + && !wsrep_consistency_check(user_thd) - && !wsrep_thd_skip_append_keys(user_thd)) { - if (wsrep_append_keys(user_thd, false, record, NULL)) { ++ && !wsrep_thd_ignore_table(user_thd)) + { + if (wsrep_append_keys(user_thd, false, record, NULL)) + { DBUG_PRINT("wsrep", ("row key failed")); error_result = HA_ERR_INTERNAL_ERROR; goto wsrep_error; diff --cc storage/xtradb/os/os0file.cc index 6a63f31b37a,b4fafb127ec..7df42a37b4a --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@@ -1730,9 -1577,9 +1730,9 @@@ os_file_create_simple_no_error_handling return(file); } - file = open(name, create_flag, os_innodb_umask); - file.m_file = ::open(name, create_flag | O_CLOEXEC , os_innodb_umask); ++ file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); - *success = file.m_file == -1 ? FALSE : TRUE; + *success = file != -1; /* This function is always called for data files, we should disable OS caching (O_DIRECT) here as we do in os_file_create_func(), so @@@ -2145,9 -1959,9 +2145,9 @@@ os_file_create_func #endif /* O_SYNC */ do { - file = open(name, create_flag, os_innodb_umask); - file.m_file = ::open(name, create_flag | O_CLOEXEC, os_innodb_umask); ++ file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); - if (file.m_file == -1) { + if (file == -1) { const char* operation; operation = (create_mode == OS_FILE_CREATE
participants (1)
-
jan