From 1eb364f8b3d623fdeca96a7ecf4a315282c83716 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 10 Oct 2018 17:16:34 +0200 Subject: [PATCH 01/28] MDEV-17421: mtr does not restart the server whose parameters were changed If a mtr test runs multiple servers and only some of them get restarted on whatever reason with new command-line parameters, then subsequent mtr test may fail, because no cleanup is performed. Replication and Galera test suites are affected. In the mtr script, there is a server_need_restart function that decides whether we need to start a new mysqld process before the new (next) test. If the mysqld parameters were changed in the previous test - not necessarily the parameters of the primary mysqld server, maybe even the secondary server parameters - this function decides to start a new mysqld process. But since it does not remove the old (changed) parameters, the new process starts with the parameters changed by the *previous* test. To correct this error, we must delete the modified process parameters after checking that they have been changed during the previous test. This patch also simplifies and makes more stable the galera_drop_database test, during debugging of which this problem was detected. https://jira.mariadb.org/browse/MDEV-17421 --- mysql-test/mysql-test-run.pl | 1 + mysql-test/suite/galera/disabled.def | 1 - .../galera/r/galera_mtr_restart_t1.result | 1 + .../galera/r/galera_mtr_restart_t2.result | 1 + .../suite/galera/t/galera_drop_database.test | 26 +++----------- .../suite/galera/t/galera_mtr_restart_t1.test | 35 +++++++++++++++++++ .../suite/galera/t/galera_mtr_restart_t2.test | 13 +++++++ mysql-test/suite/rpl/r/mtr_restart_t1.result | 5 +++ mysql-test/suite/rpl/r/mtr_restart_t2.result | 4 +++ mysql-test/suite/rpl/t/mtr_restart_t1.test | 31 ++++++++++++++++ mysql-test/suite/rpl/t/mtr_restart_t2.test | 18 ++++++++++ 11 files changed, 113 insertions(+), 23 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_mtr_restart_t1.result create mode 100644 mysql-test/suite/galera/r/galera_mtr_restart_t2.result create mode 100644 mysql-test/suite/galera/t/galera_mtr_restart_t1.test create mode 100644 mysql-test/suite/galera/t/galera_mtr_restart_t2.test create mode 100644 mysql-test/suite/rpl/r/mtr_restart_t1.result create mode 100644 mysql-test/suite/rpl/r/mtr_restart_t2.result create mode 100644 mysql-test/suite/rpl/t/mtr_restart_t1.test create mode 100644 mysql-test/suite/rpl/t/mtr_restart_t2.test diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d969d7bf9f6..d3ffd16987d 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5282,6 +5282,7 @@ sub server_need_restart { exists $server->{'restart_opts'}) { my $use_dynamic_option_switch= 0; + delete $server->{'restart_opts'}; if (!$use_dynamic_option_switch) { mtr_verbose_restart($server, "running with different options '" . diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 603031f52b7..464ed6444f9 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -34,4 +34,3 @@ partition : MDEV-13881 galera.partition failed in buildbot with wrong result galera_as_slave_replication_budle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion galera_wan : MDEV-17259: Test failure on galera.galera_wan galera_pc_ignore_sb : MDEV-17357 Test failure on galera.galera_pc_ignore_sb -galera_drop_database : test diff --git a/mysql-test/suite/galera/r/galera_mtr_restart_t1.result b/mysql-test/suite/galera/r/galera_mtr_restart_t1.result new file mode 100644 index 00000000000..c628a99f1e8 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_mtr_restart_t1.result @@ -0,0 +1 @@ +weight=111 diff --git a/mysql-test/suite/galera/r/galera_mtr_restart_t2.result b/mysql-test/suite/galera/r/galera_mtr_restart_t2.result new file mode 100644 index 00000000000..0d488f3d174 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_mtr_restart_t2.result @@ -0,0 +1 @@ +weight=1 diff --git a/mysql-test/suite/galera/t/galera_drop_database.test b/mysql-test/suite/galera/t/galera_drop_database.test index 47fe8315198..12d9efea2f9 100644 --- a/mysql-test/suite/galera/t/galera_drop_database.test +++ b/mysql-test/suite/galera/t/galera_drop_database.test @@ -9,6 +9,7 @@ --let $node_2=node_2 --source include/auto_increment_offset_save.inc +# Create test database with two sets of the FTS indexes: CREATE DATABASE fts; USE fts; CREATE TABLE fts_t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; @@ -23,34 +24,19 @@ DROP TABLE ten; UPDATE fts_t1 SET f2 = 'abcd'; UPDATE fts_t2 SET f2 = 'efjh'; +# Restart the second node: --connection node_2 -let $wsrep_cluster_address = `SELECT @@global.wsrep_node_incoming_address`; --source include/restart_mysqld.inc --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc ---let $galera_connection_name = node_2a ---let $galera_server_number = 2 ---source include/galera_connect.inc ---connection node_2a +--connection node_2 --source include/wait_until_ready.inc +# Drop the tables and database after nodes restarted: --connection node_1 ---let $restart_parameters = --wsrep-cluster-address=gcomm://$wsrep_cluster_address ---source include/restart_mysqld.inc - ---connection node_2a ---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ---source include/wait_condition.inc - ---let $galera_connection_name = node_1a ---let $galera_server_number = 1 ---source include/galera_connect.inc ---connection node_1a ---source include/wait_until_ready.inc - USE fts; DROP TABLE fts_t1; DROP TABLE fts_t2; @@ -58,8 +44,4 @@ SHOW TABLES; DROP DATABASE fts; # Restore original auto_increment_offset values. ---let $node_1=node_1a ---let $node_2=node_2a --source include/auto_increment_offset_restore.inc - ---source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_mtr_restart_t1.test b/mysql-test/suite/galera/t/galera_mtr_restart_t1.test new file mode 100644 index 00000000000..563d199625a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_mtr_restart_t1.test @@ -0,0 +1,35 @@ +# This test verifies that mtr will restart the mysqld process, +# whose parameters were changed during the test. The verification +# itself is carried out in the following galera_mtr_restart_t2 +# test. If mtr restart the mysqld process, then the pc.weight +# value will be reset to the default ("1"), but if there is no +# restart, then we will see the changed value ("111") during +# the next test. +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 +--let $restart_parameters = --wsrep_provider_options=pc.weight=111;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S +--source include/restart_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +--source include/wait_until_ready.inc + +# Check that the parameter value really changed: +--let $gp = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))` +--let $weight = `SELECT SUBSTR('$gp', 1, LOCATE(';', '$gp') - 1)` +--echo weight=$weight + +# Restore original auto_increment_offset values. +--connection node_1 +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_mtr_restart_t2.test b/mysql-test/suite/galera/t/galera_mtr_restart_t2.test new file mode 100644 index 00000000000..fcc1d0515a6 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_mtr_restart_t2.test @@ -0,0 +1,13 @@ +# This test verifies that mtr will restart the mysqld process, +# whose parameters were changed during the previous test. If mtr +# restart the mysqld process, then the pc.weight value will be +# reset to the default ("1"), but if there is no restart, then +# we will see the changed value ("111") in this test. +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_2 +--let $gp = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))` +--let $weight = `SELECT SUBSTR('$gp', 1, LOCATE(';', '$gp') - 1)` +--echo weight=$weight diff --git a/mysql-test/suite/rpl/r/mtr_restart_t1.result b/mysql-test/suite/rpl/r/mtr_restart_t1.result new file mode 100644 index 00000000000..56b64a2fc70 --- /dev/null +++ b/mysql-test/suite/rpl/r/mtr_restart_t1.result @@ -0,0 +1,5 @@ +include/master-slave.inc +[connection master] +include/rpl_stop_server.inc [server_number=1] +new auto_increment_offset=111 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/mtr_restart_t2.result b/mysql-test/suite/rpl/r/mtr_restart_t2.result new file mode 100644 index 00000000000..3c8fe59d607 --- /dev/null +++ b/mysql-test/suite/rpl/r/mtr_restart_t2.result @@ -0,0 +1,4 @@ +include/master-slave.inc +[connection master] +auto_increment_offset=1 +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/mtr_restart_t1.test b/mysql-test/suite/rpl/t/mtr_restart_t1.test new file mode 100644 index 00000000000..3003a49c424 --- /dev/null +++ b/mysql-test/suite/rpl/t/mtr_restart_t1.test @@ -0,0 +1,31 @@ +# This test verifies that mtr will restart the mysqld process, +# whose parameters were changed during the test. The verification +# itself is carried out in the following mtr_restart_t2 test. +# If mtr restart the mysqld process, then the auto_increment_offset +# parameter value will be reset to the default ("1"), but if there +# is no restart, then we will see the changed value ("111") during +# the next test. +# +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +connection master; + +let $auto_increment_offset = `SELECT @@global.auto_increment_offset`; + +--let $rpl_server_number=1 +source include/rpl_stop_server.inc; +--let $rpl_server_parameters=--auto-increment-offset=111 +--let $keep_include_silent=1 +source include/rpl_start_server.inc; +--let $keep_include_silent=0 + +let $auto_increment_offset_new = `SELECT @@global.auto_increment_offset`; +--echo new auto_increment_offset=$auto_increment_offset_new + +--disable_query_log +--eval SET @@global.auto_increment_offset = $auto_increment_offset; +--enable_query_log + +--connection master +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/mtr_restart_t2.test b/mysql-test/suite/rpl/t/mtr_restart_t2.test new file mode 100644 index 00000000000..ab246af6b44 --- /dev/null +++ b/mysql-test/suite/rpl/t/mtr_restart_t2.test @@ -0,0 +1,18 @@ +# This test verifies that mtr will restart the mysqld process, +# whose parameters were changed during the previous test. If mtr +# restart the mysqld process, then the auto_increment_offsert +# parameter value will be reset to the default ("1"), but if there +# is no restart, then we will see the changed value ("111") in +# this test. +# +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +connection master; + +let $auto_increment_offset = `SELECT @@global.auto_increment_offset`; + +--echo auto_increment_offset=$auto_increment_offset + +--connection master +--source include/rpl_end.inc From 2061e00c200cc994130c00d58632aecba336273b Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Thu, 17 Jan 2019 22:56:12 +0200 Subject: [PATCH 02/28] MDEV-14440: Assertion `inited==RND' failed in handler::ha_rnd_end In the function QUICK_RANGE_SELECT::init_ror_merged_scan we create a seperate handler if the handler in head->file cannot be reused. The flag free_file tells us if we have a seperate handler or not. There are cases where you might create a handler and then there might be a failure(running ALTER) and then we have to revert the handler back to the original one. The code does that but it does not reset the flag 'free_file' in this case. Also backported f2c418079def. --- mysql-test/r/range_innodb.result | 24 ++++++++++++++++++++++++ mysql-test/t/range_innodb.test | 25 +++++++++++++++++++++++++ sql/opt_range.cc | 3 +++ 3 files changed, 52 insertions(+) diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result index 8bb1c833a56..6572b248911 100644 --- a/mysql-test/r/range_innodb.result +++ b/mysql-test/r/range_innodb.result @@ -55,3 +55,27 @@ pk f1 f2 f3 pk f1 f2 f3 f4 f5 2 6 v NULL 14 1 q NULL 4 q 3 7 c NULL 14 1 q NULL 4 q drop table t1,t2; +# +# MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND' +# failed in handler::ha_rnd_end upon SELECT from partitioned table +# +set @optimizer_switch_save= @@optimizer_switch; +set optimizer_switch='index_merge_sort_intersection=off'; +create table t0 (a int)engine=innodb; +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +a int, b int, c int, +key(a),key(b),key(c) +)engine=innodb; +insert into t1 +select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a +from t0 A, t0 B, t0 C, t0 D where D.a<5; +set @@global.debug_dbug="+d,ha_index_init_fail"; +explain select * from t1 where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +select * from t1 where a=10 and b=10; +ERROR HY000: Table definition has changed, please retry transaction +DROP TABLE t0,t1; +set @@global.debug_dbug="-d"; +set @@optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test index 605006587cc..a17ef3f1146 100644 --- a/mysql-test/t/range_innodb.test +++ b/mysql-test/t/range_innodb.test @@ -3,6 +3,7 @@ --echo # --source include/have_innodb.inc +--source include/have_debug.inc --disable_warnings drop table if exists t0, t1, t2; @@ -62,3 +63,27 @@ INSERT INTO t2 VALUES (4,'q'),(NULL,'j'); SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2 WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 ); drop table t1,t2; + +--echo # +--echo # MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND' +--echo # failed in handler::ha_rnd_end upon SELECT from partitioned table +--echo # + +set @optimizer_switch_save= @@optimizer_switch; +set optimizer_switch='index_merge_sort_intersection=off'; +create table t0 (a int)engine=innodb; +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( + a int, b int, c int, + key(a),key(b),key(c) +)engine=innodb; +insert into t1 +select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a +from t0 A, t0 B, t0 C, t0 D where D.a<5; +set @@global.debug_dbug="+d,ha_index_init_fail"; +explain select * from t1 where a=10 and b=10; +--error ER_TABLE_DEF_CHANGED +select * from t1 where a=10 and b=10; +DROP TABLE t0,t1; +set @@global.debug_dbug="-d"; +set @@optimizer_switch= @optimizer_switch_save; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index b1f8366d83b..ef40e0b6daa 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2161,6 +2161,7 @@ failure: head->column_bitmaps_set(save_read_set, save_write_set); delete file; file= save_file; + free_file= false; DBUG_RETURN(1); } @@ -7140,6 +7141,8 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree, if (ror_intersect_add(intersect, cpk_scan, TRUE) && (intersect->total_cost < min_cost)) intersect_best= intersect; //just set pointer here + else + cpk_scan= 0; // Don't use cpk_scan } else cpk_scan= 0; // Don't use cpk_scan From 2084cd542275db4b1ed178dd3160535c71a2314a Mon Sep 17 00:00:00 2001 From: Geoff Montee Date: Mon, 21 Jan 2019 05:42:00 -0500 Subject: [PATCH 03/28] MDEV-17973: Don't overwrite xtrabackup-v2/mariabackup SST logs by default --- scripts/wsrep_sst_mariabackup.sh | 78 ++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index d9fbae8c5e8..70bd76a36eb 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -90,6 +90,9 @@ DATA="${WSREP_SST_OPT_DATA}" INFO_FILE="xtrabackup_galera_info" IST_FILE="xtrabackup_ist" MAGIC_FILE="${DATA}/${INFO_FILE}" +INNOAPPLYLOG="${DATA}/mariabackup.prepare.log" +INNOMOVELOG="${DATA}/mariabackup.move.log" +INNOBACKUPLOG="${DATA}/mariabackup.backup.log" # Setting the path for ss and ip export PATH="/usr/sbin:/sbin:$PATH" @@ -356,6 +359,8 @@ read_cnf() ssyslog=$(parse_cnf sst sst-syslog 0) ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}") ssystag+="-" + sstlogarchive=$(parse_cnf sst sst-log-archive 1) + sstlogarchivedir=$(parse_cnf sst sst-log-archive-dir "/tmp/sst_log_archive") if [[ $speciald -eq 0 ]];then wsrep_log_error "sst-special-dirs equal to 0 is not supported, falling back to 1" @@ -712,10 +717,68 @@ if [[ $ssyslog -eq 1 ]];then INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" fi -else - INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" - INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log" - INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log" +else + +if [[ "$sstlogarchive" -eq 1 ]] +then + ARCHIVETIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S") + newfile="" + + if [[ ! -z "$sstlogarchivedir" ]] + then + if [[ ! -d "$sstlogarchivedir" ]] + then + mkdir -p "$sstlogarchivedir" + fi + fi + + if [ -e "${INNOAPPLYLOG}" ] + then + if [[ ! -z "$sstlogarchivedir" ]] + then + newfile=$sstlogarchivedir/$(basename "${INNOAPPLYLOG}").${ARCHIVETIMESTAMP} + else + newfile=${INNOAPPLYLOG}.${ARCHIVETIMESTAMP} + fi + + wsrep_log_info "Moving ${INNOAPPLYLOG} to ${newfile}" + mv "${INNOAPPLYLOG}" "${newfile}" + gzip "${newfile}" + fi + + if [ -e "${INNOMOVELOG}" ] + then + if [[ ! -z "$sstlogarchivedir" ]] + then + newfile=$sstlogarchivedir/$(basename "${INNOMOVELOG}").${ARCHIVETIMESTAMP} + else + newfile=${INNOMOVELOG}.${ARCHIVETIMESTAMP} + fi + + wsrep_log_info "Moving ${INNOMOVELOG} to ${newfile}" + mv "${INNOMOVELOG}" "${newfile}" + gzip "${newfile}" + fi + + if [ -e "${INNOBACKUPLOG}" ] + then + if [[ ! -z "$sstlogarchivedir" ]] + then + newfile=$sstlogarchivedir/$(basename "${INNOBACKUPLOG}").${ARCHIVETIMESTAMP} + else + newfile=${INNOBACKUPLOG}.${ARCHIVETIMESTAMP} + fi + + wsrep_log_info "Moving ${INNOBACKUPLOG} to ${newfile}" + mv "${INNOBACKUPLOG}" "${newfile}" + gzip "${newfile}" + fi + +fi + + INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts --apply-log \$rebuildcmd \${DATA} &> ${INNOAPPLYLOG}" + INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &> ${INNOMOVELOG}" + INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> ${INNOBACKUPLOG}" fi get_stream @@ -812,7 +875,7 @@ then if [ ${RC[0]} -ne 0 ]; then wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ - "Check ${DATA}/innobackup.backup.log" + "Check syslog or ${INNOBACKUPLOG} for details" exit 22 elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then wsrep_log_error "$tcmd finished with error: ${RC[1]}" @@ -1033,13 +1096,12 @@ then if [ $? -ne 0 ]; then - wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check ${DATA}/innobackup.prepare.log" + wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check syslog or ${INNOAPPLYLOG} for details" exit 22 fi MAGIC_FILE="${TDATA}/${INFO_FILE}" set +e - rm $TDATA/innobackup.prepare.log $TDATA/innobackup.move.log set -e wsrep_log_info "Moving the backup to ${TDATA}" timeit "Xtrabackup move stage" "$INNOMOVE" @@ -1049,7 +1111,7 @@ then DATA=${TDATA} else wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis" - wsrep_log_error "Check ${DATA}/innobackup.move.log for details" + wsrep_log_error "Check syslog or ${INNOMOVELOG} for details" exit 22 fi From 6786fb004c5f88f2d4da6534c49456e90676274d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 16 Jan 2019 14:46:36 +0100 Subject: [PATCH 04/28] MDEV-15925 FRM_MAX_SIZE too low for some use cases increase to 1M --- mysql-test/r/huge_frm-6224.result | 2 ++ mysql-test/t/huge_frm-6224.test | 11 +++++++++-- sql/unireg.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/huge_frm-6224.result b/mysql-test/r/huge_frm-6224.result index 3772317c04d..0d6dd968295 100644 --- a/mysql-test/r/huge_frm-6224.result +++ b/mysql-test/r/huge_frm-6224.result @@ -1 +1,3 @@ +set global max_allowed_packet=1024*1024*10; ERROR HY000: The definition for table `t1` is too big +set global max_allowed_packet=default; diff --git a/mysql-test/t/huge_frm-6224.test b/mysql-test/t/huge_frm-6224.test index 418722a7b51..322abd01738 100644 --- a/mysql-test/t/huge_frm-6224.test +++ b/mysql-test/t/huge_frm-6224.test @@ -4,17 +4,24 @@ # verify that huge frms are rejected during creation, not on opening # --source include/have_partition.inc +set global max_allowed_packet=1024*1024*10; +connect con1,localhost,root; -let $n=5646; +let $n=8164; let $a=create table t1 (a int) engine=myisam partition by hash(a) partitions $n (; dec $n; while ($n) { - let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n,; + let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n COMMENT 'partition p01234567890123456789012345678901234567890123456789012345678$n',; dec $n; } --disable_query_log --error ER_TABLE_DEFINITION_TOO_BIG eval $a partition foo); +--enable_query_log + +connection default; +disconnect con1; +set global max_allowed_packet=default; diff --git a/sql/unireg.h b/sql/unireg.h index b13dd494c74..f32a2fdfe12 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -202,7 +202,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, #define FRM_HEADER_SIZE 64 #define FRM_FORMINFO_SIZE 288 -#define FRM_MAX_SIZE (512*1024) +#define FRM_MAX_SIZE (1024*1024) static inline bool is_binary_frm_header(uchar *head) { From 0e89e90f427fda9bc53cd17edc9a623b893a2a08 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 22 Jan 2019 13:28:03 +0100 Subject: [PATCH 05/28] MDEV-17835: Remove wsrep-sst-method=xtrabackup The second line of changes related to replacing xtrabackup with mariabackup: 1) All unnecessary references to xtrabackup are removed from the documentation, from some comments, from the control files that are used to prepare the packages. 2) Made corrections of the tests from the galera_3nodes suite that mentioned xtrabackup or the old (associated with xtrabackup) version of innobackupex. 3) Fixed flaws in the galera_3nodes mtr suite control scripts, because of which they could not work with mariabackup. 4) Fixed numerous bugs in the SST scripts and in the mtr test files (galera_3nodes mtr suite) that prevented the use of Galera with IPv6 addresses. 5) Fixed flaws in tests for rsync and mysqldump (for galera_3nodes mtr tests suite). These tests were not performed successfully without these fixes. https://jira.mariadb.org/browse/MDEV-17835 --- debian/mariadb-server-10.3.install | 3 +- man/CMakeLists.txt | 1 - man/wsrep_sst_xtrabackup-v2.1 | 18 -------- man/wsrep_sst_xtrabackup.1 | 18 -------- mysql-test/suite/galera/disabled.def | 1 - mysql-test/suite/galera_3nodes/disabled.def | 2 - .../suite/galera_3nodes/galera_2x3nodes.cnf | 12 ++--- .../suite/galera_3nodes/galera_3nodes.cnf | 6 +-- .../include/have_mariabackup.inc | 4 ++ .../r/galera_innobackupex_backup.result | 6 +++ ....result => galera_ipv6_mariabackup.result} | 4 ++ .../r/galera_ipv6_mysqldump.result | 21 ++++++--- .../galera_3nodes/r/galera_ipv6_rsync.result | 3 ++ mysql-test/suite/galera_3nodes/suite.pm | 44 ++++++++++++++++--- .../t/galera_innobackupex_backup.cnf | 4 ++ .../t/galera_innobackupex_backup.test | 28 ++++++++++-- ...kup-v2.cnf => galera_ipv6_mariabackup.cnf} | 5 ++- .../t/galera_ipv6_mariabackup.opt | 1 + ...p-v2.test => galera_ipv6_mariabackup.test} | 5 +-- .../galera_3nodes/t/galera_ipv6_mysqldump.cnf | 10 +++-- .../galera_3nodes/t/galera_ipv6_mysqldump.opt | 1 + .../t/galera_ipv6_mysqldump.test | 41 ++++++++++++++--- .../galera_3nodes/t/galera_ipv6_rsync.cnf | 10 +++-- .../galera_3nodes/t/galera_ipv6_rsync.opt | 1 + mysql-test/suite/wsrep/r/variables.result | 3 -- mysql-test/suite/wsrep/t/variables.test | 6 +-- scripts/wsrep_sst_common.sh | 6 ++- scripts/wsrep_sst_mariabackup.sh | 28 +++++++++--- scripts/wsrep_sst_rsync.sh | 17 ++++--- sql/mysqld.cc | 3 +- sql/sys_vars.cc | 3 +- sql/wsrep_mysqld.cc | 2 +- sql/wsrep_sst.cc | 5 --- sql/wsrep_utils.h | 3 +- storage/innobase/handler/ha_innodb.cc | 9 ---- support-files/policy/apparmor/usr.sbin.mysqld | 3 +- .../policy/selinux/mariadb-server.fc | 2 +- .../policy/selinux/mariadb-server.te | 4 +- 38 files changed, 216 insertions(+), 127 deletions(-) delete mode 100644 man/wsrep_sst_xtrabackup-v2.1 delete mode 100644 man/wsrep_sst_xtrabackup.1 create mode 100644 mysql-test/suite/galera_3nodes/include/have_mariabackup.inc rename mysql-test/suite/galera_3nodes/r/{galera_ipv6_xtrabackup-v2.result => galera_ipv6_mariabackup.result} (91%) create mode 100644 mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf rename mysql-test/suite/galera_3nodes/t/{galera_ipv6_xtrabackup-v2.cnf => galera_ipv6_mariabackup.cnf} (91%) create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt rename mysql-test/suite/galera_3nodes/t/{galera_ipv6_xtrabackup-v2.test => galera_ipv6_mariabackup.test} (98%) create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt diff --git a/debian/mariadb-server-10.3.install b/debian/mariadb-server-10.3.install index e3b9ac05c9c..9447446a6b5 100644 --- a/debian/mariadb-server-10.3.install +++ b/debian/mariadb-server-10.3.install @@ -88,8 +88,7 @@ usr/share/man/man1/resolveip.1 usr/share/man/man1/wsrep_sst_common.1 usr/share/man/man1/wsrep_sst_mysqldump.1 usr/share/man/man1/wsrep_sst_rsync.1 -usr/share/man/man1/wsrep_sst_xtrabackup-v2.1 -usr/share/man/man1/wsrep_sst_xtrabackup.1 +usr/share/man/man1/wsrep_sst_mariabackup.1 usr/share/mysql/errmsg-utf8.txt usr/share/mysql/fill_help_tables.sql usr/share/mysql/maria_add_gis_sp_bootstrap.sql diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 9c34ede59c7..1ac4931fdf1 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -25,7 +25,6 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1 resolveip.1 mariadb-service-convert.1 mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1 wsrep_sst_mysqldump.1 wsrep_sst_rsync.1 - wsrep_sst_xtrabackup-v2.1 wsrep_sst_xtrabackup.1 galera_recovery.1 galera_new_cluster.1 tokuft_logprint.1 mysql_ldb.1 wsrep_sst_mariabackup.1 mbstream.1 mariabackup.1 diff --git a/man/wsrep_sst_xtrabackup-v2.1 b/man/wsrep_sst_xtrabackup-v2.1 deleted file mode 100644 index c8dde2f0640..00000000000 --- a/man/wsrep_sst_xtrabackup-v2.1 +++ /dev/null @@ -1,18 +0,0 @@ -'\" t -.\" -.TH "\FBWSREP_SST_XTRABACKUP-V2\FR" "1" "9 May 2017" "MariaDB 10\&.3" "MariaDB Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH NAME -wsrep_sst_xtrabackup-v2 \- xtrabackup\-based state snapshot transfer -.SH DESCRIPTION -Use: xtrabackup-based state snapshot transfer\. -.PP -Note that the xtrabackup-v2 method is deprecated after version 10\.1, with newer versions you should use mariabackup instead\. -.PP -For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ diff --git a/man/wsrep_sst_xtrabackup.1 b/man/wsrep_sst_xtrabackup.1 deleted file mode 100644 index 1fe5037d8b7..00000000000 --- a/man/wsrep_sst_xtrabackup.1 +++ /dev/null @@ -1,18 +0,0 @@ -'\" t -.\" -.TH "\FBWSREP_SST_XTRABACKUP\FR" "1" "9 May 2017" "MariaDB 10\&.3" "MariaDB Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH NAME -wsrep_sst_xtrabackup \- xtrabackup\-based state snapshot transfer -.SH DESCRIPTION -Use: xtrabackup-based state snapshot transfer\. -.PP -Note that the xtrabackup method is deprecated after version 10\.1, with newer versions you should use mariabackup instead\. -.PP -For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index d1d054b87ad..03ddda7aa76 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -34,7 +34,6 @@ galera_kill_applier : race condition at the start of the test galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status pxc-421: Lock timeout exceeded galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure -galera_sst_xtrabackup-v2-options : Failed to read uuid:seqno and wsrep_gtid_domain_id from joiner script galera_gcs_fc_limit : Timeouts pool_of_threads: WSREP has not yet prepared node for application use galera_var_innodb_disallow_writes : Timeout diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index e640baebf7d..1683485981b 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -1,4 +1,2 @@ galera_slave_options_do :MDEV-8798 galera_slave_options_ignore : MDEV-8798 -galera_innobackupex_backup : xtrabackup is deprecated -galera_ipv6_xtrabackup-v2 : xtrabackup is deprecated diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf index 3f39b82f7b7..df51920c13c 100644 --- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -22,7 +22,7 @@ wsrep_node_address=127.0.0.1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep-cluster-address='gcomm://' -wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port @@ -33,7 +33,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port @@ -44,7 +44,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port @@ -58,7 +58,7 @@ wsrep_cluster_name=cluster2 #sst_port=@OPT.port wsrep-cluster-address='gcomm://' -wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port @@ -70,7 +70,7 @@ wsrep_cluster_name=cluster2 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' -wsrep_provider_options='base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port @@ -82,7 +82,7 @@ wsrep_cluster_name=cluster2 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' -wsrep_provider_options='base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 91aa53ad7b1..7b68d36c04a 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -18,7 +18,7 @@ wsrep-sync-wait=15 #ist_port=@OPT.port #sst_port=@OPT.port wsrep-cluster-address='gcomm://' -wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port @@ -29,7 +29,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port @@ -40,7 +40,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port diff --git a/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc b/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc new file mode 100644 index 00000000000..0dd693f2c63 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc @@ -0,0 +1,4 @@ +# +# suite.pm will make sure that all tests including this file +# will be skipped as needed +# diff --git a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result b/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result index 85000db8e77..6ed7587303d 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result +++ b/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result @@ -1,9 +1,15 @@ +connection node_1; +connection node_2; +connection node_3; +connection node_1; CREATE TABLE t1 (f1 INTEGER); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +connection node_2; SELECT COUNT(*) = 10 FROM t1; COUNT(*) = 10 1 Killing server ... +connection node_1; INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); SELECT COUNT(*) = 20 FROM t1; COUNT(*) = 20 diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result similarity index 91% rename from mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result rename to mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result index 53e35939a79..5665ed5f46a 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result @@ -4,14 +4,18 @@ VARIABLE_VALUE LIKE '%[::1]%' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 DROP TABLE t1; +connection node_1; include/assert_grep.inc [Streaming the backup to joiner at \[::1\]] include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:] include/assert_grep.inc [IST receiver addr using tcp://\[::1\]] diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result index f519654952b..3564dc8c5a1 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result @@ -1,11 +1,21 @@ +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to'"); +call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE USER 'sst'; GRANT ALL PRIVILEGES ON *.* TO 'sst'; SET GLOBAL wsrep_sst_auth = 'sst:'; +connection node_2; SET GLOBAL wsrep_sst_method = 'mysqldump'; -Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +Shutting down server ... +connection node_1; +Cleaning var directory ... CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); -Loading wsrep provider ... +connection node_2; +Starting server ... SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 @@ -13,14 +23,15 @@ DROP TABLE t1; SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; VARIABLE_VALUE LIKE '%[::1]%' 1 +connection node_1; CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; +connection node_2; CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); -CALL mtr.add_suppression("InnoDB: New log files created"); -CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables"); CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); CALL mtr.add_suppression("Info table is not ready to be used"); CALL mtr.add_suppression("Native table .* has the wrong structure"); +connection node_2; CALL mtr.add_suppression("Unsupported protocol downgrade: incremental data collection disabled. Expect abort"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result index a2bf5f4d98c..bcf74142144 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result @@ -4,9 +4,12 @@ VARIABLE_VALUE LIKE '%[::1]%' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index 3a1237ecf75..0c098bfc9f9 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -21,14 +21,21 @@ $ENV{WSREP_PROVIDER} = $provider; my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir; return "No SST scripts" unless $spath; +my ($cpath) = grep { -f "$_/mysql"; } "$::bindir/scripts", $::path_client_bindir; +return "No scritps" unless $cpath; + my ($epath) = grep { -f "$_/my_print_defaults"; } "$::bindir/extra", $::path_client_bindir; return "No my_print_defaults" unless $epath; +my ($bpath) = grep { -f "$_/mariabackup"; } "$::bindir/extra/mariabackup", $::path_client_bindir; + +sub which($) { return `sh -c "command -v $_[0]"` } + push @::global_suppressions, ( qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), - qr(WSREP: Could not open saved state file for reading: ), - qr(WSREP: Could not open state file for reading: ), + qr(WSREP: Could not open saved state file for reading: .*), + qr(WSREP: Could not open state file for reading: .*), qr(WSREP: Gap in state sequence. Need state transfer.), qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP:.*down context.*), @@ -42,16 +49,43 @@ push @::global_suppressions, qr|WSREP: discarding established \(time wait\) .*|, qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain (allowed by configuration) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: Resource temporarily unavailable), qr(WSREP: Could not find peer:), - qr(WSREP: Protocol violation. JOIN message sender .*), - qr(WSREP: JOIN message from member [0-9]* in non-primary configuration. Ignored.), + qr|WSREP: gcs_caused\(\) returned .*|, + qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, + qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, + qr(WSREP: Action message in non-primary configuration from member [0-9]*), + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr(WSREP: JOIN message from member .* in non-primary configuration. Ignored.), ); $ENV{PATH}="$epath:$ENV{PATH}"; $ENV{PATH}="$spath:$ENV{PATH}" unless $epath eq $spath; +$ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath; +$ENV{PATH}="$bpath:$ENV{PATH}" unless $bpath eq $spath; + +if (which(socat)) { + $ENV{MTR_GALERA_TFMT}='socat'; +} elsif (which(nc)) { + $ENV{MTR_GALERA_TFMT}='nc'; +} + +sub skip_combinations { + my %skip = (); + $skip{'include/have_filekeymanagement.inc'} = 'needs file_key_management plugin' + unless $ENV{FILE_KEY_MANAGEMENT_SO}; + $skip{'include/have_mariabackup.inc'} = 'Need mariabackup' + unless which(mariabackup); + $skip{'include/have_mariabackup.inc'} = 'Need ss' + unless which(ss); + $skip{'include/have_mariabackup.inc'} = 'Need socat or nc' + unless $ENV{MTR_GALERA_TFMT}; + %skip; +} bless { }; diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf new file mode 100644 index 00000000000..35ecb8b5937 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-causal-reads=OFF diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test index cc3f42c7290..8dfb4660f3e 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test @@ -4,6 +4,17 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_mariabackup.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER); @@ -13,8 +24,8 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); SELECT COUNT(*) = 10 FROM t1; --exec rm -rf $MYSQL_TMP_DIR/innobackupex_backup ---exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log ---exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log +--exec mariabackup --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp $MYSQL_TMP_DIR/innobackupex_backup &> $MYSQL_TMP_DIR/innobackupex-backup.log +--exec mariabackup --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp $MYSQL_TMP_DIR/innobackupex_backup &> $MYSQL_TMP_DIR/innobackupex-apply.log --source ../galera/include/kill_galera.inc --sleep 1 @@ -23,7 +34,7 @@ SELECT COUNT(*) = 10 FROM t1; INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); --exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/* ---exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --copy-back $MYSQL_TMP_DIR/innobackupex_backup --port=$NODE_MYPORT_2 --host=127.0.0.1 > $MYSQL_TMP_DIR/innobackupex-restore.log +--exec mariabackup --innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --copy-back --port=$NODE_MYPORT_2 --host=127.0.0.1 $MYSQL_TMP_DIR/innobackupex_backup &> $MYSQL_TMP_DIR/innobackupex-restore.log # # Convert the xtrabackup_galera_info into a grastate.dat file @@ -51,8 +62,19 @@ EOF --sleep 5 --source include/wait_until_connected_again.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + SELECT COUNT(*) = 20 FROM t1; DROP TABLE t1; --sleep 10 + +--let $galera_connection_name = node_2a +--let $galera_server_number = 2 +--source include/galera_connect.inc +--let $node_2=node_2a + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf similarity index 91% rename from mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf rename to mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf index 8a80be0d2a9..5ac00fa056b 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf @@ -1,8 +1,9 @@ !include ../galera_3nodes.cnf [mysqld] -wsrep_sst_method=xtrabackup-v2 +wsrep_sst_method=mariabackup wsrep_sst_auth="root:" +wsrep_node_address=::1 [mysqld.1] wsrep-cluster-address=gcomm:// @@ -23,4 +24,6 @@ wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.3.port' [SST] +transferfmt=@ENV.MTR_GALERA_TFMT +streamfmt=xbstream sockopt=",pf=ip6" diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt new file mode 100644 index 00000000000..c2bb4d156af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.opt @@ -0,0 +1 @@ +--bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test similarity index 98% rename from mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test rename to mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test index 84eee017700..fdf70989d5d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_ipv6.inc +--source include/have_mariabackup.inc # Confirm that initial handshake happened over ipv6 @@ -56,7 +57,3 @@ DROP TABLE t1; --let $assert_text = Prepared IST receiver, listening at: tcp://\[::1\] --let $assert_select = Prepared IST receiver, listening at: tcp://\[::1\] --source include/assert_grep.inc - - - - diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf index 3728e1ce005..80dd0c41cc3 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf @@ -2,21 +2,25 @@ [mysqld] wsrep_sst_method=rsync +wsrep_node_address=::1 [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.1.port' [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.2.port' [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.3.port' + +[SST] +sockopt=",pf=ip6" diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt new file mode 100644 index 00000000000..c2bb4d156af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt @@ -0,0 +1 @@ +--bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test index 5b06e617eef..e0addcea7bc 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test @@ -1,7 +1,21 @@ --source include/galera_cluster.inc --source include/have_ipv6.inc +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to'"); +call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + --connection node_1 +CREATE USER 'sst'; GRANT ALL PRIVILEGES ON *.* TO 'sst'; --let $wsrep_sst_auth_orig = `SELECT @@wsrep_sst_auth` @@ -17,25 +31,37 @@ SET GLOBAL wsrep_sst_auth = 'sst:'; --enable_query_log SET GLOBAL wsrep_sst_method = 'mysqldump'; - # # Force mysqldump SST # ---connection node_2 ---source suite/galera/include/galera_unload_provider.inc ---remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +#--connection node_2 +#--source suite/galera/include/galera_unload_provider.inc + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc +--echo Cleaning var directory ... +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data + CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); - --connection node_2 ---source suite/galera/include/galera_load_provider.inc +--echo Starting server ... +--let $start_mysqld_params = --wsrep_sst_auth=sst: --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=[::1].1:$NODE_MYPORT_2 +--source include/start_mysqld.inc + +#--source suite/galera/include/galera_load_provider.inc --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc @@ -54,3 +80,6 @@ SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE --source suite/galera/include/galera_sst_restore.inc --connection node_2 CALL mtr.add_suppression("Unsupported protocol downgrade: incremental data collection disabled. Expect abort"); + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf index 3728e1ce005..80dd0c41cc3 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf @@ -2,21 +2,25 @@ [mysqld] wsrep_sst_method=rsync +wsrep_node_address=::1 [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.1.port' [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.2.port' [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.3.port' + +[SST] +sockopt=",pf=ip6" diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt new file mode 100644 index 00000000000..c2bb4d156af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt @@ -0,0 +1 @@ +--bind-address=:: diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index cb371b33bfd..388fe7b8f4f 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -139,9 +139,6 @@ wsrep_local_state_comment # SHOW STATUS LIKE 'x'; Variable_name Value SET GLOBAL wsrep_provider=none; -# -# MDEV#6079: xtrabackup SST failing with maria-10.0-galera -# SHOW STATUS LIKE 'wsrep_local_state_uuid'; Variable_name Value diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index f74b26167b2..c13a8c5f281 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -49,15 +49,11 @@ SHOW STATUS LIKE 'x'; # Reset it back. SET GLOBAL wsrep_provider=none; ---echo # ---echo # MDEV#6079: xtrabackup SST failing with maria-10.0-galera ---echo # - --disable_query_log eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --enable_query_log -# The following 2 variables are used in innobackupex during xtrabackup-based +# The following 2 variables are used by mariabackup # SST. --echo --replace_column 2 # diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 5683b166163..3e82d379a6d 100755 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -44,13 +44,15 @@ case "$1" in addr_no_bracket=${WSREP_SST_OPT_ADDR#\[} readonly WSREP_SST_OPT_HOST_UNESCAPED=${addr_no_bracket%%\]*} readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]" + readonly WSREP_SST_OPT_HOST_ESCAPED="\\[${WSREP_SST_OPT_HOST_UNESCAPED}\\]" ;; *) readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*} readonly WSREP_SST_OPT_HOST_UNESCAPED=$WSREP_SST_OPT_HOST + readonly WSREP_SST_OPT_HOST_ESCAPED=$WSREP_SST_OPT_HOST ;; esac - remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST}} + remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST_ESCAPED}} remain=${remain#:} readonly WSREP_SST_OPT_ADDR_PORT=${remain%%/*} remain=${remain#*/} @@ -274,7 +276,7 @@ wsrep_check_programs() } # -# user can specify xtrabackup specific settings that will be used during sst +# user can specify mariabackup specific settings that will be used during sst # process like encryption, etc..... # parse such configuration option. (group for xb settings is [sst] in my.cnf # diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index bc875a0dc03..fd4248fb6e0 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -509,12 +509,24 @@ kill_xtrabackup() setup_ports() { if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then - SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') - REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') - lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') - sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }') + if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then + remain=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\][:/]' '{ print $2 }') + REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\]:' '{ print $1 }')"]" + SST_PORT=$(echo $remain | awk -F '[:/]' '{ print $1 }') + lsn=$(echo $remain | awk -F '[:/]' '{ print $3 }') + sst_ver=$(echo $remain | awk -F '[:/]' '{ print $4 }') + else + SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') + REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') + lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') + sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }') + fi else - SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') + if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then + SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $2 }') + else + SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') + fi fi } @@ -892,7 +904,11 @@ then if [ -z "${SST_PORT}" ] then SST_PORT=4444 - ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" + if [[ ${ADDR:0:1} == '[' ]];then + ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $1 }')]:${SST_PORT}" + else + ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" + fi fi wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} & diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 80a881ca5dc..a425d335868 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -1,4 +1,4 @@ -#!/bin/sh -ue +#!/bin/bash -ue # Copyright (C) 2010-2014 Codership Oy # @@ -88,7 +88,7 @@ check_pid_and_port() local is_listening_all="$(echo $port_info | \ grep "*:$rsync_port" 2>/dev/null)" local is_listening_addr="$(echo $port_info | \ - grep "$rsync_addr:$rsync_port" 2>/dev/null)" + grep -F "$rsync_addr:$rsync_port" 2>/dev/null)" if [ ! -z "$is_listening_all" -o ! -z "$is_listening_addr" ]; then if [ -z "$is_rsync" ]; then @@ -119,7 +119,7 @@ is_local_ip() address="$address " fi - $get_addr_bin | grep "$address" > /dev/null + $get_addr_bin | grep -F "$address" > /dev/null } STUNNEL_CONF="$WSREP_SST_OPT_DATA/stunnel.conf" @@ -398,12 +398,17 @@ then rm -rf "$RSYNC_PID" ADDR=$WSREP_SST_OPT_ADDR - RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }') - RSYNC_ADDR=$(echo $ADDR | awk -F ':' '{ print $1 }') + if [[ ${ADDR:0:1} == '[' ]]; then + RSYNC_PORT=$(echo $ADDR | awk -F '\\]:' '{ print $2 }') + RSYNC_ADDR=$(echo $ADDR | awk -F '\\]:' '{ print $1 }')"]" + else + RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }') + RSYNC_ADDR=$(echo $ADDR | awk -F ':' '{ print $1 }') + fi if [ -z "$RSYNC_PORT" ] then RSYNC_PORT=4444 - ADDR="$(echo $ADDR | awk -F ':' '{ print $1 }'):$RSYNC_PORT" + ADDR="$RSYNC_ADDR:$RSYNC_PORT" fi trap "exit 32" HUP PIPE diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6f0f517eade..981b76ec210 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5532,7 +5532,8 @@ static int init_server_components() initialized. This initialization was not possible before, as plugins (and thus some global system variables) are initialized after wsrep startup threads are created. - Note: This only needs to be done for rsync, xtrabackup based SST methods. + Note: This only needs to be done for rsync and mariabackup based SST + methods. */ if (wsrep_before_SE()) wsrep_plugins_post_init(); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 369c9a6222a..7be30c97d2f 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5352,8 +5352,7 @@ static Sys_var_charptr sys_wsrep_sst_method( "wsrep_sst_method", "State snapshot transfer method", GLOBAL_VAR(wsrep_sst_method),CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET, DEFAULT(WSREP_SST_DEFAULT), NO_MUTEX_GUARD, NOT_IN_BINLOG, - ON_CHECK(wsrep_sst_method_check), - ON_UPDATE(wsrep_sst_method_update)); + ON_CHECK(wsrep_sst_method_check)); static Sys_var_charptr Sys_wsrep_sst_receive_address( "wsrep_sst_receive_address", "Address where node is waiting for " diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index e60fa94ba2a..e0bb24266a4 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -825,7 +825,7 @@ void wsrep_init_startup (bool first) Pre-initialize global_system_variables.table_plugin with a dummy engine (placeholder) required during the initialization of wsrep threads (THDs). (see: plugin_thdvar_init()) - Note: This only needs to be done for rsync & xtrabackup based SST methods. + Note: This only needs to be done for rsync & mariabackup based SST methods. In case of mysqldump SST method, the wsrep threads are created after the server plugins & global system variables are initialized. */ diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 7a542ab88f1..902d78a2f33 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -60,11 +60,6 @@ bool wsrep_sst_method_check (sys_var *self, THD* thd, set_var* var) return 0; } -bool wsrep_sst_method_update (sys_var *self, THD* thd, enum_var_type type) -{ - return 0; -} - static const char* data_home_dir = NULL; void wsrep_set_data_home_dir(const char *data_dir) diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h index 277cea9dc31..0afca96ea41 100644 --- a/sql/wsrep_utils.h +++ b/sql/wsrep_utils.h @@ -108,7 +108,8 @@ private: /* Hostname with port (host:port) */ start= addr_in; end= colon; - parse_port(colon + 1); + if (parse_port(colon + 1)) + return; /* Error: invalid port */ break; default: /* IPv6 address */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d90088f2c5e..531d12491a4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3732,15 +3732,6 @@ static int innodb_init_params() ib::info() << "For Galera, using innodb_lock_schedule_algorithm=fcfs"; innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS; } - - /* Print deprecation info if xtrabackup is used for SST method */ - if (global_system_variables.wsrep_on - && wsrep_sst_method - && (!strcmp(wsrep_sst_method, "xtrabackup") - || !strcmp(wsrep_sst_method, "xtrabackup-v2"))) { - ib::info() << "Galera SST method xtrabackup is deprecated and the " - " support for it may be removed in future releases."; - } #endif /* WITH_WSREP */ #ifndef HAVE_LZ4 diff --git a/support-files/policy/apparmor/usr.sbin.mysqld b/support-files/policy/apparmor/usr.sbin.mysqld index 05ec77414d2..6555c614889 100644 --- a/support-files/policy/apparmor/usr.sbin.mysqld +++ b/support-files/policy/apparmor/usr.sbin.mysqld @@ -101,13 +101,12 @@ /usr/bin/cut rix, /usr/bin/dirname rix, /usr/bin/gawk rix, - /usr/bin/innobackupex rix, /usr/bin/mysql rix, /usr/bin/perl rix, /usr/bin/seq rix, /usr/bin/wsrep_sst* rix, /usr/bin/wsrep_sst_common r, - /usr/bin/xtrabackup* rix, + /usr/bin/mariabackup* rix, /var/lib/mysql/ r, /var/lib/mysql/** rw, /var/lib/mysql/*.log w, diff --git a/support-files/policy/selinux/mariadb-server.fc b/support-files/policy/selinux/mariadb-server.fc index 409f72923aa..e3f2b5015c7 100644 --- a/support-files/policy/selinux/mariadb-server.fc +++ b/support-files/policy/selinux/mariadb-server.fc @@ -6,5 +6,5 @@ /var/lib/mysql/.*\.err -- gen_context(system_u:object_r:mysqld_log_t,s0) /var/lib/mysql/.*\.pid -- gen_context(system_u:object_r:mysqld_var_run_t,s0) /var/lib/mysql/.*\.cnf -- gen_context(system_u:object_r:mysqld_etc_t,s0) -/usr/bin/xtrabackup.* -- gen_context(system_u:object_r:mysqld_exec_t,s0) +/usr/bin/mariabackup.* -- gen_context(system_u:object_r:mysqld_exec_t,s0) /usr/bin/wsrep.* -- gen_context(system_u:object_r:mysqld_safe_exec_t,s0) diff --git a/support-files/policy/selinux/mariadb-server.te b/support-files/policy/selinux/mariadb-server.te index 45ef40f4153..71924012283 100644 --- a/support-files/policy/selinux/mariadb-server.te +++ b/support-files/policy/selinux/mariadb-server.te @@ -78,7 +78,7 @@ allow mysqld_t user_tmp_t:file create; allow mysqld_t bin_t:lnk_file read; allow mysqld_t tmp_t:file { append create read write open getattr unlink setattr }; -# Allows too much leeway - the xtrabackup/wsrep rules in fc should fix it, but +# Allows too much leeway - the mariabackup/wsrep rules in fc should fix it, but # keep for the moment. allow mysqld_t shell_exec_t:file { execute_no_trans getattr read execute open }; allow mysqld_t bin_t:file { getattr read execute open execute_no_trans ioctl }; @@ -93,7 +93,7 @@ allow mysqld_t tram_port_t:tcp_socket name_bind; # This rule allows port udp/4567 (see README) allow mysqld_t mysqld_port_t:udp_socket name_bind; -# Rules related to XtraBackup +# Rules related to mariabackup allow mysqld_t self:netlink_tcpdiag_socket { create nlmsg_read }; allow mysqld_t sysctl_net_t:file { read getattr open }; From 9f4d4f404fec4b8153fd1af278e1852c3588773d Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 22 Jan 2019 18:23:47 +0400 Subject: [PATCH 06/28] MDEV-12747 - main.mysqld_option_err fails in buildbot with timeout thd_destructor_proxy() may miss abort signal if innobase_end() is running concurrently, which causes server hang in pthread_join() on shutdown. The problem was that aborting wasn't protected by mutex: proxy thr: while (!myvar->abort) end thr: running->abort = 1; end thr: mysql_cond_broadcast(...); proxy thr: mysql_cond_wait(...); // nobody to awake it end thr: pthread_join(...); // waits for proxy thr Also made main.mysqld_option_err reentrant. --- mysql-test/t/mysqld_option_err.test | 2 ++ storage/innobase/handler/ha_innodb.cc | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mysql-test/t/mysqld_option_err.test b/mysql-test/t/mysqld_option_err.test index 0c38eba7ca9..e9655fd4bfe 100644 --- a/mysql-test/t/mysqld_option_err.test +++ b/mysql-test/t/mysqld_option_err.test @@ -56,4 +56,6 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --error 2 --exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 +rmdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; + --echo Done. diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e439db8d828..3e68e2d1d4a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4474,17 +4474,19 @@ innobase_end(handlerton*, ha_panic_function) } } - st_my_thread_var* running = reinterpret_cast( + st_my_thread_var* r = reinterpret_cast( my_atomic_loadptr_explicit( reinterpret_cast(&srv_running), MY_MEMORY_ORDER_RELAXED)); - if (!abort_loop && running) { - // may be UNINSTALL PLUGIN statement - running->abort = 1; - mysql_cond_broadcast(running->current_cond); - } - - if (!srv_read_only_mode) { + if (r) { + ut_ad(!srv_read_only_mode); + if (!abort_loop) { + // may be UNINSTALL PLUGIN statement + mysql_mutex_lock(r->current_mutex); + r->abort = 1; + mysql_cond_broadcast(r->current_cond); + mysql_mutex_unlock(r->current_mutex); + } pthread_join(thd_destructor_thread, NULL); } From 31d592ba7d3a2d2d227e5d4bf36f0866c9932c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 23 Jan 2019 12:05:24 +0200 Subject: [PATCH 07/28] MDEV-18349 InnoDB file size changes are not safe when file system crashes When InnoDB is invoking posix_fallocate() to extend data files, it was missing a call to fsync() to update the file system metadata. If file system recovery is needed, the file size could be incorrect. When the setting innodb_flush_method=O_DIRECT_NO_FSYNC that was introduced in MariaDB 10.0.11 (and MySQL 5.6) is enabled, InnoDB would wrongly skip fsync() after extending files. Furthermore, the merge commit d8b45b0c004edc0b91029b232d7cc9aad02cc822 inadvertently removed XtraDB error checking for posix_fallocate() which this fix is restoring. fil_flush(): Add the parameter bool metadata=false to request that fil_buffering_disabled() be ignored. fil_extend_space_to_desired_size(): Invoke fil_flush() with the extra parameter. After successful posix_fallocate(), invoke os_file_flush(). Note: The bookkeeping for fil_flush() would not be updated the posix_fallocate() code path, so the "redundant" fil_flush() should be a no-op. --- storage/innobase/fil/fil0fil.cc | 27 +++++++++++----------- storage/innobase/include/fil0fil.h | 16 +++++-------- storage/xtradb/fil/fil0fil.cc | 36 ++++++++++++++++++------------ storage/xtradb/include/fil0fil.h | 16 +++++-------- 4 files changed, 47 insertions(+), 48 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index f852a64e2e9..e05d9565507 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -4914,6 +4914,8 @@ retry: " failed with error %d", node->name, start_offset, len + start_offset, err); + } else { + os_file_flush(node->handle); } DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28", @@ -5025,7 +5027,7 @@ file_extended: size_after_extend, *actual_size); */ mutex_exit(&fil_system->mutex); - fil_flush(space_id); + fil_flush(space_id, true); return(success); } @@ -5641,21 +5643,16 @@ fil_aio_wait( } #endif /* UNIV_HOTBACKUP */ -/**********************************************************************//** -Flushes to disk possible writes cached by the OS. If the space does not exist -or is being dropped, does not do anything. */ -UNIV_INTERN -void -fil_flush( -/*======*/ - ulint space_id) /*!< in: file space id (this can be a group of - log files or a tablespace of the database) */ +/** Make persistent possible writes cached by the OS. +If the space does not exist or is being dropped, do nothing. +@param[in] space_id tablespace identifier +@param[in] metadata whether to update file system metadata */ +UNIV_INTERN void fil_flush(ulint space_id, bool metadata) { fil_space_t* space; fil_node_t* node; pfs_os_file_t file; - mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(space_id); @@ -5684,8 +5681,10 @@ fil_flush( } #endif /* UNIV_DEBUG */ - mutex_exit(&fil_system->mutex); - return; + if (!metadata) { + mutex_exit(&fil_system->mutex); + return; + } } space->n_pending_flushes++; /*!< prevent dropping of the space while diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 7c0f623d890..ad279487a3d 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -972,15 +972,11 @@ fil_aio_wait( /*=========*/ ulint segment); /*!< in: the number of the segment in the aio array to wait for */ -/**********************************************************************//** -Flushes to disk possible writes cached by the OS. If the space does not exist -or is being dropped, does not do anything. */ -UNIV_INTERN -void -fil_flush( -/*======*/ - ulint space_id); /*!< in: file space id (this can be a group of - log files or a tablespace of the database) */ +/** Make persistent possible writes cached by the OS. +If the space does not exist or is being dropped, do nothing. +@param[in] space_id tablespace identifier +@param[in] metadata whether to update file system metadata */ +UNIV_INTERN void fil_flush(ulint space_id, bool metadata = false); /**********************************************************************//** Flushes to disk writes in file spaces of the given type possibly cached by the OS. */ diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 49c5f4b090b..755672d9962 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -4947,6 +4947,17 @@ retry: } while (err == EINTR && srv_shutdown_state == SRV_SHUTDOWN_NONE); + success = !err; + if (!success) { + ib_logf(IB_LOG_LEVEL_ERROR, "extending file %s" + " from " INT64PF " to " INT64PF " bytes" + " failed with error %d", + node->name, start_offset, len + start_offset, + err); + } else { + os_file_flush(node->handle); + } + DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28", success = FALSE; os_has_said_disk_full = TRUE;); @@ -5056,7 +5067,7 @@ file_extended: size_after_extend, *actual_size); */ mutex_exit(&fil_system->mutex); - fil_flush(space_id); + fil_flush(space_id, true); return(success); } @@ -5705,21 +5716,16 @@ fil_aio_wait( } #endif /* UNIV_HOTBACKUP */ -/**********************************************************************//** -Flushes to disk possible writes cached by the OS. If the space does not exist -or is being dropped, does not do anything. */ -UNIV_INTERN -void -fil_flush( -/*======*/ - ulint space_id) /*!< in: file space id (this can be a group of - log files or a tablespace of the database) */ +/** Make persistent possible writes cached by the OS. +If the space does not exist or is being dropped, do nothing. +@param[in] space_id tablespace identifier +@param[in] metadata whether to update file system metadata */ +UNIV_INTERN void fil_flush(ulint space_id, bool metadata) { fil_space_t* space; fil_node_t* node; pfs_os_file_t file; - mutex_enter(&fil_system->mutex); space = fil_space_get_by_id(space_id); @@ -5748,8 +5754,10 @@ fil_flush( } #endif /* UNIV_DEBUG */ - mutex_exit(&fil_system->mutex); - return; + if (!metadata) { + mutex_exit(&fil_system->mutex); + return; + } } space->n_pending_flushes++; /*!< prevent dropping of the space while diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 1f3574d4f71..8e737f8fb0e 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -976,15 +976,11 @@ fil_aio_wait( /*=========*/ ulint segment); /*!< in: the number of the segment in the aio array to wait for */ -/**********************************************************************//** -Flushes to disk possible writes cached by the OS. If the space does not exist -or is being dropped, does not do anything. */ -UNIV_INTERN -void -fil_flush( -/*======*/ - ulint space_id); /*!< in: file space id (this can be a group of - log files or a tablespace of the database) */ +/** Make persistent possible writes cached by the OS. +If the space does not exist or is being dropped, do nothing. +@param[in] space_id tablespace identifier +@param[in] metadata whether to update file system metadata */ +UNIV_INTERN void fil_flush(ulint space_id, bool metadata = false); /**********************************************************************//** Flushes to disk writes in file spaces of the given type possibly cached by the OS. */ From 2a0f1d613219ad7962c3394b9c1996ece40926df Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 22 Jan 2019 11:06:15 +0100 Subject: [PATCH 08/28] Bug#28867993: POSSIBLE ISSUE WITH MYSQL SERVER RESTART on startup innodb is checking whether files "ib_logfileN" (for N from 1 to 100) exist, and whether they're readable. A non-existent file aborted the scan. A directory instead of a file made InnoDB to fail. Now it treats "directory exists" as "file doesn't exist". --- mysql-test/suite/innodb/r/innodb_28867993.result | 9 +++++++++ mysql-test/suite/innodb/t/innodb_28867993.test | 12 ++++++++++++ storage/innobase/srv/srv0start.cc | 4 ++++ storage/xtradb/srv/srv0start.cc | 3 +++ 4 files changed, 28 insertions(+) create mode 100644 mysql-test/suite/innodb/r/innodb_28867993.result create mode 100644 mysql-test/suite/innodb/t/innodb_28867993.test diff --git a/mysql-test/suite/innodb/r/innodb_28867993.result b/mysql-test/suite/innodb/r/innodb_28867993.result new file mode 100644 index 00000000000..acc6734eaee --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_28867993.result @@ -0,0 +1,9 @@ +create table t1 (a int) engine=innodb; +insert t1 values (1),(2); +create database ib_logfile2; +select * from t1; +a +1 +2 +drop table t1; +drop database ib_logfile2; diff --git a/mysql-test/suite/innodb/t/innodb_28867993.test b/mysql-test/suite/innodb/t/innodb_28867993.test new file mode 100644 index 00000000000..61e9578df7b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_28867993.test @@ -0,0 +1,12 @@ +# +# Bug#28867993: POSSIBLE ISSUE WITH MYSQL SERVER RESTART +# + +source include/have_innodb.inc; +create table t1 (a int) engine=innodb; +insert t1 values (1),(2); +create database ib_logfile2; +source include/restart_mysqld.inc; +select * from t1; +drop table t1; +drop database ib_logfile2; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 789fe50d337..8412f941588 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2255,6 +2255,10 @@ innobase_start_or_create_for_mysql() break; } + if (stat_info.type != OS_FILE_TYPE_FILE) { + break; + } + if (!srv_file_check_mode(logfilename)) { return(DB_ERROR); } diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index 04f40d039b1..ddf618420d9 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -2335,6 +2335,9 @@ innobase_start_or_create_for_mysql() break; } + if (stat_info.type != OS_FILE_TYPE_FILE) { + break; + } if (!srv_file_check_mode(logfilename)) { return(DB_ERROR); } From 52d13036d81fdaa277c9894784dfefd85cf41287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 23 Jan 2019 13:44:20 +0200 Subject: [PATCH 09/28] MDEV-17933 slow server status - dict_sys_get_size() dict_sys_get_size(): Replace the time-consuming loop with a crude estimate that can be computed without holding any mutex. Even before dict_sys->size was removed in MDEV-13325, not all memory allocations by the InnoDB data dictionary cache were being accounted for. One example is foreign key constraints. Another example is virtual column metadata, starting with 10.2. --- storage/innobase/dict/dict0dict.cc | 36 +++++++++--------------------- storage/innobase/srv/srv0srv.cc | 4 +--- storage/xtradb/dict/dict0dict.cc | 36 +++++++++--------------------- storage/xtradb/srv/srv0srv.cc | 6 ++--- 4 files changed, 23 insertions(+), 59 deletions(-) diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b48d51c15a7..2a37db4e076 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -7250,30 +7250,14 @@ UNIV_INTERN ulint dict_sys_get_size() { - ulint size = 0; + /* No mutex; this is a very crude approximation anyway */ + ulint size = UT_LIST_GET_LEN(dict_sys->table_LRU) + + UT_LIST_GET_LEN(dict_sys->table_non_LRU); + size *= sizeof(dict_table_t) + + sizeof(dict_index_t) * 2 + + (sizeof(dict_col_t) + sizeof(dict_field_t)) * 10 + + sizeof(dict_field_t) * 5 /* total number of key fields */ + + 200; /* arbitrary, covering names and overhead */ - ut_ad(dict_sys); - - mutex_enter(&dict_sys->mutex); - - for(ulint i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) { - dict_table_t* table; - - for (table = static_cast(HASH_GET_FIRST(dict_sys->table_hash,i)); - table != NULL; - table = static_cast(HASH_GET_NEXT(name_hash, table))) { - dict_index_t* index; - size += mem_heap_get_size(table->heap) + strlen(table->name) +1; - - for(index = dict_table_get_first_index(table); - index != NULL; - index = dict_table_get_next_index(index)) { - size += mem_heap_get_size(index->heap); - } - } - } - - mutex_exit(&dict_sys->mutex); - - return (size); + return size; } diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 87f9064c14e..f17a6ddd94b 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1341,8 +1341,6 @@ srv_printf_innodb_monitor( "; in additional pool allocated " ULINTPF "\n", ut_total_allocated_memory, mem_pool_get_reserved(mem_comm_pool)); - fprintf(file, "Dictionary memory allocated " ULINTPF "\n", - dict_sys_get_size()); buf_print_io(file); diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc index 23082e53ec7..1eb0a53e0b0 100644 --- a/storage/xtradb/dict/dict0dict.cc +++ b/storage/xtradb/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -7252,30 +7252,14 @@ UNIV_INTERN ulint dict_sys_get_size() { - ulint size = 0; + /* No mutex; this is a very crude approximation anyway */ + ulint size = UT_LIST_GET_LEN(dict_sys->table_LRU) + + UT_LIST_GET_LEN(dict_sys->table_non_LRU); + size *= sizeof(dict_table_t) + + sizeof(dict_index_t) * 2 + + (sizeof(dict_col_t) + sizeof(dict_field_t)) * 10 + + sizeof(dict_field_t) * 5 /* total number of key fields */ + + 200; /* arbitrary, covering names and overhead */ - ut_ad(dict_sys); - - mutex_enter(&dict_sys->mutex); - - for(ulint i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) { - dict_table_t* table; - - for (table = static_cast(HASH_GET_FIRST(dict_sys->table_hash,i)); - table != NULL; - table = static_cast(HASH_GET_NEXT(name_hash, table))) { - dict_index_t* index; - size += mem_heap_get_size(table->heap) + strlen(table->name) +1; - - for(index = dict_table_get_first_index(table); - index != NULL; - index = dict_table_get_next_index(index)) { - size += mem_heap_get_size(index->heap); - } - } - } - - mutex_exit(&dict_sys->mutex); - - return (size); + return size; } diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 0133b17fada..c05b667dcf4 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1642,9 +1642,7 @@ srv_printf_innodb_monitor( ? (recv_sys->addr_hash->n_cells * sizeof(hash_cell_t)) : 0), recv_sys_subtotal); - - fprintf(file, "Dictionary memory allocated " ULINTPF "\n", - dict_sys ? dict_sys_get_size() : 0); + fprintf(file, "Dictionary memory allocated " ULINTPF "\n", dict_size); buf_print_io(file); From 5c159c90370fc66007220fda4417f8ed2e028ce2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 23 Jan 2019 12:00:12 +0000 Subject: [PATCH 10/28] MDEV-18356 Renamed backup-encrypted option introduced in 7158edcba3af3766e9329f9927ce4adfd2a40bf8 Rename it because it caused parser warning whenever --backup was used. --- extra/mariabackup/fil_cur.cc | 2 +- extra/mariabackup/xtrabackup.cc | 12 ++++++------ extra/mariabackup/xtrabackup.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index a156b8895f0..fa9dcb29317 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -322,7 +322,7 @@ static bool page_is_corrupted(const byte *page, ulint page_no, page_no first. */ if (page_no && mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) - && (opt_backup_encrypted + && (opt_encrypted_backup || (space->crypt_data && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) { diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 03037e56696..87f8822c38b 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -201,7 +201,7 @@ static char* log_ignored_opt; extern my_bool opt_use_ssl; my_bool opt_ssl_verify_server_cert; my_bool opt_extended_validation; -my_bool opt_backup_encrypted; +my_bool opt_encrypted_backup; /* === metadata of backup === */ #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" @@ -762,7 +762,7 @@ enum options_xtrabackup OPT_XTRA_DATABASES_FILE, OPT_XTRA_PARALLEL, OPT_XTRA_EXTENDED_VALIDATION, - OPT_XTRA_BACKUP_ENCRYPTED, + OPT_XTRA_ENCRYPTED_BACKUP, OPT_XTRA_STREAM, OPT_XTRA_COMPRESS, OPT_XTRA_COMPRESS_THREADS, @@ -1231,12 +1231,12 @@ struct my_option xb_server_options[] = (G_PTR*)&opt_extended_validation, 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0}, - {"backup_encrypted", OPT_XTRA_BACKUP_ENCRYPTED, + {"encrypted_backup", OPT_XTRA_ENCRYPTED_BACKUP, "In --backup, assume that nonzero key_version implies that the page" - " is encrypted. Use --backup --skip-backup-encrypted to allow" + " is encrypted. Use --backup --skip-encrypted-backup to allow" " copying unencrypted that were originally created before MySQL 5.1.48.", - (G_PTR*)&opt_backup_encrypted, - (G_PTR*)&opt_backup_encrypted, + (G_PTR*)&opt_encrypted_backup, + (G_PTR*)&opt_encrypted_backup, 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0}, {"log", OPT_LOG, "Ignored option for MySQL option compatibility", diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 8e0e09f6f07..90f5e28e2c7 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -108,7 +108,7 @@ extern my_bool opt_no_backup_locks; extern my_bool opt_decompress; extern my_bool opt_remove_original; extern my_bool opt_extended_validation; -extern my_bool opt_backup_encrypted; +extern my_bool opt_encrypted_backup; extern my_bool opt_lock_ddl_per_table; extern char *opt_incremental_history_name; From 2565c02ca577c9b4523a61359b908dbb3d04076d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 22 Jan 2019 06:19:21 +0200 Subject: [PATCH 11/28] Remove unnecessary type casts --- storage/innobase/os/os0file.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 26cc70e6e41..bfebc2e1b12 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -1766,6 +1766,8 @@ LinuxAIOHandler::resubmit(Slot* slot) slot->n_bytes = 0; slot->io_already_done = false; + compile_time_assert(sizeof(off_t) >= sizeof(os_offset_t)); + struct iocb* iocb = &slot->control; if (slot->type.is_read()) { @@ -1775,7 +1777,7 @@ LinuxAIOHandler::resubmit(Slot* slot) slot->file, slot->ptr, slot->len, - static_cast(slot->offset)); + slot->offset); } else { ut_a(slot->type.is_write()); @@ -1785,7 +1787,7 @@ LinuxAIOHandler::resubmit(Slot* slot) slot->file, slot->ptr, slot->len, - static_cast(slot->offset)); + slot->offset); } iocb->data = slot; @@ -6316,7 +6318,7 @@ AIO::reserve_slot( #ifdef _WIN32 slot->len = static_cast(len); #else - slot->len = static_cast(len); + slot->len = len; #endif /* _WIN32 */ slot->type = type; slot->buf = static_cast(buf); From d06ebd932d1a0ba4c51b183d5b52a9fa99d8f6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 22 Jan 2019 06:51:03 +0200 Subject: [PATCH 12/28] Remove references to removed dict_sys->size --- storage/innobase/include/dict0mem.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 47602a7a9ae..7fde68b3301 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -670,8 +670,7 @@ struct dict_v_col_t{ ulint v_pos; /** Virtual index list, and column position in the index, - the allocated memory is not from table->heap, nor it is - tracked by dict_sys->size */ + the allocated memory is not from table->heap */ dict_v_idx_list* v_indexes; }; @@ -1418,15 +1417,7 @@ struct dict_table_t { /** Hash chain node. */ hash_node_t name_hash; - /** Memory heap. If you allocate from this heap after the table has - been created then be sure to account the allocation into - dict_sys->size. When closing the table we do something like - dict_sys->size -= mem_heap_get_size(table->heap) and if that is going - to become negative then we would assert. Something like this should do: - old_size = mem_heap_get_size() - mem_heap_alloc() - new_size = mem_heap_get_size() - dict_sys->size += new_size - old_size. */ + /** Memory heap */ mem_heap_t* heap; /** NULL or the directory path specified by DATA DIRECTORY. */ From cce2b45c8f5b3245d2e63d2763aeec59153d2c6f Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Thu, 10 Jan 2019 16:32:56 +0200 Subject: [PATCH 13/28] MDEV-17803 Row-based event is not applied when table map id is greater 32 bit int Row-based slave applier could not parse correctly the table id when the value exceeded the max of 32 bit unsigned int. The reason turns out in that the being parsed value placeholder was sized as 4 bytes. The type is fixed to ulonglong. Additionally the patch works around Rows_log_event::m_table_id 4 bytes size on 32 bits platforms. In case of last_table_id value overflows the 4 byte max, there won't be the zero value for m_table_id generated and the first wrapped-around value is one, this is thanks to excluding UINT_MAX32 + 1 from TABLE_SHARE::table_map_id. --- .../rpl/r/rpl_row_big_table_id_32bit.result | 38 +++++++++++++ .../rpl/r/rpl_row_big_table_id_64bit.result | 38 +++++++++++++ .../suite/rpl/t/rpl_row_big_table_id.inc | 56 +++++++++++++++++++ .../rpl/t/rpl_row_big_table_id_32bit.test | 11 ++++ .../rpl/t/rpl_row_big_table_id_64bit.test | 11 ++++ sql/table.h | 2 +- sql/table_cache.cc | 5 +- 7 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_row_big_table_id_32bit.result create mode 100644 mysql-test/suite/rpl/r/rpl_row_big_table_id_64bit.result create mode 100644 mysql-test/suite/rpl/t/rpl_row_big_table_id.inc create mode 100644 mysql-test/suite/rpl/t/rpl_row_big_table_id_32bit.test create mode 100644 mysql-test/suite/rpl/t/rpl_row_big_table_id_64bit.test diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id_32bit.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id_32bit.result new file mode 100644 index 00000000000..f84f02cc416 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id_32bit.result @@ -0,0 +1,38 @@ +include/master-slave.inc +[connection master] +include/rpl_restart_server.inc [server_number=1] +SET @@debug_dbug="d,simulate_big_table_id"; +CREATE TABLE t (a int); +INSERT INTO t SET a= 0; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 1; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 2; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 3; +show binlog events in from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 1 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 2 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 2 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 3 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 3 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +DROP TABLE t; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id_64bit.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id_64bit.result new file mode 100644 index 00000000000..d8ecadc61d1 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id_64bit.result @@ -0,0 +1,38 @@ +include/master-slave.inc +[connection master] +include/rpl_restart_server.inc [server_number=1] +SET @@debug_dbug="d,simulate_big_table_id"; +CREATE TABLE t (a int); +INSERT INTO t SET a= 0; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 1; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 2; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 3; +show binlog events in from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967295 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967296 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967297 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +DROP TABLE t; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.inc b/mysql-test/suite/rpl/t/rpl_row_big_table_id.inc new file mode 100644 index 00000000000..926b6e8b0ac --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.inc @@ -0,0 +1,56 @@ +################################################################## +# rpl_row_big_table_id +# +# MDEV-17803 Row-based event is not applied when +# table map id is greater 32 bit int +# +# Verify row-based events applying when table map id value is about and greater +# than 1 << 32. +################################################################## +--source include/have_debug.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--connection master +# To reset last table id +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +SET @@debug_dbug="d,simulate_big_table_id"; +CREATE TABLE t (a int); + +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1) +INSERT INTO t SET a= 0; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 1; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 2; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 3; + +# display simulated big table_id +--let $_in_from=in '$binlog_file' from $binlog_pos +--replace_result "$_in_from" "in from " +--replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ +--eval show binlog events in '$binlog_file' from $binlog_pos + + +--sync_slave_with_master + +if (`SELECT sum(a) != 6 FROM t`) +{ + --echo *** unexpected result; check slave applier *** + --die +} + + +# Cleanup + +--connection master +DROP TABLE t; + +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id_32bit.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id_32bit.test new file mode 100644 index 00000000000..08e1827c4c6 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id_32bit.test @@ -0,0 +1,11 @@ +################################################################## +# rpl_row_big_table_id +# +# MDEV-17803 Row-based event is not applied when +# table map id is greater 32 bit int +# +# Verify row-based events applying when table map id value is about and greater +# than 1 << 32. +################################################################## +--source include/have_32bit.inc +--source rpl_row_big_table_id.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id_64bit.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id_64bit.test new file mode 100644 index 00000000000..f9e021cdd2c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id_64bit.test @@ -0,0 +1,11 @@ +################################################################## +# rpl_row_big_table_id +# +# MDEV-17803 Row-based event is not applied when +# table map id is greater 32 bit int +# +# Verify row-based events applying when table map id value is about and greater +# than 1 << 32. +################################################################## +--source include/have_64bit.inc +--source rpl_row_big_table_id.inc diff --git a/sql/table.h b/sql/table.h index 4a1552f8c0d..10c1d1bc68e 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1816,7 +1816,7 @@ struct TABLE_LIST /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ List *index_hints; TABLE *table; /* opened table */ - uint table_id; /* table id (from binlog) for opened table */ + ulonglong table_id; /* table id (from binlog) for opened table */ /* select_result for derived table to pass it from table creation to table filling procedure diff --git a/sql/table_cache.cc b/sql/table_cache.cc index f13d7183a99..1154017d8d5 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -1206,6 +1206,9 @@ void tdc_assign_new_table_id(TABLE_SHARE *share) DBUG_ASSERT(share); DBUG_ASSERT(tdc_inited); + DBUG_EXECUTE_IF("simulate_big_table_id", + if (last_table_id < UINT_MAX32) + last_table_id= UINT_MAX32 - 1;); /* There is one reserved number that cannot be used. Remember to change this when 6-byte global table id's are introduced. @@ -1215,7 +1218,7 @@ void tdc_assign_new_table_id(TABLE_SHARE *share) my_atomic_rwlock_wrlock(&LOCK_tdc_atomics); tid= my_atomic_add64(&last_table_id, 1); my_atomic_rwlock_wrunlock(&LOCK_tdc_atomics); - } while (unlikely(tid == ~0UL)); + } while (unlikely(tid == ~0UL || tid == 0)); share->table_map_id= tid; DBUG_PRINT("info", ("table_id= %lu", share->table_map_id)); From 7886a70ef9d8a0fe8f8c0d8ef5c524187e58eaf0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 23 Jan 2019 17:18:57 +0100 Subject: [PATCH 14/28] MDEV-17421: mtr does not restart the server whose parameters were changed remove tests that rely on specific execution order --- mysql-test/suite/rpl/r/mtr_restart_t1.result | 5 ---- mysql-test/suite/rpl/r/mtr_restart_t2.result | 4 --- mysql-test/suite/rpl/t/mtr_restart_t1.test | 31 -------------------- mysql-test/suite/rpl/t/mtr_restart_t2.test | 18 ------------ 4 files changed, 58 deletions(-) delete mode 100644 mysql-test/suite/rpl/r/mtr_restart_t1.result delete mode 100644 mysql-test/suite/rpl/r/mtr_restart_t2.result delete mode 100644 mysql-test/suite/rpl/t/mtr_restart_t1.test delete mode 100644 mysql-test/suite/rpl/t/mtr_restart_t2.test diff --git a/mysql-test/suite/rpl/r/mtr_restart_t1.result b/mysql-test/suite/rpl/r/mtr_restart_t1.result deleted file mode 100644 index 56b64a2fc70..00000000000 --- a/mysql-test/suite/rpl/r/mtr_restart_t1.result +++ /dev/null @@ -1,5 +0,0 @@ -include/master-slave.inc -[connection master] -include/rpl_stop_server.inc [server_number=1] -new auto_increment_offset=111 -include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/mtr_restart_t2.result b/mysql-test/suite/rpl/r/mtr_restart_t2.result deleted file mode 100644 index 3c8fe59d607..00000000000 --- a/mysql-test/suite/rpl/r/mtr_restart_t2.result +++ /dev/null @@ -1,4 +0,0 @@ -include/master-slave.inc -[connection master] -auto_increment_offset=1 -include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/mtr_restart_t1.test b/mysql-test/suite/rpl/t/mtr_restart_t1.test deleted file mode 100644 index 3003a49c424..00000000000 --- a/mysql-test/suite/rpl/t/mtr_restart_t1.test +++ /dev/null @@ -1,31 +0,0 @@ -# This test verifies that mtr will restart the mysqld process, -# whose parameters were changed during the test. The verification -# itself is carried out in the following mtr_restart_t2 test. -# If mtr restart the mysqld process, then the auto_increment_offset -# parameter value will be reset to the default ("1"), but if there -# is no restart, then we will see the changed value ("111") during -# the next test. -# ---source include/have_binlog_format_row.inc ---source include/master-slave.inc - -connection master; - -let $auto_increment_offset = `SELECT @@global.auto_increment_offset`; - ---let $rpl_server_number=1 -source include/rpl_stop_server.inc; ---let $rpl_server_parameters=--auto-increment-offset=111 ---let $keep_include_silent=1 -source include/rpl_start_server.inc; ---let $keep_include_silent=0 - -let $auto_increment_offset_new = `SELECT @@global.auto_increment_offset`; ---echo new auto_increment_offset=$auto_increment_offset_new - ---disable_query_log ---eval SET @@global.auto_increment_offset = $auto_increment_offset; ---enable_query_log - ---connection master ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/mtr_restart_t2.test b/mysql-test/suite/rpl/t/mtr_restart_t2.test deleted file mode 100644 index ab246af6b44..00000000000 --- a/mysql-test/suite/rpl/t/mtr_restart_t2.test +++ /dev/null @@ -1,18 +0,0 @@ -# This test verifies that mtr will restart the mysqld process, -# whose parameters were changed during the previous test. If mtr -# restart the mysqld process, then the auto_increment_offsert -# parameter value will be reset to the default ("1"), but if there -# is no restart, then we will see the changed value ("111") in -# this test. -# ---source include/have_binlog_format_row.inc ---source include/master-slave.inc - -connection master; - -let $auto_increment_offset = `SELECT @@global.auto_increment_offset`; - ---echo auto_increment_offset=$auto_increment_offset - ---connection master ---source include/rpl_end.inc From d24060b1796bac5b11aee49f1c157dfc2c8200c1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 23 Jan 2019 17:20:41 +0100 Subject: [PATCH 15/28] MDEV-17421: mtr does not restart the server whose parameters were changed remove tests that rely on specific execution order --- .../galera/r/galera_mtr_restart_t1.result | 1 - .../galera/r/galera_mtr_restart_t2.result | 1 - .../suite/galera/t/galera_mtr_restart_t1.test | 35 ------------------- .../suite/galera/t/galera_mtr_restart_t2.test | 13 ------- 4 files changed, 50 deletions(-) delete mode 100644 mysql-test/suite/galera/r/galera_mtr_restart_t1.result delete mode 100644 mysql-test/suite/galera/r/galera_mtr_restart_t2.result delete mode 100644 mysql-test/suite/galera/t/galera_mtr_restart_t1.test delete mode 100644 mysql-test/suite/galera/t/galera_mtr_restart_t2.test diff --git a/mysql-test/suite/galera/r/galera_mtr_restart_t1.result b/mysql-test/suite/galera/r/galera_mtr_restart_t1.result deleted file mode 100644 index c628a99f1e8..00000000000 --- a/mysql-test/suite/galera/r/galera_mtr_restart_t1.result +++ /dev/null @@ -1 +0,0 @@ -weight=111 diff --git a/mysql-test/suite/galera/r/galera_mtr_restart_t2.result b/mysql-test/suite/galera/r/galera_mtr_restart_t2.result deleted file mode 100644 index 0d488f3d174..00000000000 --- a/mysql-test/suite/galera/r/galera_mtr_restart_t2.result +++ /dev/null @@ -1 +0,0 @@ -weight=1 diff --git a/mysql-test/suite/galera/t/galera_mtr_restart_t1.test b/mysql-test/suite/galera/t/galera_mtr_restart_t1.test deleted file mode 100644 index 563d199625a..00000000000 --- a/mysql-test/suite/galera/t/galera_mtr_restart_t1.test +++ /dev/null @@ -1,35 +0,0 @@ -# This test verifies that mtr will restart the mysqld process, -# whose parameters were changed during the test. The verification -# itself is carried out in the following galera_mtr_restart_t2 -# test. If mtr restart the mysqld process, then the pc.weight -# value will be reset to the default ("1"), but if there is no -# restart, then we will see the changed value ("111") during -# the next test. -# ---source include/galera_cluster.inc ---source include/have_innodb.inc - -# Save original auto_increment_offset values. ---let $node_1=node_1 ---let $node_2=node_2 ---source include/auto_increment_offset_save.inc - ---connection node_2 ---let $restart_parameters = --wsrep_provider_options=pc.weight=111;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S ---source include/restart_mysqld.inc - ---connection node_1 ---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ---source include/wait_condition.inc - ---connection node_2 ---source include/wait_until_ready.inc - -# Check that the parameter value really changed: ---let $gp = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))` ---let $weight = `SELECT SUBSTR('$gp', 1, LOCATE(';', '$gp') - 1)` ---echo weight=$weight - -# Restore original auto_increment_offset values. ---connection node_1 ---source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_mtr_restart_t2.test b/mysql-test/suite/galera/t/galera_mtr_restart_t2.test deleted file mode 100644 index fcc1d0515a6..00000000000 --- a/mysql-test/suite/galera/t/galera_mtr_restart_t2.test +++ /dev/null @@ -1,13 +0,0 @@ -# This test verifies that mtr will restart the mysqld process, -# whose parameters were changed during the previous test. If mtr -# restart the mysqld process, then the pc.weight value will be -# reset to the default ("1"), but if there is no restart, then -# we will see the changed value ("111") in this test. -# ---source include/galera_cluster.inc ---source include/have_innodb.inc - ---connection node_2 ---let $gp = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))` ---let $weight = `SELECT SUBSTR('$gp', 1, LOCATE(';', '$gp') - 1)` ---echo weight=$weight From c2a4bfad223903931171c473c42646e93dd0e728 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 9 Jan 2019 19:17:06 +0100 Subject: [PATCH 16/28] MDEV-18119 upgrading from 10.3 to 10.4 can result in the password for a user to be wiped out 10.1 part: SHOW CREATE USER didn't show the password, if plugin was set, but authentication_string was not --- mysql-test/r/connect.result | 12 ++++++++++++ mysql-test/t/connect.test | 5 +++++ sql/sql_acl.cc | 8 ++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index cb66ff483e1..d3c19fd1f9d 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -82,8 +82,20 @@ connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) +select user,host,password,plugin,authentication_string from mysql.user where user='test'; +user host password plugin authentication_string +test localhost *5FDFF3268A50F41C5D18D2CA2F754D7BDB9B3E59 +test 127.0.0.1 *5FDFF3268A50F41C5D18D2CA2F754D7BDB9B3E59 update mysql.user set password=old_password("gambling2") where user=_binary"test"; flush privileges; +show grants for test@localhost; +Grants for test@localhost +GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573' +update mysql.user set plugin='mysql_old_password' where user='test'; +flush privileges; +show grants for test@localhost; +Grants for test@localhost +GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573' set password=""; set password='gambling3'; ERROR HY000: Password hash should be a 41-digit hexadecimal number diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 3a38ad88462..560f29e840d 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -66,8 +66,13 @@ connect (fail_con,localhost,test,zorro,test2); connect (fail_con,localhost,test,zorro,); # check if old password version also works +select user,host,password,plugin,authentication_string from mysql.user where user='test'; update mysql.user set password=old_password("gambling2") where user=_binary"test"; flush privileges; +show grants for test@localhost; +update mysql.user set plugin='mysql_old_password' where user='test'; +flush privileges; +show grants for test@localhost; connect (con10,localhost,test,gambling2,); connect (con5,localhost,test,gambling2,mysql); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 784f2338a55..9d6e6c51fb6 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -986,8 +986,7 @@ static bool fix_user_plugin_ptr(ACL_USER *user) else return true; - if (user->auth_string.length) - set_user_salt(user, user->auth_string.str, user->auth_string.length); + set_user_salt(user, user->auth_string.str, user->auth_string.length); return false; } @@ -1457,6 +1456,11 @@ static bool acl_load(THD *thd, TABLE_LIST *tables) safe_str(user.user.str), safe_str(user.host.hostname)); } + else if (password_len) + { + user.auth_string.str= password; + user.auth_string.length= password_len; + } fix_user_plugin_ptr(&user); } From e32305e50553f3cddf29f13005910e22cc90bcaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 23 Jan 2019 19:45:12 +0200 Subject: [PATCH 17/28] Add a test for Bug #28470805 DELETE CASCADE CRASHES ... ON RESTART Thanks to commit 2614a0ab0ffd802b3b9e62795979e83b6a10fcb3 before MDEV-5800, no version of MariaDB is affected by this bug that was fixed in MySQL 5.7.25. --- mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result | 9 +++++++++ mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result index 25faeaf4e84..1d4766eab19 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result @@ -7,9 +7,18 @@ CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, fld3 INT AS (fld2) VIRTUAL, KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb; +CREATE TABLE u1(a INT, KEY(a)) ENGINE=InnoDB; +CREATE TABLE u2(b INT, vb INT GENERATED ALWAYS AS(b) VIRTUAL, KEY(vb), +FOREIGN KEY(b) REFERENCES u1(a)ON DELETE CASCADE)ENGINE=InnoDB; +INSERT INTO u1 SET a=1; +INSERT INTO u2 SET b=1; INSERT INTO t1(fld1) VALUES(1); INSERT INTO t2(fld1, fld2) VALUES(1, 2); UPDATE t1 SET fld1= 2; +DELETE FROM u1; +SELECT * FROM u2; +b vb +DROP TABLE u2,u1; SELECT fld3, fld1 FROM t2; fld3 fld1 2 2 diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test index 61d330036ea..45d1c1295a5 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test @@ -11,10 +11,19 @@ CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, fld3 INT AS (fld2) VIRTUAL, KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb; +CREATE TABLE u1(a INT, KEY(a)) ENGINE=InnoDB; +CREATE TABLE u2(b INT, vb INT GENERATED ALWAYS AS(b) VIRTUAL, KEY(vb), + FOREIGN KEY(b) REFERENCES u1(a)ON DELETE CASCADE)ENGINE=InnoDB; + +INSERT INTO u1 SET a=1; +INSERT INTO u2 SET b=1; INSERT INTO t1(fld1) VALUES(1); INSERT INTO t2(fld1, fld2) VALUES(1, 2); --source include/restart_mysqld.inc UPDATE t1 SET fld1= 2; +DELETE FROM u1; +SELECT * FROM u2; +DROP TABLE u2,u1; SELECT fld3, fld1 FROM t2; alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM=INPLACE; UPDATE t1 SET fld1=3; From aa8a31dadd21ada93bc3c739de866c78614e746a Mon Sep 17 00:00:00 2001 From: Aditya A Date: Wed, 10 Oct 2018 18:05:02 +0530 Subject: [PATCH 18/28] Bug #22990029 GCOLS: INCORRECT BEHAVIOR AFTER DATA INSERTED WITH IGNORE KEYWORD PROBLEM ------- 1. We are inserting a base column entry which causes an invalid value by the function provided to generate virtual column,but we go ahead and insert this due to ignore keyword. 2. We then delete this record, making this record delete marked in innodb. If we try to insert another record with the same pk as the deleted record and if the rec is not purged ,then we try to undelete mark this record and try to build a update vector with previous and updated value and while calculating the value of virtual column we get error from server that we cannot calculate this from base column. Innodb assumes that innobase_get_computed_value() Should always return a valid value for the base column present in the row. The failure of this call was not handled ,so we were crashing. FIX --- storage/innobase/include/row0upd.h | 8 +++++--- storage/innobase/row/row0ins.cc | 8 ++++++-- storage/innobase/row/row0log.cc | 5 ++++- storage/innobase/row/row0upd.cc | 10 ++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 9686f8d6896..5e75eea00df 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -219,6 +219,7 @@ the equal ordering fields. NOTE: we compare the fields as binary strings! @param[in] heap memory heap from which allocated @param[in,out] mysql_table NULL, or mysql table object when user thread invokes dml +@param[out] error error number in case of failure @return own: update vector of differing fields, excluding roll ptr and trx id */ upd_t* @@ -230,8 +231,9 @@ row_upd_build_difference_binary( bool no_sys, trx_t* trx, mem_heap_t* heap, - TABLE* mysql_table) - MY_ATTRIBUTE((nonnull(1,2,3,7), warn_unused_result)); + TABLE* mysql_table, + dberr_t* error) + MY_ATTRIBUTE((nonnull(1,2,3,7,9), warn_unused_result)); /***********************************************************//** Replaces the new column values stored in the update vector to the index entry given. */ diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 2db545973a3..e60e350b9f6 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -326,7 +326,7 @@ row_ins_clust_index_entry_by_modify( { const rec_t* rec; upd_t* update; - dberr_t err; + dberr_t err = DB_SUCCESS; btr_cur_t* cursor = btr_pcur_get_btr_cur(pcur); TABLE* mysql_table = NULL; ut_ad(dict_index_is_clust(cursor->index)); @@ -349,7 +349,11 @@ row_ins_clust_index_entry_by_modify( update = row_upd_build_difference_binary( cursor->index, entry, rec, NULL, true, - thr_get_trx(thr), heap, mysql_table); + thr_get_trx(thr), heap, mysql_table, &err); + if (err != DB_SUCCESS) { + return(err); + } + if (mode != BTR_MODIFY_TREE) { ut_ad((mode & ~BTR_ALREADY_S_LATCHED) == BTR_MODIFY_LEAF); diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 16a71fbe896..d5581f4f48d 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -2042,7 +2042,10 @@ func_exit_committed: row, NULL, index, heap, ROW_BUILD_NORMAL); upd_t* update = row_upd_build_difference_binary( index, entry, btr_pcur_get_rec(&pcur), cur_offsets, - false, NULL, heap, dup->table); + false, NULL, heap, dup->table, &error); + if (error != DB_SUCCESS) { + goto func_exit; + } if (!update->n_fields) { /* Nothing to do. */ diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index ccb18cb843b..1a27ab80b35 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1036,8 +1036,9 @@ the equal ordering fields. NOTE: we compare the fields as binary strings! @param[in] heap memory heap from which allocated @param[in] mysql_table NULL, or mysql table object when user thread invokes dml +@param[out] error error number in case of failure @return own: update vector of differing fields, excluding roll ptr and -trx id */ +trx id,if error is not equal to DB_SUCCESS, return NULL */ upd_t* row_upd_build_difference_binary( dict_index_t* index, @@ -1047,7 +1048,8 @@ row_upd_build_difference_binary( bool no_sys, trx_t* trx, mem_heap_t* heap, - TABLE* mysql_table) + TABLE* mysql_table, + dberr_t* error) { upd_field_t* upd_field; dfield_t* dfield; @@ -1159,6 +1161,10 @@ row_upd_build_difference_binary( update->old_vrow, col, index, &v_heap, heap, NULL, thd, mysql_table, record, NULL, NULL, NULL); + if (vfield == NULL) { + *error = DB_COMPUTE_VALUE_FAILED; + return(NULL); + } if (!dfield_data_is_binary_equal( dfield, vfield->len, From 64678ca5063fda91a56346dac834719eab4c5694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 23 Jan 2019 18:09:32 +0200 Subject: [PATCH 19/28] Bug #22990029: Add a test case --- .../suite/gcol/r/innodb_virtual_index.result | 23 +++++++++++++++++++ .../suite/gcol/t/innodb_virtual_index.test | 18 +++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result index 4540994a72d..b62c94ce409 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_index.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result @@ -243,3 +243,26 @@ KEY (a(1)) INSERT INTO t1(b) VALUES(REPEAT('b',1000)); DELETE FROM t1; DROP TABLE t1; +# +# Bug #22990029 GCOLS: INCORRECT BEHAVIOR +# AFTER DATA INSERTED WITH IGNORE KEYWORD +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb)) +ENGINE=InnoDB; +INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132); +Warnings: +Warning 1265 Data truncated for column 'vb' at row 1 +BEGIN; +DELETE FROM t1; +INSERT INTO t1 (a,b) VALUES(1,20190123); +ERROR 22007: Incorrect date value: '20190132' for column `test`.`t1`.`vb` at row 1 +SELECT * FROM t1; +a b vb +ROLLBACK; +SELECT * FROM t1; +a b vb +1 20190132 0000-00-00 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test index 8f4e09fdf31..7aa241356c2 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_index.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test @@ -263,3 +263,21 @@ CREATE TABLE t1( INSERT INTO t1(b) VALUES(REPEAT('b',1000)); DELETE FROM t1; DROP TABLE t1; + +--echo # +--echo # Bug #22990029 GCOLS: INCORRECT BEHAVIOR +--echo # AFTER DATA INSERTED WITH IGNORE KEYWORD +--echo # + +CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb)) +ENGINE=InnoDB; +INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132); +BEGIN; +DELETE FROM t1; +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 (a,b) VALUES(1,20190123); +SELECT * FROM t1; +ROLLBACK; +SELECT * FROM t1; +CHECK TABLE t1; +DROP TABLE t1; From d283f80eae41276c607aba3d119ebdf80a1b2fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 22 Jan 2019 16:43:59 +0200 Subject: [PATCH 20/28] Update the InnoDB version number --- mysql-test/suite/sys_vars/r/sysvars_innodb.result | 2 +- storage/innobase/include/univ.i | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index fdc51cb2615..51eac071a08 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -3074,7 +3074,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.7.24 +GLOBAL_VALUE 5.7.25 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 19a2c030d95..021cf2c34a7 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 7 -#define INNODB_VERSION_BUGFIX 24 +#define INNODB_VERSION_BUGFIX 25 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; From b22354680ef9c5ffeda91cba284ed236fbf3c31e Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Wed, 23 Jan 2019 20:16:21 +0200 Subject: [PATCH 21/28] merge 10.0 -> 10.1 to resolve MDEV-17803 conflicts. --- .../rpl/r/rpl_row_big_table_id,32bit.rdiff | 29 ++++++++++ .../suite/rpl/r/rpl_row_big_table_id.result | 38 +++++++++++++ .../suite/rpl/t/rpl_row_big_table_id.test | 57 +++++++++++++++++++ sql/table.h | 2 +- sql/table_cache.cc | 5 +- 5 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff create mode 100644 mysql-test/suite/rpl/r/rpl_row_big_table_id.result create mode 100644 mysql-test/suite/rpl/t/rpl_row_big_table_id.test diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff new file mode 100644 index 00000000000..1dbbfa9252f --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff @@ -0,0 +1,29 @@ +--- r/rpl_row_big_table_id.result 2019-01-23 19:58:07.204914873 +0200 ++++ r/rpl_row_big_table_id_32bit.result 2019-01-23 19:43:54.590640934 +0200 +@@ -19,20 +19,20 @@ + master-bin.000002 # Gtid 1 # GTID #-#-# + master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' + master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +-master-bin.000002 # Table_map 1 # table_id: 4294967295 (test.t) +-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F ++master-bin.000002 # Table_map 1 # table_id: 1 (test.t) ++master-bin.000002 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F + master-bin.000002 # Query 1 # COMMIT + master-bin.000002 # Gtid 1 # GTID #-#-# + master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' + master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +-master-bin.000002 # Table_map 1 # table_id: 4294967296 (test.t) +-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F ++master-bin.000002 # Table_map 1 # table_id: 2 (test.t) ++master-bin.000002 # Write_rows_v1 1 # table_id: 2 flags: STMT_END_F + master-bin.000002 # Query 1 # COMMIT + master-bin.000002 # Gtid 1 # GTID #-#-# + master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' + master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +-master-bin.000002 # Table_map 1 # table_id: 4294967297 (test.t) +-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F ++master-bin.000002 # Table_map 1 # table_id: 3 (test.t) ++master-bin.000002 # Write_rows_v1 1 # table_id: 3 flags: STMT_END_F + master-bin.000002 # Query 1 # COMMIT + DROP TABLE t; + include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result new file mode 100644 index 00000000000..d8ecadc61d1 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result @@ -0,0 +1,38 @@ +include/master-slave.inc +[connection master] +include/rpl_restart_server.inc [server_number=1] +SET @@debug_dbug="d,simulate_big_table_id"; +CREATE TABLE t (a int); +INSERT INTO t SET a= 0; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 1; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 2; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 3; +show binlog events in from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967295 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967296 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Table_map 1 # table_id: 4294967297 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +DROP TABLE t; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test new file mode 100644 index 00000000000..0c6f9d5e862 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test @@ -0,0 +1,57 @@ +################################################################## +# rpl_row_big_table_id +# +# MDEV-17803 Row-based event is not applied when +# table map id is greater 32 bit int +# +# Verify row-based events applying when table map id value is about and greater +# than 1 << 32. +################################################################## +--source include/word_size.inc +--source include/have_debug.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--connection master +# To reset last table id +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +SET @@debug_dbug="d,simulate_big_table_id"; +CREATE TABLE t (a int); + +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1) +INSERT INTO t SET a= 0; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 1; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 2; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 3; + +# display simulated big table_id +--let $_in_from=in '$binlog_file' from $binlog_pos +--replace_result "$_in_from" "in from " +--replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ +--eval show binlog events in '$binlog_file' from $binlog_pos + + +--sync_slave_with_master + +if (`SELECT sum(a) != 6 FROM t`) +{ + --echo *** unexpected result; check slave applier *** + --die +} + + +# Cleanup + +--connection master +DROP TABLE t; + +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/sql/table.h b/sql/table.h index ca32234579f..1a24d786d82 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1887,7 +1887,7 @@ struct TABLE_LIST /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ List *index_hints; TABLE *table; /* opened table */ - uint table_id; /* table id (from binlog) for opened table */ + ulonglong table_id; /* table id (from binlog) for opened table */ /* select_result for derived table to pass it from table creation to table filling procedure diff --git a/sql/table_cache.cc b/sql/table_cache.cc index 6d190400217..b3cf6cd2892 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -1134,6 +1134,9 @@ void tdc_assign_new_table_id(TABLE_SHARE *share) DBUG_ASSERT(share); DBUG_ASSERT(tdc_inited); + DBUG_EXECUTE_IF("simulate_big_table_id", + if (last_table_id < UINT_MAX32) + last_table_id= UINT_MAX32 - 1;); /* There is one reserved number that cannot be used. Remember to change this when 6-byte global table id's are introduced. @@ -1141,7 +1144,7 @@ void tdc_assign_new_table_id(TABLE_SHARE *share) do { tid= my_atomic_add64_explicit(&last_table_id, 1, MY_MEMORY_ORDER_RELAXED); - } while (unlikely(tid == ~0UL)); + } while (unlikely(tid == ~0UL || tid == 0)); share->table_map_id= tid; DBUG_PRINT("info", ("table_id= %lu", share->table_map_id)); From b572814baa1746efeb65bf55b4c7a7d535e283a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 23 Jan 2019 20:56:52 +0200 Subject: [PATCH 22/28] After-merge fix of a result I missed this in commit 9a7281a70396e6bdd2ce10bf328d36909e044ba6 --- mysql-test/r/huge_frm-6224.result | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/r/huge_frm-6224.result b/mysql-test/r/huge_frm-6224.result index 0d6dd968295..bbb650bc5b4 100644 --- a/mysql-test/r/huge_frm-6224.result +++ b/mysql-test/r/huge_frm-6224.result @@ -1,3 +1,6 @@ set global max_allowed_packet=1024*1024*10; +connect con1,localhost,root; ERROR HY000: The definition for table `t1` is too big +connection default; +disconnect con1; set global max_allowed_packet=default; From a0f3b9f94f3094ccb9ce75c53b25d36c4c78e922 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 24 Jan 2019 13:52:51 +0530 Subject: [PATCH 23/28] MDEV-17376 Server fails to set ADD_PK_INDEX, DROP_PK_INDEX if unique index nominated as PK Problem: ======== Server fails to notify the engine by not setting the ADD_PK_INDEX and DROP_PK_INDEX When there is a i) Change in candidate for primary key. ii) New candidate for primary key. Fix: ==== Server sets the ADD_PK_INDEX and DROP_PK_INDEX while doing alter for the above problematic case. --- .../suite/innodb/r/alter_candidate_key.result | 107 ++++++++++++++++++ .../suite/innodb/r/innodb-table-online.result | 11 -- .../suite/innodb/t/alter_candidate_key.test | 72 ++++++++++++ .../suite/innodb/t/innodb-table-online.test | 4 - sql/sql_table.cc | 17 +++ 5 files changed, 196 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/innodb/r/alter_candidate_key.result create mode 100644 mysql-test/suite/innodb/t/alter_candidate_key.test diff --git a/mysql-test/suite/innodb/r/alter_candidate_key.result b/mysql-test/suite/innodb/r/alter_candidate_key.result new file mode 100644 index 00000000000..b0b8e390c7e --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_candidate_key.result @@ -0,0 +1,107 @@ +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL, +UNIQUE KEY uidx2(f1,f2), +UNIQUE KEY uidx1(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx2` (`f1`,`f2`), + UNIQUE KEY `uidx1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +DELETE FROM t1; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f11` int(11) DEFAULT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx1` (`f2`), + UNIQUE KEY `uidx2` (`f11`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1(f1 INT, f2 INT, +PRIMARY KEY(f1, f2), +UNIQUE INDEX uidx2 (f1, f2), +UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL DEFAULT '0', + `f2` int(11) NOT NULL DEFAULT '0', + UNIQUE KEY `uidx2` (`f1`,`f2`), + UNIQUE KEY `uidx1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +INSERT INTO t1 VALUES(1, 1), (1, 1); +ERROR 23000: Duplicate entry '1-1' for key 'uidx2' +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f11` int(11) DEFAULT NULL, + `f2` int(11) NOT NULL DEFAULT '0', + UNIQUE KEY `uidx1` (`f2`), + UNIQUE KEY `uidx2` (`f11`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET SQL_MODE= strict_trans_tables; +CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done'; +ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL; +SET DEBUG_SYNC='now WAIT_FOR dml'; +BEGIN; +INSERT INTO t1 SET a=NULL; +ROLLBACK; +set DEBUG_SYNC='now SIGNAL dml_done'; +ERROR 22004: Invalid use of NULL value +DROP TABLE t1; +SET DEBUG_SYNC="RESET"; +SET SQL_MODE=DEFAULT; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2), +UNIQUE KEY(f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB; +Warnings: +Note 1831 Duplicate index `f2_2`. This is deprecated and will be disallowed in a future release. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2` (`f2`), + UNIQUE KEY `f2_2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2_2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result index eb55ba57e36..0a8d1c2fefb 100644 --- a/mysql-test/suite/innodb/r/innodb-table-online.result +++ b/mysql-test/suite/innodb/r/innodb-table-online.result @@ -85,17 +85,6 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c2` (`c2`), UNIQUE KEY `c2_2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPY. -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL, - `c2` int(11) NOT NULL, - `c3` text NOT NULL, - UNIQUE KEY `c2` (`c2`), - UNIQUE KEY `c2_2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1); # session default SET DEBUG_SYNC = 'now WAIT_FOR scanned'; diff --git a/mysql-test/suite/innodb/t/alter_candidate_key.test b/mysql-test/suite/innodb/t/alter_candidate_key.test new file mode 100644 index 00000000000..7429cd89a1a --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_candidate_key.test @@ -0,0 +1,72 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL, + UNIQUE KEY uidx2(f1,f2), + UNIQUE KEY uidx1(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +SHOW CREATE TABLE t1; +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE +connect (con1,localhost,root,,); +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +DELETE FROM t1; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +reap; +SHOW CREATE TABLE t1; +CHECK TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT, f2 INT, + PRIMARY KEY(f1, f2), + UNIQUE INDEX uidx2 (f1, f2), + UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES(1, 1), (1, 1); +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +reap; +SHOW CREATE TABLE t1; +CHECK TABLE t1; +DROP TABLE t1; + +SET SQL_MODE= strict_trans_tables; +CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done'; +--send ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL +connection con1; +SET DEBUG_SYNC='now WAIT_FOR dml'; +BEGIN; +INSERT INTO t1 SET a=NULL; +ROLLBACK; +set DEBUG_SYNC='now SIGNAL dml_done'; +connection default; +--error ER_INVALID_USE_OF_NULL +reap; +DROP TABLE t1; +disconnect con1; +SET DEBUG_SYNC="RESET"; +SET SQL_MODE=DEFAULT; + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2), + UNIQUE KEY(f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB; +SHOW CREATE TABLE t1; +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index 4e9f2f13344..b0711412a52 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -100,10 +100,6 @@ LOCK = SHARED, ALGORITHM = INPLACE; ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK = EXCLUSIVE, ALGORITHM = INPLACE; -SHOW CREATE TABLE t1; -# We do not support plain DROP_PK_INDEX without ADD_PK_INDEX. ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE; SHOW CREATE TABLE t1; # Now the previous DEBUG_SYNC should kick in. --send diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2302026b18b..df1ff8eaf5d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6439,6 +6439,12 @@ static bool fill_alter_inplace_info(THD *thd, KEY *new_key; KEY *new_key_end= ha_alter_info->key_info_buffer + ha_alter_info->key_count; + /* + Primary key index for the new table + */ + const KEY* const new_pk= (ha_alter_info->key_count > 0 && + is_candidate_key(ha_alter_info->key_info_buffer)) ? + ha_alter_info->key_info_buffer : NULL; DBUG_PRINT("info", ("index count old: %d new: %d", table->s->keys, ha_alter_info->key_count)); @@ -6513,6 +6519,17 @@ static bool fill_alter_inplace_info(THD *thd, new_field->field->field_index != key_part->fieldnr - 1) goto index_changed; } + + /* + Rebuild the index if following condition get satisfied: + + (i) Old table doesn't have primary key, new table has it and vice-versa + (ii) Primary key changed to another existing index + */ + if ((new_key == new_pk) != + ((uint) (table_key - table->key_info) == table->s->primary_key)) + goto index_changed; + continue; index_changed: From edeba0c8733409865c3abcab881af0d48b7be94f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 23 Jan 2019 18:50:47 +0100 Subject: [PATCH 24/28] MDEV-17868 mysqltest fails to link with system PCRE libraries pcre needs symbols from pcreposix (but this is only an issue when linking with system static libraries) --- client/CMakeLists.txt | 2 +- libmysqld/examples/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index c75abd4956d..c760a9dbf14 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -41,7 +41,7 @@ ENDIF(UNIX) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") -TARGET_LINK_LIBRARIES(mysqltest mysqlclient pcre pcreposix) +TARGET_LINK_LIBRARIES(mysqltest mysqlclient pcreposix pcre) SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE) diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index d47638ad2f9..1eb07a2adf8 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -34,7 +34,7 @@ ENDIF(UNIX) MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc COMPONENT Test) -TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre pcreposix) +TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcreposix pcre) IF(CMAKE_GENERATOR MATCHES "Xcode") # It does not seem possible to tell Xcode the resulting target might need From ba1ce3aeae49b6c8055d673e6dafff741f1a9713 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Thu, 24 Jan 2019 12:01:43 +0200 Subject: [PATCH 25/28] MDEV-17803 side effect resulted in table id advance. A test result file is updated. --- mysql-test/r/mysqlbinlog_row_minimal.result | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mysql-test/r/mysqlbinlog_row_minimal.result b/mysql-test/r/mysqlbinlog_row_minimal.result index 6ffaeeafc53..34bafd6301a 100644 --- a/mysql-test/r/mysqlbinlog_row_minimal.result +++ b/mysql-test/r/mysqlbinlog_row_minimal.result @@ -54,9 +54,9 @@ CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMIN BEGIN /*!*/; # at 781 -# server id 1 end_log_pos 833 Table_map: `test`.`t1` mapped to number 30 +# server id 1 end_log_pos 833 Table_map: `test`.`t1` mapped to number 31 # at 833 -# server id 1 end_log_pos 898 Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 898 Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -79,9 +79,9 @@ COMMIT BEGIN /*!*/; # at 1005 -# server id 1 end_log_pos 1057 Table_map: `test`.`t1` mapped to number 30 +# server id 1 end_log_pos 1057 Table_map: `test`.`t1` mapped to number 31 # at 1057 -# server id 1 end_log_pos 1121 Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1121 Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -104,9 +104,9 @@ COMMIT BEGIN /*!*/; # at 1228 -# server id 1 end_log_pos 1280 Table_map: `test`.`t1` mapped to number 30 +# server id 1 end_log_pos 1280 Table_map: `test`.`t1` mapped to number 31 # at 1280 -# server id 1 end_log_pos 1343 Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1343 Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -129,9 +129,9 @@ COMMIT BEGIN /*!*/; # at 1450 -# server id 1 end_log_pos 1502 Table_map: `test`.`t1` mapped to number 30 +# server id 1 end_log_pos 1502 Table_map: `test`.`t1` mapped to number 31 # at 1502 -# server id 1 end_log_pos 1568 Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1568 Write_rows: table id 31 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -154,9 +154,9 @@ COMMIT BEGIN /*!*/; # at 1675 -# server id 1 end_log_pos 1727 Table_map: `test`.`t2` mapped to number 31 +# server id 1 end_log_pos 1727 Table_map: `test`.`t2` mapped to number 32 # at 1727 -# server id 1 end_log_pos 1890 Write_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 1890 Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -212,9 +212,9 @@ COMMIT BEGIN /*!*/; # at 1997 -# server id 1 end_log_pos 2049 Table_map: `test`.`t2` mapped to number 31 +# server id 1 end_log_pos 2049 Table_map: `test`.`t2` mapped to number 32 # at 2049 -# server id 1 end_log_pos 2119 Update_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 2119 Update_rows: table id 32 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -244,9 +244,9 @@ COMMIT BEGIN /*!*/; # at 2226 -# server id 1 end_log_pos 2278 Table_map: `test`.`t1` mapped to number 30 +# server id 1 end_log_pos 2278 Table_map: `test`.`t1` mapped to number 31 # at 2278 -# server id 1 end_log_pos 2328 Delete_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 2328 Delete_rows: table id 31 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -270,9 +270,9 @@ COMMIT BEGIN /*!*/; # at 2435 -# server id 1 end_log_pos 2487 Table_map: `test`.`t2` mapped to number 31 +# server id 1 end_log_pos 2487 Table_map: `test`.`t2` mapped to number 32 # at 2487 -# server id 1 end_log_pos 2537 Delete_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 2537 Delete_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ From 46f712c73c4e4f9b1df7245ce3e5f51281033d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 24 Jan 2019 12:31:54 +0200 Subject: [PATCH 26/28] MDEV-15114: Fix memory leaks When innobase_allocate_row_for_vcol() returns true (for failure), it may already have invoked mem_heap_create(). However, some callers would fail to invoke mem_heap_free(). --- storage/innobase/row/row0ins.cc | 8 ++++---- storage/innobase/row/row0upd.cc | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index e60e350b9f6..eb2a2c6adf7 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -966,11 +966,11 @@ row_ins_foreign_fill_virtual( if (innobase_allocate_row_for_vcol(thd, index, &v_heap, &mysql_table, - &record, &vcol_storage)) - { + &record, &vcol_storage)) { + if (v_heap) mem_heap_free(v_heap); *err = DB_OUT_OF_MEMORY; - goto func_exit; - } + goto func_exit; + } for (ulint i = 0; i < n_v_fld; i++) { diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 1a27ab80b35..dc356f076ea 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1162,6 +1162,7 @@ row_upd_build_difference_binary( &v_heap, heap, NULL, thd, mysql_table, record, NULL, NULL, NULL); if (vfield == NULL) { + if (v_heap) mem_heap_free(v_heap); *error = DB_COMPUTE_VALUE_FAILED; return(NULL); } From 7930ab7e3326408e6b4d18ca057db93a8b61cc49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 24 Jan 2019 12:36:10 +0200 Subject: [PATCH 27/28] Comment out the statement that triggers MDEV-18366 --- mysql-test/suite/gcol/r/innodb_virtual_index.result | 3 --- mysql-test/suite/gcol/t/innodb_virtual_index.test | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result index b62c94ce409..fb223f3f152 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_index.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result @@ -259,9 +259,6 @@ ERROR 22007: Incorrect date value: '20190132' for column `test`.`t1`.`vb` at row SELECT * FROM t1; a b vb ROLLBACK; -SELECT * FROM t1; -a b vb -1 20190132 0000-00-00 CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test index 7aa241356c2..a89ae813b05 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_index.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test @@ -278,6 +278,7 @@ DELETE FROM t1; INSERT INTO t1 (a,b) VALUES(1,20190123); SELECT * FROM t1; ROLLBACK; -SELECT * FROM t1; +# MDEV-18366 FIXME: fix the crash and enable this +# SELECT * FROM t1; CHECK TABLE t1; DROP TABLE t1; From fab531a150ec588f87e8a636d2ba1ecbfffdb08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 24 Jan 2019 15:57:26 +0200 Subject: [PATCH 28/28] Fix the build after MDEV-17803 Use the same data type 'ulong' to avoid type mismatch on Windows and on 32-bit systems. FIXME: The correct data type should probably be 64-bit. --- sql/log_event.cc | 6 +++--- sql/table.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 28374fdd8c9..f6b89cd1a80 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12093,8 +12093,8 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi) table_list->updating= 1; table_list->required_type= FRMTYPE_TABLE; - DBUG_PRINT("debug", ("table: %s is mapped to %u", table_list->table_name, - table_list->table_id)); + DBUG_PRINT("debug", ("table: %s is mapped to %lu", table_list->table_name, + table_list->table_id)); table_list->master_had_triggers= ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? 1 : 0); DBUG_PRINT("debug", ("table->master_had_triggers=%d", (int)table_list->master_had_triggers)); diff --git a/sql/table.h b/sql/table.h index f517f54ec82..85b63eda010 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1,7 +1,7 @@ #ifndef TABLE_INCLUDED #define TABLE_INCLUDED /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1892,7 +1892,7 @@ struct TABLE_LIST /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ List *index_hints; TABLE *table; /* opened table */ - ulonglong table_id; /* table id (from binlog) for opened table */ + ulong table_id; /* table id (from binlog) for opened table */ /* select_result for derived table to pass it from table creation to table filling procedure