From 0a224edc3e24b28a3b2abcd3538a3d7d63d667c6 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Sat, 19 Sep 2020 00:08:38 +0300 Subject: [PATCH 1/8] MDEV-23711 make mariabackup innodb redo log read error message more clear log_group_read_log_seg() returns error when: 1) Calculated log block number does not correspond to read log block number. This can be caused by: a) Garbage or an incompletely written log block. We can exclude this case by checking log block checksum if it's enabled(see innodb-log-checksums, encrypted log block contains checksum always). b) The log block is overwritten. In this case checksum will be correct and read log block number will be greater then requested one. 2) When log block length is wrong. In this case recv_sys->found_corrupt_log is set. 3) When redo log block checksum is wrong. In this case innodb code writes messages to error log with the following prefix: "Invalid log block checksum." The fix processes all the cases above. --- extra/mariabackup/xtrabackup.cc | 19 ++++- .../mariabackup/innodb_redo_overwrite.opt | 1 + .../mariabackup/innodb_redo_overwrite.result | 28 ++++++++ .../mariabackup/innodb_redo_overwrite.test | 70 +++++++++++++++++++ storage/innobase/log/log0recv.cc | 2 + 5 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 mysql-test/suite/mariabackup/innodb_redo_overwrite.opt create mode 100644 mysql-test/suite/mariabackup/innodb_redo_overwrite.result create mode 100644 mysql-test/suite/mariabackup/innodb_redo_overwrite.test diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 4845f51e6b2..231e3c04f16 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2773,6 +2773,7 @@ static bool xtrabackup_copy_logfile(bool last = false) ut_a(dst_log_file != NULL); ut_ad(recv_sys != NULL); + bool overwritten_block; lsn_t start_lsn; lsn_t end_lsn; @@ -2799,6 +2800,12 @@ static bool xtrabackup_copy_logfile(bool last = false) } if (lsn == start_lsn) { + overwritten_block= !recv_sys->found_corrupt_log + && (innodb_log_checksums || log_sys->log.is_encrypted()) + && log_block_calc_checksum_crc32(log_sys->buf) == + log_block_get_checksum(log_sys->buf) + && log_block_get_hdr_no(log_sys->buf) > + log_block_convert_lsn_to_no(start_lsn); start_lsn = 0; } else { mutex_enter(&recv_sys->mutex); @@ -2809,9 +2816,15 @@ static bool xtrabackup_copy_logfile(bool last = false) log_mutex_exit(); if (!start_lsn) { - die(recv_sys->found_corrupt_log - ? "xtrabackup_copy_logfile() failed: corrupt log." - : "xtrabackup_copy_logfile() failed."); + const char *reason = recv_sys->found_corrupt_log + ? "corrupt log." + : (overwritten_block + ? "redo log block is overwritten, please increase redo log size with innodb_log_file_size parameter." + : ((innodb_log_checksums || log_sys->log.is_encrypted()) + ? "redo log block checksum does not match." + : "unknown reason as innodb_log_checksums is switched off and redo" + " log is not encrypted.")); + die("xtrabackup_copy_logfile() failed: %s", reason); return true; } } while (start_lsn == end_lsn); diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt new file mode 100644 index 00000000000..7111d384b40 --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.opt @@ -0,0 +1 @@ +--loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2 diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.result b/mysql-test/suite/mariabackup/innodb_redo_overwrite.result new file mode 100644 index 00000000000..571bfd35c70 --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.result @@ -0,0 +1,28 @@ +CREATE TABLE t(i INT) ENGINE=INNODB; +INSERT INTO t VALUES +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9), +(0), (1), (2), (3), (4), (5), (6), (7), (8), (9); +# Generate enough data to overwrite innodb redo log +# on the next "INSERT INTO t SELECT * FROM t" execution. +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +INSERT INTO t SELECT * FROM t; +# xtrabackup backup +FOUND 1 /failed: redo log block is overwritten/ in backup.log +FOUND 1 /failed: redo log block checksum does not match/ in backup.log +FOUND 1 /failed: unknown reason/ in backup.log +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/innodb_redo_overwrite.test b/mysql-test/suite/mariabackup/innodb_redo_overwrite.test new file mode 100644 index 00000000000..55e754f18d7 --- /dev/null +++ b/mysql-test/suite/mariabackup/innodb_redo_overwrite.test @@ -0,0 +1,70 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc + +CREATE TABLE t(i INT) ENGINE=INNODB; + +INSERT INTO t VALUES + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); +--echo # Generate enough data to overwrite innodb redo log +--echo # on the next "INSERT INTO t SELECT * FROM t" execution. +--let $i = 0 +while ($i < 9) { +INSERT INTO t SELECT * FROM t; +--inc $i +} + +--echo # xtrabackup backup +--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup +--let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log + +--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * FROM test.t + +--disable_result_log +--error 1 +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events > $backuplog +--enable_result_log + +--let SEARCH_PATTERN=failed: redo log block is overwritten +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +--remove_file $backuplog +--rmdir $targetdir + +--let before_innodb_log_copy_thread_started=INSERT INTO test.t VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9) + +--disable_result_log +--error 1 +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events,log_checksum_mismatch > $backuplog +--enable_result_log + +--let SEARCH_PATTERN=failed: redo log block checksum does not match +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +--remove_file $backuplog +--rmdir $targetdir + +--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * FROM test.t LIMIT 50000 + +--disable_result_log +--error 1 +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --innodb-log-checksums=0 --dbug=+d,mariabackup_events > $backuplog +--enable_result_log + +--let SEARCH_PATTERN=failed: unknown reason +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +--remove_file $backuplog +--rmdir $targetdir + +--let before_innodb_log_copy_thread_started= + +DROP TABLE t; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index cf05563be02..446e0afe576 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -965,6 +965,8 @@ fail: } }); + DBUG_EXECUTE_IF("log_checksum_mismatch", { cksum = crc + 1; }); + if (crc != cksum) { ib::error() << "Invalid log block checksum." << " block: " << block_number From 6c4c88dbb899adf4a7a3c9313a0e705c660b6994 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Mon, 21 Sep 2020 12:52:44 +0300 Subject: [PATCH 2/8] MDEV-18867: Remove an orphan function --- storage/innobase/fts/fts0fts.cc | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 8ff872eab29..8a6901bd15b 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -5746,22 +5746,6 @@ fts_savepoint_rollback( } } -/*********************************************************************//** -Compare two fts_aux_table_t parent_ids. -@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */ -UNIV_INLINE -int -fts_check_aux_table_parent_id_cmp( -/*==============================*/ - const void* p1, /*!< in: id1 */ - const void* p2) /*!< in: id2 */ -{ - const fts_aux_table_t* fa1 = static_cast(p1); - const fts_aux_table_t* fa2 = static_cast(p2); - - return static_cast(fa1->parent_id - fa2->parent_id); -} - bool fts_check_aux_table(const char *name, table_id_t *table_id, index_id_t *index_id) From a0e2a293bcc25fb10888fd00bd63bce04c195524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 21 Sep 2020 13:59:13 +0300 Subject: [PATCH 3/8] Fix try. --- .../suite/galera_3nodes/galera_2x3nodes.cnf | 6 ++ .../r/galera_gtid_2_cluster.result | 76 ++++++++++++++++++- .../t/galera_gtid_2_cluster.test | 14 +++- 3 files changed, 91 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf index 477789175fb..34ef09875ea 100644 --- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -28,6 +28,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#gale wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' +wsrep-on=1 [mysqld.2] #galera_port=@OPT.port @@ -39,6 +40,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#gale wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' +wsrep-on=1 [mysqld.3] #galera_port=@OPT.port @@ -50,6 +52,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#gale wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' +wsrep-on=1 [mysqld.4] @@ -64,6 +67,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#gale wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' +wsrep-on=1 [mysqld.5] wsrep_cluster_name=cluster2 @@ -76,6 +80,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#gale wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port' +wsrep-on=1 [mysqld.6] wsrep_cluster_name=cluster2 @@ -88,6 +93,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#gale wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port' +wsrep-on=1 [ENV] NODE_MYPORT_1= @mysqld.1.port diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result index 35ca84119e7..43064cf6441 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -1,27 +1,38 @@ +connection node_1; cluster 1 node 1 SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 +connection node_2; cluster 1 node 2 SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; cluster 1 node 3 SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 +connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; +connection node_4; cluster 2 node 1 SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 +connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5; +connection node_5; cluster 2 node 2 SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 +connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6; +connection node_6; cluster 2 node 3 SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 +connection node_1; change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);; start slave; include/wait_for_slave_to_start.inc @@ -31,6 +42,7 @@ select @@gtid_binlog_state; select @@gtid_slave_pos; @@gtid_slave_pos +connection node_4; change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);; start slave; include/wait_for_slave_to_start.inc @@ -41,15 +53,19 @@ select @@gtid_slave_pos; @@gtid_slave_pos cluster 1 node 1 +connection node_1; create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); insert into t1 values (1, 11, 2); select @@gtid_binlog_state; @@gtid_binlog_state 1-11-2 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 2 node 1 +connection node_4; select @@gtid_binlog_state; @@gtid_binlog_state 1-11-2 @@ -62,31 +78,40 @@ cluster_domain_id node_server_id seq_no 1 11 2 2 21 1 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 1 node 2 +connection node_2; select @@gtid_binlog_state; @@gtid_binlog_state -1-11-2,2-21-1 +1-11-2 insert into t1 values (1, 12, 3); select @@gtid_binlog_state; @@gtid_binlog_state 1-11-2,1-12-3,2-21-1 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 1 node 3 +connection node_3; select @@gtid_binlog_state; @@gtid_binlog_state -1-11-2,1-12-3,2-21-1 +1-11-2,2-21-1 insert into t1 values (1, 13, 4); select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 2 node 2 +connection node_5; select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1 @@ -95,9 +120,12 @@ select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 #wait for sync cluster 2 and 1 +connection node_4; include/save_master_gtid.inc +connection node_1; include/sync_with_master_gtid.inc cluster 2 node 3 +connection node_6; select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 @@ -106,9 +134,12 @@ select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 #wait for sync cluster 2 and 1 +connection node_4; include/save_master_gtid.inc +connection node_1; include/sync_with_master_gtid.inc cluster 1 node 1 +connection node_1; select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 @@ -119,15 +150,21 @@ change master to master_use_gtid=no, ignore_server_ids=(); reset master; set global GTID_SLAVE_POS=""; cluster 2 node 1 +connection node_4; stop slave; reset slave; change master to master_use_gtid=no, ignore_server_ids=(); reset master; set global GTID_SLAVE_POS=""; +connection node_2; reset master; +connection node_3; reset master; +connection node_5; reset master; +connection node_6; reset master; +connection node_1; change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);; start slave; include/wait_for_slave_to_start.inc @@ -137,6 +174,7 @@ select @@gtid_binlog_state; select @@gtid_slave_pos; @@gtid_slave_pos +connection node_4; change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);; start slave; include/wait_for_slave_to_start.inc @@ -147,15 +185,19 @@ select @@gtid_slave_pos; @@gtid_slave_pos cluster 1 node 1 -create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +connection node_1; +create table t1 (cluster_domain_id int not null,node_server_id int not null, seq_no int not null, primary key(cluster_domain_id, node_server_id,seq_no)) engine=innodb; insert into t1 values (1, 11, 2); select @@gtid_binlog_state; @@gtid_binlog_state 1-11-2 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 2 node 1 +connection node_4; insert into t1 values (2, 21, 1); select @@gtid_binlog_state; @@gtid_binlog_state @@ -165,9 +207,12 @@ cluster_domain_id node_server_id seq_no 1 11 2 2 21 1 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 1 node 2 +connection node_2; select @@gtid_binlog_state; @@gtid_binlog_state 1-11-2,2-21-1 @@ -176,9 +221,12 @@ select @@gtid_binlog_state; @@gtid_binlog_state 1-11-2,1-12-3,2-21-1 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 1 node 3 +connection node_3; select @@gtid_binlog_state; @@gtid_binlog_state 1-11-2,1-12-3,2-21-1 @@ -187,9 +235,12 @@ select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1 #wait for sync cluster 1 and 2 +connection node_1; include/save_master_gtid.inc +connection node_4; include/sync_with_master_gtid.inc cluster 2 node 2 +connection node_5; select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1 @@ -198,9 +249,12 @@ select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 #wait for sync cluster 2 and 1 +connection node_4; include/save_master_gtid.inc +connection node_1; include/sync_with_master_gtid.inc cluster 2 node 3 +connection node_6; select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 @@ -209,9 +263,12 @@ select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 #wait for sync cluster 2 and 1 +connection node_4; include/save_master_gtid.inc +connection node_1; include/sync_with_master_gtid.inc cluster 1 node 1 +connection node_1; select @@gtid_binlog_state; @@gtid_binlog_state 1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 @@ -221,11 +278,24 @@ change master to master_use_gtid=no, ignore_server_ids=(); reset master; set global GTID_SLAVE_POS=""; cluster 2 node 1 +connection node_4; stop slave; change master to master_use_gtid=no, ignore_server_ids=(); reset master; set global GTID_SLAVE_POS=""; +connection node_2; +set session wsrep_on=off; reset master; +set session wsrep_on=on; +connection node_3; +set session wsrep_on=off; reset master; +set session wsrep_on=on; +connection node_5; +set session wsrep_on=off; reset master; +set session wsrep_on=on; +connection node_6; +set session wsrep_on=off; reset master; +set session wsrep_on=on; diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test index c679db1305d..2bb8d06462c 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test @@ -10,7 +10,7 @@ --source include/big_test.inc --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/force_restart.inc --connection node_1 --echo cluster 1 node 1 @@ -29,6 +29,7 @@ SHOW STATUS LIKE 'wsrep_cluster_size'; --connection node_4 --echo cluster 2 node 1 SHOW STATUS LIKE 'wsrep_cluster_size'; +call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log.*"); --connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 --connection node_5 @@ -193,7 +194,7 @@ select @@gtid_slave_pos; --echo cluster 1 node 1 --connection node_1 -create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +create table t1 (cluster_domain_id int not null,node_server_id int not null, seq_no int not null, primary key(cluster_domain_id, node_server_id,seq_no)) engine=innodb; insert into t1 values (1, 11, 2); select @@gtid_binlog_state; @@ -283,10 +284,19 @@ reset master; set global GTID_SLAVE_POS=""; --connection node_2 +set session wsrep_on=off; reset master; +set session wsrep_on=on; --connection node_3 +set session wsrep_on=off; reset master; +set session wsrep_on=on; --connection node_5 +set session wsrep_on=off; reset master; +set session wsrep_on=on; --connection node_6 +set session wsrep_on=off; reset master; +set session wsrep_on=on; + From a3bdce8f1e268e3ac57644faf91c9c5ad43f5291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 21 Sep 2020 14:01:56 +0300 Subject: [PATCH 4/8] MDEV-23659 : Update Galera disabled.def file --- mysql-test/suite/galera_3nodes/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index c6d3ece75d1..0e2706f2dc3 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -10,6 +10,7 @@ # ############################################################################## +galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_gtid_2_cluster galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(} galera_slave_options_do :MDEV-8798 galera_slave_options_ignore : MDEV-8798 From e33f7b6faaacf49881fd913115b0735c62aba395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 21 Sep 2020 15:55:27 +0300 Subject: [PATCH 5/8] MDEV-23776 Test encryption.create_or_replace fails with a warning The test encryption.create_or_replace would occasionally fail with a warning message from fil_check_pending_ops(). fil_crypt_find_space_to_rotate(): While waiting for available I/O capacity, check fil_space_t::is_stopping() and release a handle if necessary. fil_space_crypt_close_tablespace(): Wake up the waiters in fil_crypt_find_space_to_rotate(). --- storage/innobase/fil/fil0crypt.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 09f2730edec..16b2093b691 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1483,6 +1483,11 @@ static bool fil_crypt_find_space_to_rotate( { /* we need iops to start rotating */ while (!state->should_shutdown() && !fil_crypt_alloc_iops(state)) { + if (state->space && state->space->is_stopping()) { + fil_space_release(state->space); + state->space = NULL; + } + os_event_reset(fil_crypt_threads_event); os_event_wait_time(fil_crypt_threads_event, 100000); } @@ -2506,6 +2511,7 @@ fil_space_crypt_close_tablespace( /* wakeup throttle (all) sleepers */ os_event_set(fil_crypt_throttle_sleep_event); + os_event_set(fil_crypt_threads_event); os_thread_sleep(20000); dict_mutex_enter_for_mysql(); From a9d8f5c1a55e03312211c637a1a916cc57573a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 21 Sep 2020 16:14:35 +0300 Subject: [PATCH 6/8] MDEV-23776: Split encryption.create_or_replace Let us shrink the test encryption.create_or_replace so that it can run on the CI system, also on the embedded server. encryption.create_or_replace_big: Renamed from the original test, with the subset of encryption.create_or_replace omitted. --- ...ce.result => create_or_replace_big.result} | 9 +-- ..._replace.opt => create_or_replace_big.opt} | 0 ...eplace.test => create_or_replace_big.test} | 58 +------------------ 3 files changed, 2 insertions(+), 65 deletions(-) rename mysql-test/suite/encryption/r/{create_or_replace.result => create_or_replace_big.result} (82%) rename mysql-test/suite/encryption/t/{create_or_replace.opt => create_or_replace_big.opt} (100%) rename mysql-test/suite/encryption/t/{create_or_replace.test => create_or_replace_big.test} (63%) diff --git a/mysql-test/suite/encryption/r/create_or_replace.result b/mysql-test/suite/encryption/r/create_or_replace_big.result similarity index 82% rename from mysql-test/suite/encryption/r/create_or_replace.result rename to mysql-test/suite/encryption/r/create_or_replace_big.result index 1671043b50d..87f56cc3e2c 100644 --- a/mysql-test/suite/encryption/r/create_or_replace.result +++ b/mysql-test/suite/encryption/r/create_or_replace_big.result @@ -12,15 +12,8 @@ INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL); INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 ); INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 ); INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 ); -connect con1,localhost,root,,test; -connect con2,localhost,root,,test; -connection default; -drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc; -disconnect con1; -disconnect con2; -SET GLOBAL innodb_encrypt_tables = OFF; -SET GLOBAL innodb_encryption_threads = 4; # Wait max 10 min for key encryption threads to decrypt all spaces # Success! SET GLOBAL innodb_encryption_threads = 0; SET GLOBAL innodb_encrypt_tables = OFF; +DROP TABLE table0_int_autoinc, table1_int_autoinc, table10_int_autoinc; diff --git a/mysql-test/suite/encryption/t/create_or_replace.opt b/mysql-test/suite/encryption/t/create_or_replace_big.opt similarity index 100% rename from mysql-test/suite/encryption/t/create_or_replace.opt rename to mysql-test/suite/encryption/t/create_or_replace_big.opt diff --git a/mysql-test/suite/encryption/t/create_or_replace.test b/mysql-test/suite/encryption/t/create_or_replace_big.test similarity index 63% rename from mysql-test/suite/encryption/t/create_or_replace.test rename to mysql-test/suite/encryption/t/create_or_replace_big.test index 3b2970e5162..133bdfa3cb2 100644 --- a/mysql-test/suite/encryption/t/create_or_replace.test +++ b/mysql-test/suite/encryption/t/create_or_replace_big.test @@ -55,62 +55,6 @@ INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 ); INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 ); ---connect (con1,localhost,root,,test) ---connect (con2,localhost,root,,test) - ---disable_abort_on_error ---disable_warnings ---disable_query_log - -let $i = 500; -while ($i) -{ -connection con1; -send SET GLOBAL innodb_encrypt_tables = ON; -connection default; -CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; -connection con2; -send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; -connection default; -send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`; -connection con1; ---reap; -send SET GLOBAL innodb_encrypt_tables = OFF; -connection con2; ---reap; -connection default; ---reap; -send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; -connection con2; -send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; -connection con1; ---reap; -send SET GLOBAL innodb_encrypt_tables = ON; -connection default; ---reap; -send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; -connection con2; ---reap; -CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; -CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`; -connection con1; ---reap; -connection default; ---reap; -dec $i; -} - ---enable_query_log -connection default; -drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc; ---disconnect con1 ---disconnect con2 ---enable_abort_on_error ---enable_warnings - -SET GLOBAL innodb_encrypt_tables = OFF; -SET GLOBAL innodb_encryption_threads = 4; - --echo # Wait max 10 min for key encryption threads to decrypt all spaces let $cnt=600; while ($cnt) @@ -137,6 +81,6 @@ if (!$success) SET GLOBAL innodb_encryption_threads = 0; SET GLOBAL innodb_encrypt_tables = OFF; -# Make sure that all dirty pages are flushed +DROP TABLE table0_int_autoinc, table1_int_autoinc, table10_int_autoinc; -- source include/restart_mysqld.inc From 407d170c926d91d176dd8aca2040462db4241fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 21 Sep 2020 16:29:29 +0300 Subject: [PATCH 7/8] MDEV-23711 fixup: GCC -Og -Wmaybe-uninitialized --- extra/mariabackup/xtrabackup.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 231e3c04f16..33a64356366 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2773,7 +2773,7 @@ static bool xtrabackup_copy_logfile(bool last = false) ut_a(dst_log_file != NULL); ut_ad(recv_sys != NULL); - bool overwritten_block; + bool overwritten_block = false; lsn_t start_lsn; lsn_t end_lsn; From e05650e6868eab2dbb9f58c4786bcc71afc4ffce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 21 Sep 2020 16:35:28 +0300 Subject: [PATCH 8/8] MDEV-23776: Add the reduced encryption.create_or_replace test This was forgotten in commit a9d8f5c1a55e03312211c637a1a916cc57573a73. --- .../encryption/r/create_or_replace.result | 21 +++++ .../suite/encryption/t/create_or_replace.test | 80 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 mysql-test/suite/encryption/r/create_or_replace.result create mode 100644 mysql-test/suite/encryption/t/create_or_replace.test diff --git a/mysql-test/suite/encryption/r/create_or_replace.result b/mysql-test/suite/encryption/r/create_or_replace.result new file mode 100644 index 00000000000..62dac4ccc43 --- /dev/null +++ b/mysql-test/suite/encryption/r/create_or_replace.result @@ -0,0 +1,21 @@ +SET @save_threads = @@GLOBAL.innodb_encryption_threads; +SET @save_tables = @@GLOBAL.innodb_encrypt_tables; +SET default_storage_engine = InnoDB; +SET GLOBAL innodb_encryption_threads = 4; +CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb; +INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3); +CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb; +CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb; +INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL); +INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 ); +INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 ); +INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 ); +connect con1,localhost,root,,test; +connect con2,localhost,root,,test; +disconnect con1; +disconnect con2; +connection default; +drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc, +table10_int_autoinc; +SET GLOBAL innodb_encryption_threads = @save_threads; +SET GLOBAL innodb_encrypt_tables = @save_tables; diff --git a/mysql-test/suite/encryption/t/create_or_replace.test b/mysql-test/suite/encryption/t/create_or_replace.test new file mode 100644 index 00000000000..8d571794713 --- /dev/null +++ b/mysql-test/suite/encryption/t/create_or_replace.test @@ -0,0 +1,80 @@ +--source include/have_innodb.inc +--source include/have_file_key_management_plugin.inc +--source include/count_sessions.inc + +SET @save_threads = @@GLOBAL.innodb_encryption_threads; +SET @save_tables = @@GLOBAL.innodb_encrypt_tables; + +SET default_storage_engine = InnoDB; + +# +# MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1 +# + +SET GLOBAL innodb_encryption_threads = 4; + +CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb; +INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3); + +CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb; + +CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb; + +INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL); +INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 ); +INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 ); +INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 ); + +--connect (con1,localhost,root,,test) +--connect (con2,localhost,root,,test) + +--disable_query_log + +let $i = 100; +while ($i) +{ +connection con1; +send SET GLOBAL innodb_encrypt_tables = ON; +connection default; +CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; +connection con2; +send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; +connection default; +send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`; +connection con1; +--reap; +send SET GLOBAL innodb_encrypt_tables = OFF; +connection con2; +--reap; +connection default; +--reap; +send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; +connection con2; +send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; +connection con1; +--reap; +send SET GLOBAL innodb_encrypt_tables = ON; +connection default; +--reap; +send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`; +connection con2; +--reap; +CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`; +CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`; +connection con1; +--reap; +connection default; +--reap; +dec $i; +} + +--enable_query_log +disconnect con1; +disconnect con2; +connection default; +drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc, +table10_int_autoinc; + +SET GLOBAL innodb_encryption_threads = @save_threads; +SET GLOBAL innodb_encrypt_tables = @save_tables; +--source include/wait_until_count_sessions.inc