diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-05-18 10:34:38 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2022-05-18 10:34:38 +0200 |
commit | 99a433ed1cc2cebad93d6ece2b65691f2f49d3ea (patch) | |
tree | e7fc16ab8fe9b4b9ff486d1adbc27ed84c72b923 | |
parent | 0a1d9d0681fda7595c0d08038357b56cf3bea9eb (diff) | |
parent | b2187662bcba12b66667bc0531727453b3b8a666 (diff) | |
download | mariadb-git-99a433ed1cc2cebad93d6ece2b65691f2f49d3ea.tar.gz |
Merge branch '10.6' into 10.7mariadb-10.7.4
96 files changed, 2793 insertions, 623 deletions
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 038251c40e2..c3ade74b3b3 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -23,6 +23,8 @@ ENDIF() SET(MY_WARNING_FLAGS -Wall -Wdeclaration-after-statement + -Wenum-compare + -Wenum-conversion -Wextra -Wformat-security -Wno-format-truncation diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 76a1d88e56c..528dbaac898 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -51,6 +51,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include <my_getopt.h> #include <mysql_com.h> #include <my_default.h> +#include <scope.h> #include <sql_class.h> #include <fcntl.h> @@ -4603,13 +4604,6 @@ fail: } - if (auto b = aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) { - field_ref_zero = static_cast<byte*>( - memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); - } else { - goto fail; - } - { /* definition from recv_recovery_from_checkpoint_start() */ ulint max_cp_field; @@ -4626,10 +4620,6 @@ reread_log_header: msg("Error: cannot read redo log header"); unlock_and_fail: mysql_mutex_unlock(&log_sys.mutex); -free_and_fail: - aligned_free(const_cast<byte*>(field_ref_zero)); - field_ref_zero = nullptr; - goto fail; } if (log_sys.log.format == 0) { @@ -4655,7 +4645,7 @@ free_and_fail: xtrabackup_init_datasinks(); if (!select_history()) { - goto free_and_fail; + goto fail; } /* open the log file */ @@ -4664,7 +4654,7 @@ free_and_fail: if (dst_log_file == NULL) { msg("Error: failed to open the target stream for '%s'.", LOG_FILE_NAME); - goto free_and_fail; + goto fail; } /* label it */ @@ -4702,7 +4692,7 @@ free_and_fail: if (ds_write(dst_log_file, log_hdr_buf, LOG_FILE_HDR_SIZE)) { msg("error: write to logfile failed"); aligned_free(log_hdr_buf); - goto free_and_fail; + goto fail; } aligned_free(log_hdr_buf); @@ -4723,7 +4713,7 @@ free_and_fail: " error %s.", ut_strerr(err)); fail_before_log_copying_thread_start: log_copying_running = false; - goto free_and_fail; + goto fail; } /* copy log file by current position */ @@ -4746,7 +4736,7 @@ fail_before_log_copying_thread_start: /* FLUSH CHANGED_PAGE_BITMAPS call */ if (!flush_changed_page_bitmaps()) { - goto free_and_fail; + goto fail; } ut_a(xtrabackup_parallel > 0); @@ -4814,9 +4804,6 @@ fail_before_log_copying_thread_start: if (opt_log_innodb_page_corruption) ok = corrupted_pages.print_to_file(MB_CORRUPTED_PAGES_FILE); - aligned_free(const_cast<byte*>(field_ref_zero)); - field_ref_zero = nullptr; - if (!ok) { goto fail; } @@ -7004,6 +6991,20 @@ static int main_low(char** argv) } } + ut_ad(!field_ref_zero); + if (auto b = aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) { + field_ref_zero = static_cast<byte*>( + memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); + } else { + msg("Can't allocate memory for field_ref_zero"); + return EXIT_FAILURE; + } + + auto _ = make_scope_exit([]() { + aligned_free(const_cast<byte*>(field_ref_zero)); + field_ref_zero = nullptr; + }); + /* --backup */ if (xtrabackup_backup && !xtrabackup_backup_func()) { return(EXIT_FAILURE); diff --git a/mysql-test/include/have_log_bin.inc b/mysql-test/include/have_log_bin.inc index eb2529dae3b..fd5dc66e416 100644 --- a/mysql-test/include/have_log_bin.inc +++ b/mysql-test/include/have_log_bin.inc @@ -8,7 +8,6 @@ source include/not_embedded.inc; --- require include/have_log_bin.require -disable_query_log; -show variables like 'log_bin'; -enable_query_log; +if (`select not @@log_bin`) { + skip Test requires: 'have_log_bin'; +} diff --git a/mysql-test/include/have_log_bin.require b/mysql-test/include/have_log_bin.require deleted file mode 100644 index d4fd77e4f8d..00000000000 --- a/mysql-test/include/have_log_bin.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -log_bin ON diff --git a/mysql-test/main/alter_table_lock.result b/mysql-test/main/alter_table_lock.result index ce6097c9ada..620fca23315 100644 --- a/mysql-test/main/alter_table_lock.result +++ b/mysql-test/main/alter_table_lock.result @@ -11,8 +11,6 @@ ERROR 42S02: Table 'test.x' doesn't exist SET SESSION max_session_mem_used= 8192; LOCK TABLE t1 WRITE; ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; -Warnings: -Note 1054 Unknown column 'b' in 't1' SET SESSION max_session_mem_used = @max_session_mem_used_save; UNLOCK TABLES; DROP TABLE t1; diff --git a/mysql-test/main/alter_table_lock.test b/mysql-test/main/alter_table_lock.test index f1f60e38b61..bd26c1ac7d0 100644 --- a/mysql-test/main/alter_table_lock.test +++ b/mysql-test/main/alter_table_lock.test @@ -14,9 +14,13 @@ SELECT * FROM t1; ALTER TABLE x MODIFY xx INT; SET SESSION max_session_mem_used= 8192; +--error 0,ER_OPTION_PREVENTS_STATEMENT LOCK TABLE t1 WRITE; +--disable_warnings +--error 0,ER_OPTION_PREVENTS_STATEMENT ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; +--enable_warnings SET SESSION max_session_mem_used = @max_session_mem_used_save; UNLOCK TABLES; diff --git a/mysql-test/main/insert.result b/mysql-test/main/insert.result index 674223c17a4..22682e180c6 100644 --- a/mysql-test/main/insert.result +++ b/mysql-test/main/insert.result @@ -776,6 +776,14 @@ select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0))); ERROR 42S22: Unknown column 't1.a' in 'on clause' drop table t; # +# MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT +# +create table t1 (i int) ; +create table t2 (j int) ; +create table t4 select * from t1 join t2 on (select t3.i); +ERROR 42S22: Unknown column 't3.i' in 'field list' +drop table t1, t2; +# # End of 10.4 tests # # diff --git a/mysql-test/main/insert.test b/mysql-test/main/insert.test index 44da0d860f2..e5cb2bac6f8 100644 --- a/mysql-test/main/insert.test +++ b/mysql-test/main/insert.test @@ -641,6 +641,15 @@ select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0))); drop table t; --echo # +--echo # MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT +--echo # +create table t1 (i int) ; +create table t2 (j int) ; +--error ER_BAD_FIELD_ERROR +create table t4 select * from t1 join t2 on (select t3.i); +drop table t1, t2; + +--echo # --echo # End of 10.4 tests --echo # @@ -660,4 +669,3 @@ drop table t1; --echo # --echo # End of 10.5 tests --echo # - diff --git a/mysql-test/main/mysql_install_db_win.test b/mysql-test/main/mysql_install_db_win.test index ceb7293f611..c400dbf3fb9 100644 --- a/mysql-test/main/mysql_install_db_win.test +++ b/mysql-test/main/mysql_install_db_win.test @@ -42,6 +42,13 @@ remove_file $log; rmdir $ddir; +# MDEV-28471 - mysql_install_db.exe fails with --innodb-page-size=64K +--disable_result_log +exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R --innodb-page-size=64K --verbose +--enable_result_log +rmdir $ddir; + +# Tests with config file let $restart_parameters=; connection default; diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 044db82b961..5504f4da81e 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -145,8 +145,7 @@ select * from v1 { } }, "rows_for_plan": 1, - "cost_for_plan": 2.404394531, - "estimated_join_cardinality": 1 + "cost_for_plan": 2.404394531 } ] }, @@ -296,8 +295,7 @@ select * from (select * from t1 where t1.a=1)q { } }, "rows_for_plan": 1, - "cost_for_plan": 2.404394531, - "estimated_join_cardinality": 1 + "cost_for_plan": 2.404394531 } ] }, @@ -454,8 +452,7 @@ select * from v2 { }, "rows_for_plan": 1, "cost_for_plan": 2.404394531, - "cost_for_sorting": 1, - "estimated_join_cardinality": 1 + "cost_for_sorting": 1 } ] }, @@ -525,8 +522,7 @@ select * from v2 { } }, "rows_for_plan": 2, - "cost_for_plan": 2.4, - "estimated_join_cardinality": 2 + "cost_for_plan": 2.4 } ] }, @@ -662,8 +658,7 @@ explain select * from v2 { } }, "rows_for_plan": 10, - "cost_for_plan": 4.021972656, - "estimated_join_cardinality": 10 + "cost_for_plan": 4.021972656 } ] }, @@ -780,8 +775,7 @@ explain select * from v1 { }, "rows_for_plan": 10, "cost_for_plan": 4.021972656, - "cost_for_sorting": 10, - "estimated_join_cardinality": 10 + "cost_for_sorting": 10 } ] }, @@ -845,8 +839,7 @@ explain select * from v1 { } }, "rows_for_plan": 10, - "cost_for_plan": 12, - "estimated_join_cardinality": 10 + "cost_for_plan": 12 } ] }, @@ -1047,7 +1040,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b { }, "rows_for_plan": 100, "cost_for_plan": 242.3759623, - "estimated_join_cardinality": 100 + "pruned_by_hanging_leaf": true } ] }, @@ -1278,8 +1271,7 @@ EXPLAIN SELECT DISTINCT a FROM t1 { } }, "rows_for_plan": 5, - "cost_for_plan": 7.25, - "estimated_join_cardinality": 5 + "cost_for_plan": 7.25 } ] }, @@ -1470,8 +1462,7 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a { }, "rows_for_plan": 8, "cost_for_plan": 3.8, - "cost_for_sorting": 8, - "estimated_join_cardinality": 8 + "cost_for_sorting": 8 } ] }, @@ -1669,8 +1660,7 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id { }, "rows_for_plan": 9, "cost_for_plan": 4.15, - "cost_for_sorting": 9, - "estimated_join_cardinality": 9 + "cost_for_sorting": 9 } ] }, @@ -1857,8 +1847,7 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id { }, "rows_for_plan": 9, "cost_for_plan": 4.15, - "cost_for_sorting": 9, - "estimated_join_cardinality": 9 + "cost_for_sorting": 9 } ] }, @@ -2140,8 +2129,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { } }, "rows_for_plan": 21, - "cost_for_plan": 25.34242739, - "estimated_join_cardinality": 21 + "cost_for_plan": 25.34242739 } ] }, @@ -2392,8 +2380,7 @@ select t1.a from t1 left join t2 on t1.a=t2.a { } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -2561,7 +2548,7 @@ explain select * from t1 left join t2 on t2.a=t1.a { }, "rows_for_plan": 4, "cost_for_plan": 7.606835937, - "estimated_join_cardinality": 4 + "pruned_by_hanging_leaf": true } ] } @@ -2740,8 +2727,7 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -2948,8 +2934,7 @@ explain extended select * from t1 where a in (select pk from t10) { } }, "rows_for_plan": 10, - "cost_for_plan": 4.021972656, - "estimated_join_cardinality": 10 + "cost_for_plan": 4.021972656 } ] } @@ -3021,8 +3006,7 @@ explain extended select * from t1 where a in (select pk from t10) { { "chosen_strategy": "SJ-Materialization" } - ], - "estimated_join_cardinality": 3 + ] } ] }, @@ -3427,7 +3411,7 @@ explain select * from t1 where pk = 2 and a=5 and b=1 { }, "rows_for_plan": 1, "cost_for_plan": 0.326073957, - "estimated_join_cardinality": 1 + "pruned_by_hanging_leaf": true } ] }, @@ -3555,8 +3539,7 @@ select f1(a) from t1 { } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -3652,8 +3635,7 @@ select f2(a) from t1 { } }, "rows_for_plan": 4, - "cost_for_plan": 2.806835937, - "estimated_join_cardinality": 4 + "cost_for_plan": 2.806835937 } ] }, @@ -3699,7 +3681,7 @@ a 2 select length(trace) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; length(trace) -2141 +2092 set optimizer_trace_max_mem_size=100; select * from t1; a @@ -3713,7 +3695,7 @@ select * from t1 { "join_preparation": { "select_id": 1, "steps": [ - 2041 0 + 1992 0 set optimizer_trace_max_mem_size=0; select * from t1; a @@ -3721,7 +3703,7 @@ a 2 select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES -select * from t1 2141 0 +select * from t1 2092 0 drop table t1; set optimizer_trace='enabled=off'; set @@optimizer_trace_max_mem_size= @save_optimizer_trace_max_mem_size; @@ -4064,7 +4046,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { }, "rows_for_plan": 3, "cost_for_plan": 4.948514767, - "estimated_join_cardinality": 3 + "pruned_by_hanging_leaf": true } ] }, @@ -4263,8 +4245,7 @@ explain select * from (select rand() from t1)q { } }, "rows_for_plan": 3, - "cost_for_plan": 2.605126953, - "estimated_join_cardinality": 3 + "cost_for_plan": 2.605126953 } ] }, @@ -4328,8 +4309,7 @@ explain select * from (select rand() from t1)q { } }, "rows_for_plan": 3, - "cost_for_plan": 3.6, - "estimated_join_cardinality": 3 + "cost_for_plan": 3.6 } ] }, @@ -4557,8 +4537,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ } }, "rows_for_plan": 9, - "cost_for_plan": 6.410253906, - "estimated_join_cardinality": 9 + "cost_for_plan": 6.410253906 } ] }, @@ -4678,8 +4657,7 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ { "chosen_strategy": "SJ-Materialization" } - ], - "estimated_join_cardinality": 3 + ] } ] }, @@ -5222,8 +5200,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { { "chosen_strategy": "DuplicateWeedout" } - ], - "estimated_join_cardinality": 27 + ] } ] }, @@ -5345,8 +5322,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { { "chosen_strategy": "DuplicateWeedout" } - ], - "estimated_join_cardinality": 27 + ] } ] }, @@ -6667,8 +6643,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { } }, "rows_for_plan": 27, - "cost_for_plan": 10.02050781, - "estimated_join_cardinality": 27 + "cost_for_plan": 10.02050781 } ] }, @@ -6741,8 +6716,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { } }, "rows_for_plan": 27, - "cost_for_plan": 10.02050781, - "estimated_join_cardinality": 27 + "cost_for_plan": 10.02050781 } ] }, @@ -6961,8 +6935,7 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { { "chosen_strategy": "SJ-Materialization" } - ], - "estimated_join_cardinality": 27 + ] } ] }, @@ -8124,8 +8097,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) } }, "rows_for_plan": 4777.832031, - "cost_for_plan": 1216.438354, - "estimated_join_cardinality": 4777.832031 + "cost_for_plan": 1216.438354 } ] }, @@ -8466,7 +8438,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) "rows_for_plan": 10, "cost_for_plan": 26.0278306, "cost_for_sorting": 10, - "estimated_join_cardinality": 10 + "pruned_by_hanging_leaf": true } ] }, @@ -8786,8 +8758,7 @@ select count(*) from seq_1_to_10000000 { } }, "rows_for_plan": 10000000, - "cost_for_plan": 12000000, - "estimated_join_cardinality": 10000000 + "cost_for_plan": 12000000 } ] }, @@ -9202,8 +9173,7 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting')) }, "rows_for_plan": 1.8367, "cost_for_plan": 2.367925794, - "cost_for_sorting": 1.8367, - "estimated_join_cardinality": 1.8367 + "cost_for_sorting": 1.8367 } ] }, diff --git a/mysql-test/main/opt_trace_index_merge.result b/mysql-test/main/opt_trace_index_merge.result index f1e13586eda..335e408bddd 100644 --- a/mysql-test/main/opt_trace_index_merge.result +++ b/mysql-test/main/opt_trace_index_merge.result @@ -221,8 +221,7 @@ explain select * from t1 where a=1 or b=1 { } }, "rows_for_plan": 2, - "cost_for_plan": 2.884903732, - "estimated_join_cardinality": 2 + "cost_for_plan": 2.884903732 } ] }, diff --git a/mysql-test/main/opt_trace_index_merge_innodb.result b/mysql-test/main/opt_trace_index_merge_innodb.result index fbc7faa0d04..b9c59c7a100 100644 --- a/mysql-test/main/opt_trace_index_merge_innodb.result +++ b/mysql-test/main/opt_trace_index_merge_innodb.result @@ -227,7 +227,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 { }, "rows_for_plan": 1, "cost_for_plan": 1.325146475, - "estimated_join_cardinality": 1 + "pruned_by_hanging_leaf": true } ] }, diff --git a/mysql-test/main/opt_trace_security.result b/mysql-test/main/opt_trace_security.result index e1937e744a4..83d98c4c183 100644 --- a/mysql-test/main/opt_trace_security.result +++ b/mysql-test/main/opt_trace_security.result @@ -107,8 +107,7 @@ select * from db1.t1 { } }, "rows_for_plan": 3, - "cost_for_plan": 2.605126953, - "estimated_join_cardinality": 3 + "cost_for_plan": 2.605126953 } ] }, @@ -229,8 +228,7 @@ select * from db1.v1 { } }, "rows_for_plan": 3, - "cost_for_plan": 2.605126953, - "estimated_join_cardinality": 3 + "cost_for_plan": 2.605126953 } ] }, diff --git a/mysql-test/main/subselect_sj2.result b/mysql-test/main/subselect_sj2.result index 2d0df9a05d0..cdf9707dcbd 100644 --- a/mysql-test/main/subselect_sj2.result +++ b/mysql-test/main/subselect_sj2.result @@ -466,11 +466,11 @@ where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) +1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Start temporary +1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using where; End temporary Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in diff --git a/mysql-test/main/subselect_sj2_jcl6.result b/mysql-test/main/subselect_sj2_jcl6.result index f0e8e9b4881..84317467e8a 100644 --- a/mysql-test/main/subselect_sj2_jcl6.result +++ b/mysql-test/main/subselect_sj2_jcl6.result @@ -477,11 +477,11 @@ where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Start temporary; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using where; End temporary; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; # Not anymore: diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result index 9b497ade58b..54286f1fa82 100644 --- a/mysql-test/main/subselect_sj2_mat.result +++ b/mysql-test/main/subselect_sj2_mat.result @@ -468,11 +468,11 @@ where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and t1.b=t2.b); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t0 ALL NULL NULL NULL NULL 5 100.00 Using where -1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 -1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2) +1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Start temporary +1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using where; End temporary Warnings: Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t1`.`b` = `test`.`t2`.`b` +Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where `test`.`t1`.`a` = `test`.`t0`.`a` and `test`.`t2`.`a` = `test`.`t0`.`a` and `test`.`t2`.`b` = `test`.`t1`.`b` update t1 set a=3, b=11 where a=4; update t2 set b=11 where a=3; select * from t0 where t0.a in diff --git a/mysql-test/suite/binlog/r/binlog_truncate_active_log.result b/mysql-test/suite/binlog/r/binlog_truncate_active_log.result index e76c3c3911b..85d37534c0b 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_active_log.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_active_log.result @@ -4,11 +4,13 @@ RESET MASTER; SET @@global.sync_binlog=1; CREATE TABLE t (f INT) ENGINE=INNODB; CREATE TABLE t2 (f INT) ENGINE=INNODB; +CREATE TABLE t4 (f INT) ENGINE=INNODB; CREATE TABLE tm (f INT) ENGINE=Aria; # Case A. connect master1,localhost,root,,; connect master2,localhost,root,,; connect master3,localhost,root,,; +connect master4,localhost,root,,; connection default; INSERT INTO t VALUES (10); INSERT INTO tm VALUES (10); @@ -23,14 +25,23 @@ connection master3; SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; Before the crash -0-1-7 +0-1-8 +connection master4; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives"; +INSERT INTO t4 VALUES (13); +connection master3; +SET DEBUG_SYNC= "now WAIT_FOR master4_ready"; +SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx'; +Before the crash and never logged trx +0-1-8 connection default; # Kill the server disconnect master1; disconnect master2; disconnect master3; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 -FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-6/ in mysqld.1.err +disconnect master4; +# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-7/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -39,6 +50,8 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t (f INT) ENGINE=INNODB master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (f INT) ENGINE=INNODB master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t4 (f INT) ENGINE=INNODB +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE TABLE tm (f INT) ENGINE=Aria master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (10) @@ -48,16 +61,20 @@ master-bin.000001 # Query # # use `test`; INSERT INTO tm VALUES (10) master-bin.000001 # Query # # COMMIT SELECT @@global.gtid_binlog_pos as 'After the crash'; After the crash -0-1-5 +0-1-6 "One row should be present in table 't'" SELECT * FROM t; f 10 +"No row should be present in table 't4'" +SELECT * FROM t4; +f DELETE FROM t; # Case B. connect master1,localhost,root,,; connect master2,localhost,root,,; connect master3,localhost,root,,; +connect master4,localhost,root,,; connection default; INSERT INTO t VALUES (10); INSERT INTO tm VALUES (10); @@ -72,14 +89,23 @@ connection master3; SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; Before the crash -0-1-10 +0-1-11 +connection master4; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives"; +INSERT INTO t4 VALUES (13); +connection master3; +SET DEBUG_SYNC= "now WAIT_FOR master4_ready"; +SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx'; +Before the crash and never logged trx +0-1-11 connection default; # Kill the server disconnect master1; disconnect master2; disconnect master3; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 -FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-10/ in mysqld.1.err +disconnect master4; +# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-11/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -97,11 +123,14 @@ master-bin.000002 # Query # # use `test`; DELETE FROM t2 WHERE f = 0 master-bin.000002 # Query # # COMMIT SELECT @@global.gtid_binlog_pos as 'After the crash'; After the crash -0-1-9 +0-1-10 "One row should be present in table 't'" SELECT * FROM t; f 10 +"No row should be present in table 't4'" +SELECT * FROM t4; +f DELETE FROM t; # Case C. CREATE PROCEDURE sp_blank_xa() @@ -114,6 +143,7 @@ END| connect master1,localhost,root,,; connect master2,localhost,root,,; connect master3,localhost,root,,; +connect master4,localhost,root,,; connection default; INSERT INTO t VALUES (10); INSERT INTO tm VALUES (10); @@ -128,14 +158,23 @@ connection master3; SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; Before the crash -0-1-15 +0-1-16 +connection master4; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives"; +INSERT INTO t4 VALUES (13); +connection master3; +SET DEBUG_SYNC= "now WAIT_FOR master4_ready"; +SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx'; +Before the crash and never logged trx +0-1-16 connection default; # Kill the server disconnect master1; disconnect master2; disconnect master3; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 -FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-14/ in mysqld.1.err +disconnect master4; +# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-15/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -158,11 +197,14 @@ master-bin.000003 # Query # # use `test`; INSERT INTO tm VALUES (10) master-bin.000003 # Query # # COMMIT SELECT @@global.gtid_binlog_pos as 'After the crash'; After the crash -0-1-13 +0-1-14 "One row should be present in table 't'" SELECT * FROM t; f 10 +"No row should be present in table 't4'" +SELECT * FROM t4; +f DELETE FROM t; DROP PROCEDURE sp_blank_xa; # Case D. @@ -176,6 +218,7 @@ END| connect master1,localhost,root,,; connect master2,localhost,root,,; connect master3,localhost,root,,; +connect master4,localhost,root,,; connection default; INSERT INTO t VALUES (10); INSERT INTO tm VALUES (10); @@ -190,14 +233,23 @@ connection master3; SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; Before the crash -0-1-20 +0-1-21 +connection master4; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives"; +INSERT INTO t4 VALUES (13); +connection master3; +SET DEBUG_SYNC= "now WAIT_FOR master4_ready"; +SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx'; +Before the crash and never logged trx +0-1-21 connection default; # Kill the server disconnect master1; disconnect master2; disconnect master3; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 -FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-20/ in mysqld.1.err +disconnect master4; +# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 +FOUND 1 /Successfully truncated.*to remove transactions starting from GTID 0-1-21/ in mysqld.1.err Pre-crash binlog file content: include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -226,11 +278,14 @@ master-bin.000004 # Query # # XA END X'786964',X'',1 master-bin.000004 # XA_prepare # # XA PREPARE X'786964',X'',1 SELECT @@global.gtid_binlog_pos as 'After the crash'; After the crash -0-1-19 +0-1-20 "One row should be present in table 't'" SELECT * FROM t; f 10 +"No row should be present in table 't4'" +SELECT * FROM t4; +f DELETE FROM t; DROP PROCEDURE sp_xa; # Cleanup diff --git a/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result b/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result index ae292c04c32..271e3c50b19 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result @@ -22,6 +22,11 @@ SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master2_ready WAIT INSERT INTO ti VALUES (3, "not gonna survive"); connection default; SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; +connect master3,localhost,root,,; +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master3_ready WAIT_FOR master3_go_never_arrives"; +INSERT INTO ti VALUES (4, "not gonna be log therefore survive"),(5, "ditto"); +connection default; +SET DEBUG_SYNC= "now WAIT_FOR master3_ready"; "List of binary logs before crash" show binary logs; Log_name File_size @@ -36,7 +41,8 @@ connection default; # Kill the server disconnect master1; disconnect master2; -# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +disconnect master3; +# restart: --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 FOUND 1 /truncated binlog file:.*master.*000002/ in mysqld.1.err "One record should be present in table" SELECT * FROM ti; diff --git a/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc b/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc index 75a8310c220..68ac752725e 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc +++ b/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc @@ -1,6 +1,7 @@ connect(master1,localhost,root,,); connect(master2,localhost,root,,); connect(master3,localhost,root,,); +connect(master4,localhost,root,,); --connection default @@ -22,16 +23,26 @@ SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready"; SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; +--connection master4 +# Simulate prepared & not-logged trx; it will never recover. +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives"; +--send INSERT INTO t4 VALUES (13) + +--connection master3 +SET DEBUG_SYNC= "now WAIT_FOR master4_ready"; +SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx'; + --connection default --source include/kill_mysqld.inc --disconnect master1 --disconnect master2 --disconnect master3 +--disconnect master4 # # Server restart # ---let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +--let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 --source include/start_mysqld.inc # Check error log for a successful truncate message. @@ -49,6 +60,8 @@ SELECT @@global.gtid_binlog_pos as 'Before the crash'; SELECT @@global.gtid_binlog_pos as 'After the crash'; --echo "One row should be present in table 't'" SELECT * FROM t; +--echo "No row should be present in table 't4'" +SELECT * FROM t4; # prepare binlog file index for the next test --inc $binlog_file_index diff --git a/mysql-test/suite/binlog/t/binlog_truncate_active_log.test b/mysql-test/suite/binlog/t/binlog_truncate_active_log.test index 920679e99e9..7c63a853da6 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_active_log.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_active_log.test @@ -25,6 +25,7 @@ RESET MASTER; SET @@global.sync_binlog=1; CREATE TABLE t (f INT) ENGINE=INNODB; CREATE TABLE t2 (f INT) ENGINE=INNODB; +CREATE TABLE t4 (f INT) ENGINE=INNODB; CREATE TABLE tm (f INT) ENGINE=Aria; # Old (pre-crash) binlog file index initial value. @@ -42,14 +43,14 @@ CREATE TABLE tm (f INT) ENGINE=Aria; # 'query1' onwards will be removed from the binary log. # Show-binlog-events is to prove that. ---let $truncate_gtid_pos = 0-1-6 +--let $truncate_gtid_pos = 0-1-7 --let $query1 = INSERT INTO t VALUES (20) --let $query2 = DELETE FROM t2 WHERE f = 0 /* no such record */ --source binlog_truncate_active_log.inc --echo # Case B. # The inverted sequence ends up to truncate starting from $query2 ---let $truncate_gtid_pos = 0-1-10 +--let $truncate_gtid_pos = 0-1-11 --let $query1 = DELETE FROM t2 WHERE f = 0 --let $query2 = INSERT INTO t VALUES (20) --source binlog_truncate_active_log.inc @@ -68,7 +69,7 @@ delimiter ;| # The same as in A with $query2 being the zero-engine XA transaction. # Both $query1 and $query2 are going to be truncated. ---let $truncate_gtid_pos = 0-1-14 +--let $truncate_gtid_pos = 0-1-15 --let $query1 = INSERT INTO t VALUES (20) --let $query2 = CALL sp_blank_xa --source binlog_truncate_active_log.inc @@ -89,7 +90,7 @@ delimiter ;| # The same as in B with $query1 being the prepared XA transaction. # Truncation must occurs at $query2. ---let $truncate_gtid_pos = 0-1-20 +--let $truncate_gtid_pos = 0-1-21 --let $query1 = CALL sp_xa --let $query2 = INSERT INTO t2 VALUES (20) --source binlog_truncate_active_log.inc diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test b/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test index a7068885871..079c79b2984 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test @@ -40,6 +40,15 @@ SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master2_ready WAIT --connection default SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; + +connect(master3,localhost,root,,); +# The 3nd trx for recovery, it won't get into binlog nor therefore recover +SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master3_ready WAIT_FOR master3_go_never_arrives"; +--send INSERT INTO ti VALUES (4, "not gonna be log therefore survive"),(5, "ditto") + +--connection default +SET DEBUG_SYNC= "now WAIT_FOR master3_ready"; + --echo "List of binary logs before crash" --source include/show_binary_logs.inc --echo # The gtid binlog state prior the crash will be truncated at the end of the test @@ -49,11 +58,12 @@ SELECT @@global.gtid_binlog_state; --source include/kill_mysqld.inc --disconnect master1 --disconnect master2 +--disconnect master3 # # Server restart # ---let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 +--let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3 --source include/start_mysqld.inc # Check error log for a successful truncate message. diff --git a/mysql-test/suite/compat/oracle/r/events.result b/mysql-test/suite/compat/oracle/r/events.result index ef9c50115ae..1f62e2e5ee2 100644 --- a/mysql-test/suite/compat/oracle/r/events.result +++ b/mysql-test/suite/compat/oracle/r/events.result @@ -16,3 +16,12 @@ COUNT(*) 1 DROP TABLE t1; SET GLOBAL event_scheduler=off; +# +# MDEV-28588 SIGSEGV in __memmove_avx_unaligned_erms, strmake_root +# +CREATE EVENT ev ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO BEGIN END; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +SELECT EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='test' AND EVENT_NAME='ev'; +EVENT_DEFINITION BEGIN END +DROP EVENT ev; diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result index a9a97769333..44092c0be30 100644 --- a/mysql-test/suite/compat/oracle/r/sp.result +++ b/mysql-test/suite/compat/oracle/r/sp.result @@ -2549,7 +2549,18 @@ idx 1 DROP PROCEDURE p1; # -# Start of 10.4 tests +# MDEV-28588 SIGSEGV in __memmove_avx_unaligned_erms, strmake_root +# +SET sql_mode=ORACLE; +BEGIN END; +CREATE TABLE t1 (a INT); +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW BEGIN END; +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA='test' AND TRIGGER_NAME='tr'; +ACTION_STATEMENT BEGIN END +DROP TRIGGER tr; +DROP TABLE t1; +# +# End of 10.3 tests # # # MDEV-19637 Crash on an SP variable assignment to a wrong subselect diff --git a/mysql-test/suite/compat/oracle/t/events.test b/mysql-test/suite/compat/oracle/t/events.test index e898528636a..fb56af51d87 100644 --- a/mysql-test/suite/compat/oracle/t/events.test +++ b/mysql-test/suite/compat/oracle/t/events.test @@ -25,5 +25,13 @@ let $wait_condition = SELECT COUNT(*) FROM t1; DROP TABLE t1; - SET GLOBAL event_scheduler=off; + +--echo # +--echo # MDEV-28588 SIGSEGV in __memmove_avx_unaligned_erms, strmake_root +--echo # +CREATE EVENT ev ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO BEGIN END; +--vertical_results +SELECT EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='test' AND EVENT_NAME='ev'; +--horizontal_results +DROP EVENT ev; diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test index 99bdc7166e0..69b8608b19a 100644 --- a/mysql-test/suite/compat/oracle/t/sp.test +++ b/mysql-test/suite/compat/oracle/t/sp.test @@ -2392,9 +2392,23 @@ DROP PROCEDURE p1; --echo # ---echo # Start of 10.4 tests +--echo # MDEV-28588 SIGSEGV in __memmove_avx_unaligned_erms, strmake_root --echo # +SET sql_mode=ORACLE; +BEGIN END; + +CREATE TABLE t1 (a INT); +CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW BEGIN END; +--vertical_results +SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA='test' AND TRIGGER_NAME='tr'; +--horizontal_results +DROP TRIGGER tr; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-19637 Crash on an SP variable assignment to a wrong subselect diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 4099caad3b3..35e8a3c725e 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -19,10 +19,8 @@ galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_b galera_bf_kill_debug : MDEV-24485 wsrep::client_state::do_acquire_ownership(): Assertion `state_ == s_idle || mode_ != m_local' failed galera_bf_lock_wait : MDEV-21597 wsrep::transaction::start_transaction(): Assertion `active() == false' failed galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files -galera_ftwrl : MDEV-21525 galera.galera_ftwrl galera_gcache_recover_manytrx : MDEV-18834 Galera test failure galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges -galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk galera_mdl_race : MDEV-21524 galera.galera_mdl_race galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb diff --git a/mysql-test/suite/galera/r/MDEV-28053.result b/mysql-test/suite/galera/r/MDEV-28053.result new file mode 100644 index 00000000000..b3f93688dd0 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-28053.result @@ -0,0 +1,14 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_3; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +connection node_2; +connection node_3; +DROP TABLE t1; +connection node_2; +connection node_2; +STOP SLAVE; +RESET SLAVE ALL; +connection node_3; +RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result index 8d0734f9df8..4fe33674701 100644 --- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -1,33 +1,44 @@ connection node_2; connection node_1; connection node_1; +SET GLOBAL auto_increment_offset=1; +connection node_2; +SET GLOBAL auto_increment_offset=2; +connection node_1; connection node_2; connection node_2; SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; connection node_1; SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 insert into t1(i) values(null); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave -select * from t1; +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave -select * from t1; +select * from t1 order by i; i c 1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 3 dummy_text @@ -45,27 +56,34 @@ SET GLOBAL wsrep_auto_increment_control='OFF'; SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 1 insert into t1(i) values(null); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave -select * from t1; +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave -select * from t1; +select * from t1 order by i; i c 1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 4 dummy_text @@ -74,6 +92,7 @@ i c connection node_1; SET GLOBAL wsrep_auto_increment_control='ON'; SET SESSION binlog_format='ROW'; +connection node_1; show variables like 'binlog_format'; Variable_name Value binlog_format ROW @@ -89,29 +108,37 @@ auto_increment_increment 3 auto_increment_offset 1 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; +connection node_1; drop table t1; connection node_2; SET GLOBAL wsrep_forced_binlog_format='ROW'; connection node_1; SET GLOBAL wsrep_forced_binlog_format='ROW'; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 1 insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text 3 dummy_text 5 dummy_text 7 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 3 dummy_text @@ -129,23 +156,30 @@ SET GLOBAL wsrep_auto_increment_control='OFF'; SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( -i int(11) NOT NULL AUTO_INCREMENT, -c char(32) DEFAULT 'dummy_text', -PRIMARY KEY (i) +i int(11) NOT NULL primary key AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 3 +auto_increment_offset 1 insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; i c 1 dummy_text 4 dummy_text 7 dummy_text 10 dummy_text connection node_2; -select * from t1; +show variables like 'auto_increment%'; +Variable_name Value +auto_increment_increment 2 +auto_increment_offset 2 +select * from t1 order by i; i c 1 dummy_text 4 dummy_text @@ -159,13 +193,13 @@ binlog_format ROW show variables like '%auto_increment%'; Variable_name Value auto_increment_increment 2 -auto_increment_offset 1 +auto_increment_offset 2 wsrep_auto_increment_control ON SET GLOBAL wsrep_auto_increment_control='OFF'; show variables like '%auto_increment%'; Variable_name Value -auto_increment_increment 3 -auto_increment_offset 1 +auto_increment_increment 1 +auto_increment_offset 2 wsrep_auto_increment_control OFF SET GLOBAL wsrep_auto_increment_control='ON'; drop table t1; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff new file mode 100644 index 00000000000..8c84321e774 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff @@ -0,0 +1,190 @@ +--- r/galera_ist_MDEV-28423.result ++++ r/galera_ist_MDEV-28423,debug.reject +@@ -517,3 +517,187 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result new file mode 100644 index 00000000000..5a71b490a80 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result @@ -0,0 +1,519 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been temporarily disconnected +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Unloading wsrep provider ... +SET GLOBAL wsrep_cluster_address = ''; +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Loading wsrep provider ... +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_disconnect_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff new file mode 100644 index 00000000000..51d2a6bf157 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff @@ -0,0 +1,190 @@ +--- r/galera_ist_MDEV-28583.result ++++ r/galera_ist_MDEV-28583,debug.reject +@@ -517,3 +517,187 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result new file mode 100644 index 00000000000..5a71b490a80 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result @@ -0,0 +1,519 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been temporarily disconnected +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Unloading wsrep provider ... +SET GLOBAL wsrep_cluster_address = ''; +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Loading wsrep provider ... +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_disconnect_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; diff --git a/mysql-test/suite/galera/r/galera_many_tables_nopk.result b/mysql-test/suite/galera/r/galera_many_tables_nopk.result index 2a226defcc7..d341a1816e5 100644 --- a/mysql-test/suite/galera/r/galera_many_tables_nopk.result +++ b/mysql-test/suite/galera/r/galera_many_tables_nopk.result @@ -6,8 +6,8 @@ START TRANSACTION; COMMIT; connection node_2; CREATE TABLE sum_table (f1 INTEGER); -SELECT SUM(f1) = 900 FROM sum_table; -SUM(f1) = 900 +SELECT SUM(f1) = 100 FROM sum_table; +SUM(f1) = 100 1 connection node_1; SET AUTOCOMMIT=OFF; @@ -15,7 +15,7 @@ START TRANSACTION; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -UPDATE t900 SET f1 = 3; +UPDATE t100 SET f1 = 3; connection node_1; COMMIT; connection node_2; diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result index fe8b45fa596..e7e18ca8145 100644 --- a/mysql-test/suite/galera/r/galera_read_only.result +++ b/mysql-test/suite/galera/r/galera_read_only.result @@ -17,10 +17,18 @@ connect foo_node_2,127.0.0.1,foo,,test,$port_2,; connection foo_node_2; INSERT INTO t1 VALUES (2); ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; connection node_2; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 1 +connection node_2; +SET GLOBAL read_only=TRUE; +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; SET GLOBAL read_only=FALSE; DROP TABLE t1; DROP USER foo@localhost; diff --git a/mysql-test/suite/galera/t/MDEV-28053.cnf b/mysql-test/suite/galera/t/MDEV-28053.cnf new file mode 100644 index 00000000000..2a500639d1d --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-28053.cnf @@ -0,0 +1,6 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +slave_parallel_threads=4 +slave_parallel_mode=optimistic +gtid_strict_mode=1 diff --git a/mysql-test/suite/galera/t/MDEV-28053.test b/mysql-test/suite/galera/t/MDEV-28053.test new file mode 100644 index 00000000000..85cb20c7e10 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-28053.test @@ -0,0 +1,61 @@ +# +# MDEV-28053 - Sysbench data load crashes Galera secondary node in +# async master slave setup +# +# Setup: node 3 is a regular MariaDB server, nodes 1 and 2 are members +# of a Galera cluster. Node 2 connects to node 3 through async replication. +# +# Test uses multiple parallel async applier threads (see MDEV-28053.cnf) +# + +--source include/have_innodb.inc +--source include/galera_cluster.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +--connection node_3 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; + +# +# Execute a few INSERTs, to simulate sysbench data load phase +# +--let $counter=100 +--disable_query_log +while ($counter) { + --connection node_3 + INSERT INTO t1 VALUES(); + --dec $counter +} +--enable_query_log +--let gtid = `SELECT @@last_gtid` + +# +# Start async replication on node 2. +# If bug is present, expect a crash when applying +# events concurrently. +# +--connection node_2 +--disable_query_log +--disable_result_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; +START SLAVE; +--eval SELECT MASTER_GTID_WAIT('$gtid', 600) +--enable_result_log +--enable_query_log + +# +# Cleanup +# +--connection node_3 +DROP TABLE t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; + +--connection node_3 +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf index 889c81b4a0a..91e9199b092 100644 --- a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.cnf @@ -2,6 +2,8 @@ [mysqld.1] auto_increment_offset=1 +auto_increment_increment=1 [mysqld.2] auto_increment_offset=2 +auto_increment_increment=1 diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test index 431fa90c8e2..994f7695fc6 100644 --- a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test +++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test @@ -3,7 +3,12 @@ ## --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/force_restart.inc + +--connection node_1 +SET GLOBAL auto_increment_offset=1; +--connection node_2 +SET GLOBAL auto_increment_offset=2; --let $node_1=node_1 --let $node_2=node_2 @@ -30,23 +35,24 @@ call mtr.add_suppression("Unsafe statement written to the binary log"); --enable_query_log CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc -select * from t1; +show variables like 'auto_increment%'; +select * from t1 order by i; SET GLOBAL wsrep_forced_binlog_format='none'; @@ -80,36 +86,31 @@ SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc +show variables like 'auto_increment%'; -select * from t1; +select * from t1 order by i; --connection node_1 - -## -## Verify the return to automatic calculation of the step -## and offset of the auto-increment: -## - SET GLOBAL wsrep_auto_increment_control='ON'; - SET SESSION binlog_format='ROW'; - +--source include/auto_increment_offset_restore.inc +--connection node_1 show variables like 'binlog_format'; show variables like '%auto_increment%'; @@ -127,7 +128,8 @@ show variables like '%auto_increment%'; ## SET GLOBAL wsrep_auto_increment_control='ON'; - +--source include/auto_increment_offset_restore.inc +--connection node_1 drop table t1; ## @@ -142,24 +144,25 @@ SET GLOBAL wsrep_forced_binlog_format='ROW'; SET GLOBAL wsrep_forced_binlog_format='ROW'; CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc -select * from t1; +show variables like 'auto_increment%'; +select * from t1 order by i; SET GLOBAL wsrep_forced_binlog_format='none'; @@ -189,24 +192,25 @@ SET SESSION auto_increment_increment = 3; SET SESSION auto_increment_offset = 1; CREATE TABLE t1 ( - i int(11) NOT NULL AUTO_INCREMENT, - c char(32) DEFAULT 'dummy_text', - PRIMARY KEY (i) + i int(11) NOT NULL primary key AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +show variables like 'auto_increment%'; insert into t1(i) values(null); -select * from t1; +select * from t1 order by i; insert into t1(i) values(null), (null), (null); -select * from t1; +select * from t1 order by i; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1; --source include/wait_condition.inc +show variables like 'auto_increment%'; -select * from t1; +select * from t1 order by i; --connection node_1 @@ -216,6 +220,7 @@ select * from t1; ## SET GLOBAL wsrep_auto_increment_control='ON'; +--source include/auto_increment_offset_restore.inc show variables like 'binlog_format'; show variables like '%auto_increment%'; diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf new file mode 100644 index 00000000000..691e52208b1 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf @@ -0,0 +1,44 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +# server-id=101 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +#wsrep_sst_method=rsync +wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.2] +# server-id=102 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +#wsrep_sst_method=rsync +wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.test b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.test new file mode 100644 index 00000000000..8668c4ce158 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.test @@ -0,0 +1,18 @@ +# MDEV-28423: Galera IST is failing on Joiner node + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_disconnect_slave.inc +--source suite/galera/include/galera_st_shutdown_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf new file mode 100644 index 00000000000..3835cd02a41 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf @@ -0,0 +1,44 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +# server-id=101 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +wsrep_sst_method=rsync +#wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.2] +# server-id=102 +#wsrep-debug=1 +innodb_file_per_table +innodb_autoinc_lock_mode=2 +wsrep_sst_method=rsync +#wsrep_sst_method=mariabackup +wsrep_sst_auth=root: +binlog_format=ROW +core-file +log-output=none +wsrep_slave_threads=2 +wsrep_on=1 +gtid_strict_mode=1 +log_slave_updates=ON +log_bin=binlog + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.test b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.test new file mode 100644 index 00000000000..2c8c0bd80da --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.test @@ -0,0 +1,18 @@ +# MDEV-28583: Galera: binlogs disappear after rsync IST + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--source suite/galera/include/galera_st_disconnect_slave.inc +--source suite/galera/include/galera_st_shutdown_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_many_tables_nopk.test b/mysql-test/suite/galera/t/galera_many_tables_nopk.test index 98a65b7c660..5bfab686726 100644 --- a/mysql-test/suite/galera/t/galera_many_tables_nopk.test +++ b/mysql-test/suite/galera/t/galera_many_tables_nopk.test @@ -7,18 +7,17 @@ if (!`SELECT @@open_files_limit >= 1024`){ } # -# This test forces 900 tables without a PK to participate in a single -# transaction. The reason for 900 is that some linux system has by default -# a limit of 1024 open files / process +# This test forces 100 tables without a PK to participate in a single +# transaction. # # -# First, create 900 tables +# First, create 100 tables # --connection node_1 ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -28,7 +27,7 @@ while ($count) --dec $count } ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -39,13 +38,13 @@ while ($count) } # -# Second, perform 900 updates +# Second, perform 100 updates # SET AUTOCOMMIT=OFF; START TRANSACTION; ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -63,7 +62,7 @@ COMMIT; --connection node_2 CREATE TABLE sum_table (f1 INTEGER); ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -73,7 +72,7 @@ while ($count) --dec $count } -SELECT SUM(f1) = 900 FROM sum_table; +SELECT SUM(f1) = 100 FROM sum_table; # # Fourth, create a deadlock @@ -83,7 +82,7 @@ SELECT SUM(f1) = 900 FROM sum_table; SET AUTOCOMMIT=OFF; START TRANSACTION; ---let $count = 900 +--let $count = 100 while ($count) { --disable_query_log @@ -96,7 +95,7 @@ while ($count) --connection node_2 SET AUTOCOMMIT=OFF; START TRANSACTION; -UPDATE t900 SET f1 = 3; +UPDATE t100 SET f1 = 3; --connection node_1 COMMIT; diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test index c0fa4af07e0..56fe2fdd910 100644 --- a/mysql-test/suite/galera/t/galera_read_only.test +++ b/mysql-test/suite/galera/t/galera_read_only.test @@ -28,9 +28,20 @@ CREATE USER foo@localhost; --connection foo_node_2 --error ER_OPTION_PREVENTS_STATEMENT INSERT INTO t1 VALUES (2); +# Writes to temporary tables are allowed +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; --connection node_2 -SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +--connection node_2 +SET GLOBAL read_only=TRUE; +# Writes to temporary tables are allowed +CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb; +INSERT INTO t2 values (1); +DROP TABLE t2; # Cleanup SET GLOBAL read_only=FALSE; diff --git a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result index f51eb815cd5..deef311b1e4 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result +++ b/mysql-test/suite/galera_3nodes/r/galera_wsrep_schema.result @@ -74,3 +74,4 @@ cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHER SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; EXPECT_3 3 +disconnect node_3; diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test index 52bbf3a652c..d6e20d3bbfb 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test @@ -17,6 +17,9 @@ # Make the test fail if table structure has changed +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + SHOW CREATE TABLE mysql.wsrep_cluster; SHOW CREATE TABLE mysql.wsrep_cluster_members; @@ -74,3 +77,5 @@ SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STAT SELECT COUNT(*) AS EXPECT_3 FROM mysql.wsrep_cluster_members; --source ../galera/include/auto_increment_offset_restore.inc + +--disconnect node_3 diff --git a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result index 902aa27d5aa..34995d35a4f 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result @@ -2,6 +2,8 @@ connection node_2; connection node_1; connection node_1; connection node_2; +connection node_2; +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test index d1b0d4b8c88..5d4a58b2d03 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test @@ -8,6 +8,8 @@ --let $node_1=node_1 --let $node_2=node_2 --source ../galera/include/auto_increment_offset_save.inc +--connection node_2 +call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*"); --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index 49fe8e629e3..19b426009f2 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -69,8 +69,6 @@ buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently free (innodb_buffer_pool_pages_free) buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created) buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written) -buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of index pages written (innodb_index_pages_written) -buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of non index pages written (innodb_non_index_pages_written) buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read) buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads triggered cluster read buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads avoided triggering cluster read diff --git a/mysql-test/suite/innodb/r/innodb_status_variables.result b/mysql-test/suite/innodb/r/innodb_status_variables.result index da5020bbe08..a729dd0a8d4 100644 --- a/mysql-test/suite/innodb/r/innodb_status_variables.result +++ b/mysql-test/suite/innodb/r/innodb_status_variables.result @@ -90,8 +90,6 @@ INNODB_TRUNCATED_STATUS_WRITES INNODB_AVAILABLE_UNDO_LOGS INNODB_UNDO_TRUNCATIONS INNODB_PAGE_COMPRESSION_SAVED -INNODB_NUM_INDEX_PAGES_WRITTEN -INNODB_NUM_NON_INDEX_PAGES_WRITTEN INNODB_NUM_PAGES_PAGE_COMPRESSED INNODB_NUM_PAGE_COMPRESSED_TRIM_OP INNODB_NUM_PAGES_PAGE_DECOMPRESSED @@ -118,7 +116,6 @@ INNODB_ENCRYPTION_ROTATION_PAGES_READ_FROM_DISK INNODB_ENCRYPTION_ROTATION_PAGES_MODIFIED INNODB_ENCRYPTION_ROTATION_PAGES_FLUSHED INNODB_ENCRYPTION_ROTATION_ESTIMATED_IOPS -INNODB_ENCRYPTION_KEY_ROTATION_LIST_LENGTH INNODB_ENCRYPTION_N_MERGE_BLOCKS_ENCRYPTED INNODB_ENCRYPTION_N_MERGE_BLOCKS_DECRYPTED INNODB_ENCRYPTION_N_ROWLOG_BLOCKS_ENCRYPTED diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result index 2e5e5e2241a..caa4b33df6c 100644 --- a/mysql-test/suite/innodb/r/monitor.result +++ b/mysql-test/suite/innodb/r/monitor.result @@ -35,8 +35,6 @@ buffer_pool_bytes_dirty disabled buffer_pool_pages_free disabled buffer_pages_created disabled buffer_pages_written disabled -buffer_index_pages_written disabled -buffer_non_index_pages_written disabled buffer_pages_read disabled buffer_index_sec_rec_cluster_reads disabled buffer_index_sec_rec_cluster_reads_avoided disabled diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test index 62cdf9e6cb3..ec38af4c27d 100644 --- a/mysql-test/suite/mariabackup/incremental_backup.test +++ b/mysql-test/suite/mariabackup/incremental_backup.test @@ -8,6 +8,7 @@ if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 6 call mtr.add_suppression("InnoDB: New log files created"); +let $test_comp=`select @@innodb_page_size < 32768`; let basedir=$MYSQLTEST_VARDIR/tmp/backup; let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; @@ -16,6 +17,14 @@ CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB; # MDEV-515 takes X-lock on the table for the first insert. # So concurrent insert won't happen on the table INSERT INTO t VALUES(100); +if ($test_comp) { + # If MDEV-28474 is not fixed, backup preparing will crash with SIGSEGV. + --disable_query_log + --disable_result_log + CREATE TABLE t_comp(i INT PRIMARY KEY) ENGINE INNODB ROW_FORMAT=COMPRESSED; + --enable_query_log + --enable_result_log +} BEGIN; INSERT INTO t VALUES(2); connect (con1,localhost,root,,); @@ -99,6 +108,13 @@ let $targetdir=$basedir; SELECT * FROM t; DROP TABLE t; +if ($test_comp) { + --disable_query_log + --disable_result_log + DROP TABLE t_comp; + --enable_query_log + --enable_result_log +} DROP TABLE t_aria; # Cleanup diff --git a/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.result b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.result new file mode 100644 index 00000000000..e3f8bb245e7 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.result @@ -0,0 +1,18 @@ +call mtr.add_suppression("InnoDB: New log files created"); +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); +CREATE DATABASE test1; +CREATE TABLE test1.t1 (a INT) ENGINE=InnoDB; +INSERT INTO test1.t1 VALUES (1000); +# shutdown server +# remove datadir +# xtrabackup move back +# restart +SELECT * FROM t1; +i +0 +SELECT * FROM test1.t1; +a +1000 +DROP TABLE t1; +DROP DATABASE test1; diff --git a/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.test b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.test new file mode 100644 index 00000000000..a79d280b668 --- /dev/null +++ b/mysql-test/suite/mariabackup/incremental_backup_newdb_before_inc.test @@ -0,0 +1,35 @@ +--source include/have_innodb.inc + +call mtr.add_suppression("InnoDB: New log files created"); + +--let basedir=$MYSQLTEST_VARDIR/tmp/backup +--let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1 + +CREATE TABLE t1 (i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES(0); + +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir +--enable_result_log + +CREATE DATABASE test1; +CREATE TABLE test1.t1 (a INT) ENGINE=InnoDB; +INSERT INTO test1.t1 VALUES (1000); + +--disable_result_log +--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir +--exec $XTRABACKUP --prepare --target-dir=$basedir +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir +--enable_result_log + +--let $targetdir=$basedir +--source include/restart_and_restore.inc +--enable_result_log + +SELECT * FROM t1; +SELECT * FROM test1.t1; + +DROP TABLE t1; +DROP DATABASE test1; +--rmdir $basedir +--rmdir $incremental_dir diff --git a/mysql-test/suite/rpl/r/rpl_gtid_glle_no_terminate.result b/mysql-test/suite/rpl/r/rpl_gtid_glle_no_terminate.result new file mode 100644 index 00000000000..f4d257c2668 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_glle_no_terminate.result @@ -0,0 +1,46 @@ +include/master-slave.inc +[connection master] +connection slave; +include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; +# +# Initialize test data +connection master; +create table t1 (a int); +SET @@session.server_id= 3; +create table t2 (a int); +include/save_master_gtid.inc +# +# Have the replica "reconnect" and the primary will send Gtid, Glle, DDL +connection slave; +set global gtid_slave_pos="0-3-1"; +include/start_slave.inc +include/sync_with_master_gtid.inc +# +# Ensure that the replica did not error +connection slave; +include/sync_with_master_gtid.inc +Last_SQL_Error = +Last_SQL_Errno = 0 +# +# Ensure that the primary sent a Glle after a Gtid event +include/show_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000002 # Rotate # # master-bin.000001;pos=POS +slave-relay-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000002 # Gtid_list # # [] +slave-relay-bin.000002 # Binlog_checkpoint # # master-bin.000001 +slave-relay-bin.000002 # Gtid # # GTID #-#-# +slave-relay-bin.000002 # Gtid_list # # [#-#-#] +slave-relay-bin.000002 # Query # # use `test`; create table t2 (a int) +# +# Ensure the DDL was executed on the replica +# +# Cleanup +# t1 does not make it to the replica +connection master; +set sql_log_bin=0; +DROP TABLE t1; +set sql_log_bin=1; +DROP TABLE t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_gtid_glle_no_terminate.test b/mysql-test/suite/rpl/t/rpl_gtid_glle_no_terminate.test new file mode 100644 index 00000000000..f0f38a31da6 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_glle_no_terminate.test @@ -0,0 +1,72 @@ +# +# Purpose: +# If a fake Glle event follows a Gtid event, we need to ensure the rest of +# the group should not terminate at the Glle event. MDEV-28550 revealed that +# a Glle would terminate the event and upon reconnect, the DDL would be lost. +# +# Methodology: +# Force the primary to send a fake GLLE event after a GTID on a "reconnect" +# and ensure that both 1) the replica does not error, and 2) the original +# command within the GTID is executed. +# +# References: +# MDEV-28550: improper handling of replication event group that contains Gtid_log_list_event + +--source include/master-slave.inc + +# Independent of binlog format +--source include/have_binlog_format_statement.inc + +--connection slave +--source include/stop_slave.inc +CHANGE MASTER TO MASTER_USE_GTID=slave_pos; + +--echo # +--echo # Initialize test data +--connection master +create table t1 (a int); +SET @@session.server_id= 3; +create table t2 (a int); +--source include/save_master_gtid.inc + +--echo # +--echo # Have the replica "reconnect" and the primary will send Gtid, Glle, DDL +--connection slave +eval set global gtid_slave_pos="0-3-1"; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc + +--echo # +--echo # Ensure that the replica did not error +connection slave; +--source include/sync_with_master_gtid.inc +let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); +--echo Last_SQL_Error = $error +let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +--echo Last_SQL_Errno = $errno + +--echo # +--echo # Ensure that the primary sent a Glle after a Gtid event +let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); +let $binlog_start= $relaylog_start; +let $binlog_limit=0,10; +--source include/show_relaylog_events.inc + +--echo # +--echo # Ensure the DDL was executed on the replica +if (!`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name = 't2'`) +{ + die "t2 should exist on slave"; +} + +--echo # +--echo # Cleanup + +--echo # t1 does not make it to the replica +--connection master +set sql_log_bin=0; +DROP TABLE t1; +set sql_log_bin=1; +DROP TABLE t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result b/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result index 30e2639af37..01f44ae51be 100644 --- a/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result +++ b/mysql-test/suite/sys_vars/r/group_concat_max_len_func.result @@ -94,4 +94,58 @@ DROP TABLE t1; disconnect test_con2; disconnect test_con1; connection default; +CREATE TABLE t1(val VARCHAR(100) PRIMARY KEY) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci; +INSERT INTO t1 VALUES('bar'); +INSERT INTO t1 VALUES('foo'); +SET group_concat_max_len = 1073741823; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741823 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 1073741824; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741824 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 1073741825; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741825 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 1073741826; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 1073741826 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +SET group_concat_max_len = 2147483649; +SHOW VARIABLES LIKE 'group_concat_max_len'; +Variable_name Value +group_concat_max_len 2147483649 +SELECT GROUP_CONCAT(val) AS simple FROM t1; +simple +bar,foo +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; +nested +bar,foo +DROP TABLE t1; SET @@global.group_concat_max_len = @save; diff --git a/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test index b053ee229d7..d90fc061289 100644 --- a/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test +++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test @@ -132,4 +132,35 @@ disconnect test_con1; connection default; +CREATE TABLE t1(val VARCHAR(100) PRIMARY KEY) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci; +INSERT INTO t1 VALUES('bar'); +INSERT INTO t1 VALUES('foo'); + +SET group_concat_max_len = 1073741823; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 1073741824; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 1073741825; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 1073741826; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +SET group_concat_max_len = 2147483649; +SHOW VARIABLES LIKE 'group_concat_max_len'; +SELECT GROUP_CONCAT(val) AS simple FROM t1; +SELECT * FROM ( SELECT GROUP_CONCAT(val) AS nested FROM t1) As tmp; + +DROP TABLE t1; + SET @@global.group_concat_max_len = @save; diff --git a/mysql-test/suite/sysschema/r/pr_create_synonym_db.result b/mysql-test/suite/sysschema/r/pr_create_synonym_db.result index bd7e4edc6e6..8c0e8dfa957 100644 --- a/mysql-test/suite/sysschema/r/pr_create_synonym_db.result +++ b/mysql-test/suite/sysschema/r/pr_create_synonym_db.result @@ -50,3 +50,17 @@ DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE `is`; DROP TABLE `ab``c`; +# +# MDEV-28342: sys.create_synonym_db fails +# when a temporary table masks a base table +# +create database db; +use db; +create table a(a int); +create table t (b int); +create table b(a int); +create temporary table b (a int); +call sys.create_synonym_db('db','db_copy'); +ERROR HY000: Table`db`.`b`shadows base table. View cannot be created! Terminating! +drop database db; +drop database db_copy; diff --git a/mysql-test/suite/sysschema/t/pr_create_synonym_db.test b/mysql-test/suite/sysschema/t/pr_create_synonym_db.test index 4fbe8759380..30c6f502e30 100644 --- a/mysql-test/suite/sysschema/t/pr_create_synonym_db.test +++ b/mysql-test/suite/sysschema/t/pr_create_synonym_db.test @@ -50,3 +50,20 @@ DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE `is`; DROP TABLE `ab``c`; + +--echo # +--echo # MDEV-28342: sys.create_synonym_db fails +--echo # when a temporary table masks a base table +--echo # + +create database db; +use db; +create table a(a int); +create table t (b int); +create table b(a int); +create temporary table b (a int); +--error ER_SIGNAL_EXCEPTION +call sys.create_synonym_db('db','db_copy'); + +drop database db; +drop database db_copy; diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 1fc3e785272..4ce3b4ef281 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -1525,6 +1525,18 @@ count(*) 100 drop table t1; # +# MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end +# +create table tcount (c int unsigned); +insert into tcount values (0); +create table t (f int) with system versioning +partition by system_time limit 1000 +(partition p1 history, partition pn current); +insert into t values (1),(2); +create trigger tr before insert on t for each row update tcount set c = c + 1; +insert into t select * from t; +drop table tcount, t; +# # End of 10.3 tests # # diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 26c06dd5687..de00bdce524 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1371,6 +1371,23 @@ select count(*) from t1 partition (p1); drop table t1; --echo # +--echo # MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end +--echo # +create table tcount (c int unsigned); +insert into tcount values (0); + +create table t (f int) with system versioning +partition by system_time limit 1000 +(partition p1 history, partition pn current); +insert into t values (1),(2); +create trigger tr before insert on t for each row update tcount set c = c + 1; + +insert into t select * from t; + +# cleanup +drop table tcount, t; + +--echo # --echo # End of 10.3 tests --echo # diff --git a/scripts/galera_new_cluster.sh b/scripts/galera_new_cluster.sh index e0763ed516a..ac9dcf42102 100755 --- a/scripts/galera_new_cluster.sh +++ b/scripts/galera_new_cluster.sh @@ -22,7 +22,7 @@ EOF fi systemctl set-environment _WSREP_NEW_CLUSTER='--wsrep-new-cluster' && \ - systemctl start ${1:-mariadb} + systemctl restart ${1:-mariadb} extcode=$? diff --git a/scripts/sys_schema/procedures/create_synonym_db.sql b/scripts/sys_schema/procedures/create_synonym_db.sql index 703ec9bff3b..e373a9b4ee6 100644 --- a/scripts/sys_schema/procedures/create_synonym_db.sql +++ b/scripts/sys_schema/procedures/create_synonym_db.sql @@ -97,9 +97,8 @@ BEGIN DECLARE v_db_err_msg TEXT; DECLARE v_table VARCHAR(64); DECLARE v_views_created INT DEFAULT 0; - - DECLARE db_doesnt_exist CONDITION FOR SQLSTATE '42000'; - DECLARE db_name_exists CONDITION FOR SQLSTATE 'HY000'; + DECLARE v_table_exists ENUM('', 'BASE TABLE', 'VIEW', 'TEMPORARY') DEFAULT ''; + DECLARE v_temp_table TEXT; DECLARE c_table_names CURSOR FOR SELECT TABLE_NAME @@ -144,6 +143,21 @@ BEGIN LEAVE c_table_names; END IF; + -- Check does temporary table shadows the base table. If it is so, terminate. + CALL sys.table_exists(in_db_name, v_table, v_table_exists); + IF (v_table_exists = 'TEMPORARY') THEN + SET v_temp_table = + CONCAT( + 'Table', + sys.quote_identifier(in_db_name), + '.', + sys.quote_identifier(v_table), + 'shadows base table. View cannot be created! Terminating!'); + SIGNAL SQLSTATE 'HY000' + SET MESSAGE_TEXT = v_temp_table; + LEAVE c_table_names; + END IF; + SET @create_view_stmt = CONCAT( 'CREATE SQL SECURITY INVOKER VIEW ', sys.quote_identifier(in_synonym), diff --git a/scripts/wsrep_sst_backup.sh b/scripts/wsrep_sst_backup.sh index 55e11ddffc0..301739905b6 100644 --- a/scripts/wsrep_sst_backup.sh +++ b/scripts/wsrep_sst_backup.sh @@ -64,7 +64,7 @@ then [ -f "$FLUSHED" ] && rm -f "$FLUSHED" [ -f "$ERROR" ] && rm -f "$ERROR" - echo "flush tables" + echo "flush tables" # Wait for : # (a) Tables to be flushed, AND @@ -72,7 +72,7 @@ then # (c) ERROR file, in case flush tables operation failed. while [ ! -r "$FLUSHED" ] && \ - ! grep -q -F ':' '--' "$FLUSHED" >/dev/null 2>&1 + ! grep -q -F ':' -- "$FLUSHED" >/dev/null 2>&1 do # Check whether ERROR file exists. if [ -f "$ERROR" ]; then @@ -98,15 +98,11 @@ then echo "done $STATE" -elif [ "$WSREP_SST_OPT_ROLE" = 'joiner' ] -then - wsrep_log_error "Unrecognized role: '$WSREP_SST_OPT_ROLE'" - exit 22 # EINVAL - +else # joiner -else - wsrep_log_error "Unrecognized role: '$WSREP_SST_OPT_ROLE'" + wsrep_log_error "Unsupported role: '$WSREP_SST_OPT_ROLE'" exit 22 # EINVAL + fi exit 0 diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index cc5db9e9e01..9d69ddf63a1 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -17,7 +17,8 @@ # This is a common command line parser to be sourced by other SST scripts -set -ue +trap 'exit 32' HUP PIPE +trap 'exit 3' INT QUIT TERM # Setting the path for some utilities on CentOS export PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin" @@ -184,7 +185,7 @@ case "$1" in shift ;; '--bypass') - WSREP_SST_OPT_BYPASS=1 + readonly WSREP_SST_OPT_BYPASS=1 ;; '--datadir') # Let's remove the trailing slash: @@ -511,7 +512,24 @@ case "$1" in esac shift done -readonly WSREP_SST_OPT_BYPASS + +WSREP_TRANSFER_TYPE='SST' +[ $WSREP_SST_OPT_BYPASS -ne 0 ] && readonly WSREP_TRANSFER_TYPE='IST' +# Let's take the name of the current script as a base, +# removing the directory, extension and "wsrep_sst_" prefix: +WSREP_METHOD="${0##*/}" +WSREP_METHOD="${WSREP_METHOD%.*}" +readonly WSREP_METHOD="${WSREP_METHOD#wsrep_sst_}" +if [ -n "${WSREP_SST_OPT_ROLE+x}" ]; then + if [ "$WSREP_SST_OPT_ROLE" != 'donor' -a \ + "$WSREP_SST_OPT_ROLE" != 'joiner' ] + then + wsrep_log_error "Unrecognized role: '$WSREP_SST_OPT_ROLE'" + exit 22 # EINVAL + fi +else + readonly WSREP_SST_OPT_ROLE='donor' +fi # The same argument can be present on the command line several # times, in this case we must take its last value: @@ -719,7 +737,7 @@ wsrep_log() { # echo everything to stderr so that it gets into common error log # deliberately made to look different from the rest of the log - local readonly tst="$(date +%Y%m%d\ %H:%M:%S.%N | cut -b -21)" + local readonly tst=$(date "+%Y%m%d %H:%M:%S.%N" | cut -b -21) echo "WSREP_SST: $* ($tst)" >&2 } @@ -1050,7 +1068,7 @@ is_local_ip() [ "$1" = '127.0.0.1' -o \ "$1" = '127.0.0.2' -o \ "$1" = 'localhost' -o \ - "$1" = '[::1]' ] && return 0 + "$1" = '::1' ] && return 0 # If the address starts with "127." this is probably a local # address, but we need to clarify what follows this prefix: if [ "${1#127.}" != "$1" ]; then @@ -1067,21 +1085,25 @@ is_local_ip() "$1" = "$(hostname -f)" -o \ "$1" = "$(hostname -d)" ] && return 0 fi + # If the address contains anything other than digits + # and separators, it is not a local address: + [ "${1#*[!0-9.]}" != "$1" ] && \ + [ "${1#*[!0-9A-Fa-f:\[\]]}" != "$1" ] && return 1 # Now let's check if the given address is assigned to # one of the network cards: local ip_util=$(commandex 'ip') if [ -n "$ip_util" ]; then # ip address show ouput format is " inet[6] <address>/<mask>": "$ip_util" address show \ - | grep -E '^[[:space:]]*inet.? [^[:space:]]+/' -o \ - | grep -F " $1/" >/dev/null && return 0 + | grep -o -E '^[[:space:]]*inet.?[[:space:]]+[^[:space:]]+/' \ + | grep -qw -F -- "$1/" && return 0 else local ifconfig_util=$(commandex 'ifconfig') if [ -n "$ifconfig_util" ]; then # ifconfig output format is " inet[6] <address> ...": "$ifconfig_util" \ - | grep -E '^[[:space:]]*inet.? [^[:space:]]+ ' -o \ - | grep -F " $1 " >/dev/null && return 0 + | grep -o -E '^[[:space:]]*inet.?[[:space:]]+[^[:space:]]+' \ + | grep -qw -F -- "$1" && return 0 fi fi return 1 @@ -1403,7 +1425,7 @@ get_proc() if [ -z "$nproc" ]; then set +e if [ "$OS" = 'Linux' ]; then - nproc=$(grep -c processor /proc/cpuinfo 2>/dev/null) + nproc=$(grep -cw -E '^processor' /proc/cpuinfo 2>/dev/null) elif [ "$OS" = 'Darwin' -o "$OS" = 'FreeBSD' ]; then nproc=$(sysctl -n hw.ncpu) fi @@ -1452,3 +1474,19 @@ check_server_ssl_config() fi fi } + +simple_cleanup() +{ + # Since this is invoked just after exit NNN + local estatus=$? + if [ $estatus -ne 0 ]; then + wsrep_log_error "Cleanup after exit with status: $estatus" + fi + if [ -n "${SST_PID:-}" ]; then + [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" + [ -f "$SST_PID" ] && rm -f "$SST_PID" || : + fi + exit $estatus +} + +wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE started on $WSREP_SST_OPT_ROLE" diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 87ed8392475..a3fc4b78718 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -86,6 +86,7 @@ encrypt_threads="" encrypt_chunk="" readonly SECRET_TAG='secret' +readonly TOTAL_TAG='secret /total' # Required for backup locks # For backup locks it is 1 sent by joiner @@ -165,12 +166,10 @@ get_keys() exit 3 fi - if [ -z "$ekey" ]; then - if [ ! -r "$ekeyfile" ]; then - wsrep_log_error "FATAL: Either key must be specified" \ - "or keyfile must be readable" - exit 3 - fi + if [ -z "$ekey" -a ! -r "$ekeyfile" ]; then + wsrep_log_error "FATAL: Either key must be specified" \ + "or keyfile must be readable" + exit 3 fi if [ "$eformat" = 'openssl' ]; then @@ -217,9 +216,7 @@ get_keys() exit 2 fi - if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then - ecmd="$ecmd -d" - fi + [ "$WSREP_SST_OPT_ROLE" = 'joiner' ] && ecmd="$ecmd -d" stagemsg="$stagemsg-XB-Encrypted" } @@ -324,7 +321,8 @@ get_transfer() if [ -z "$ssl_dhparams" ]; then # Determine the socat version SOCAT_VERSION=$(socat -V 2>&1 | \ - grep -m1 -owE '[0-9]+(\.[0-9]+)+' | head -n1) + grep -m1 -owE '[0-9]+(\.[0-9]+)+' | \ + head -n1 || :) if [ -z "$SOCAT_VERSION" ]; then wsrep_log_error "******** FATAL ERROR ******************" wsrep_log_error "* Cannot determine the socat version. *" @@ -595,18 +593,6 @@ get_stream() wsrep_log_info "Streaming with $sfmt" } -sig_joiner_cleanup() -{ - local estatus=$? - if [ $estatus -ne 0 ]; then - wsrep_log_error "Cleanup after exit with status: $estatus" - fi - wsrep_log_error "Removing $MAGIC_FILE file due to signal" - [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" - [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" - exit $estatus -} - cleanup_at_exit() { # Since this is invoked just after exit NNN @@ -617,6 +603,11 @@ cleanup_at_exit() [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" + if [ $estatus -ne 0 ]; then + wsrep_log_error "Removing $MAGIC_FILE file due to signal" + [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || : + fi + if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then wsrep_log_info "Removing the sst_in_progress file" wsrep_cleanup_progress_file @@ -646,7 +637,7 @@ cleanup_at_exit() fi # Final cleanup - pgid=$(ps -o pgid= $$ 2>/dev/null | grep -o -E '[0-9]*' || :) + pgid=$(ps -o pgid= $$ 2>/dev/null | grep -o -E '[0-9]+' || :) # This means no setsid done in mysqld. # We don't want to kill mysqld here otherwise. @@ -742,17 +733,15 @@ recv_joiner() fi fi - pushd "$dir" 1>/dev/null - set +e - if [ $wait -ne 0 ]; then wait_for_listen & fi + cd "$dir" + set +e timeit "$msg" "$ltcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" - set -e - popd 1>/dev/null + cd "$OLD_PWD" if [ ${RC[0]} -eq 124 ]; then wsrep_log_error "Possible timeout in receiving first data from" \ @@ -770,26 +759,26 @@ recv_joiner() if [ $checkf -eq 1 ]; then if [ ! -r "$MAGIC_FILE" ]; then - # this message should cause joiner to abort + # this message should cause joiner to abort: wsrep_log_error "receiving process ended without creating" \ - "'$MAGIC_FILE'" - wsrep_log_info "Contents of datadir" + "magic file ($MAGIC_FILE)" + wsrep_log_info "Contents of datadir:" wsrep_log_info $(ls -l "$dir/"*) exit 32 fi - - # check donor supplied secret - SECRET=$(grep -F -- "$SECRET_TAG " "$MAGIC_FILE" 2>/dev/null | \ - cut -d ' ' -f2) + # Select the "secret" tag whose value does not start + # with a slash symbol. All new tags must to start with + # the space and the slash symbol after the word "secret" - + # to be removed by older versions of the SST scripts: + SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]+[^/]" \ + -- "$MAGIC_FILE" || :) + # Check donor supplied secret: + SECRET=$(trim_string "${SECRET#$SECRET_TAG}") if [ "$SECRET" != "$MY_SECRET" ]; then wsrep_log_error "Donor does not know my secret!" wsrep_log_info "Donor: '$SECRET', my: '$MY_SECRET'" exit 32 fi - - # remove secret from the magic file - grep -v -F -- "$SECRET_TAG " "$MAGIC_FILE" > "$MAGIC_FILE.new" - mv "$MAGIC_FILE.new" "$MAGIC_FILE" fi } @@ -798,11 +787,11 @@ send_donor() local dir="$1" local msg="$2" - pushd "$dir" 1>/dev/null + cd "$dir" set +e timeit "$msg" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )" set -e - popd 1>/dev/null + cd "$OLD_PWD" for ecode in "${RC[@]}"; do if [ $ecode -ne 0 ]; then @@ -817,7 +806,7 @@ monitor_process() { local sst_stream_pid=$1 - while true ; do + while :; do if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1; then wsrep_log_error \ "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \ @@ -834,13 +823,6 @@ monitor_process() [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" -if [ "$WSREP_SST_OPT_ROLE" != 'joiner' -a \ - "$WSREP_SST_OPT_ROLE" != 'donor' ] -then - wsrep_log_error "Invalid role '$WSREP_SST_OPT_ROLE'" - exit 22 -fi - read_cnf setup_ports @@ -957,8 +939,8 @@ setup_commands() get_stream get_transfer -if [ "$WSREP_SST_OPT_ROLE" = 'donor' ] -then +if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then + trap cleanup_at_exit EXIT if [ $WSREP_SST_OPT_BYPASS -eq 0 ] @@ -1079,6 +1061,7 @@ then fi setup_commands + set +e timeit "$stagemsg-SST" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )" set -e @@ -1122,10 +1105,9 @@ then echo "done $WSREP_SST_OPT_GTID" wsrep_log_info "Total time on donor: $totime seconds" - wsrep_log_info "mariabackup SST/IST completed on donor" -elif [ "$WSREP_SST_OPT_ROLE" = 'joiner' ] -then +else # joiner + [ -e "$SST_PROGRESS_FILE" ] && \ wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" [ -n "$SST_PROGRESS_FILE" ] && touch "$SST_PROGRESS_FILE" @@ -1196,6 +1178,7 @@ then sleep 1 done + trap simple_cleanup EXIT echo $$ > "$SST_PID" stagemsg='Joiner-Recv' @@ -1205,7 +1188,7 @@ then [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" # May need xtrabackup_checkpoints later on - [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" + [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" [ -f "$DATA/xtrabackup_galera_info" ] && rm -f "$DATA/xtrabackup_galera_info" ADDR="$WSREP_SST_OPT_HOST" @@ -1232,7 +1215,6 @@ then MY_SECRET="" # for check down in recv_joiner() fi - trap sig_joiner_cleanup HUP PIPE INT TERM trap cleanup_at_exit EXIT if [ -n "$progress" ]; then @@ -1256,8 +1238,7 @@ then recv_joiner "$STATDIR" "$stagemsg-gtid" $stimeout 1 1 - if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1 - then + if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1; then wsrep_log_error "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \ "terminated unexpectedly." exit 32 @@ -1285,13 +1266,13 @@ then cd "$DATA" wsrep_log_info "Cleaning the old binary logs" # If there is a file with binlogs state, delete it: - [ -f "$binlog_base.state" ] && rm -fv "$binlog_base.state" 1>&2 + [ -f "$binlog_base.state" ] && rm -f "$binlog_base.state" >&2 # Clean up the old binlog files and index: if [ -f "$binlog_index" ]; then while read bin_file || [ -n "$bin_file" ]; do - rm -fv "$bin_file" 1>&2 || : + rm -f "$bin_file" >&2 || : done < "$binlog_index" - rm -fv "$binlog_index" 1>&2 + rm -f "$binlog_index" >&2 fi if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \ -d "$binlog_dir" ] @@ -1302,7 +1283,7 @@ then "Cleaning the binlog directory '$binlog_dir' as well" fi fi - rm -fv "$binlog_base".[0-9]* 1>&2 || : + rm -f "$binlog_base".[0-9]* >&2 || : cd "$OLD_PWD" fi @@ -1313,13 +1294,13 @@ then ${ib_undo_dir:+"$ib_undo_dir"} \ ${ib_log_dir:+"$ib_log_dir"} \ "$DATA" -mindepth 1 -prune -regex "$cpat" \ - -o -exec rm -rfv {} 1>&2 \+ + -o -exec rm -rf {} >&2 \+ else find ${ib_home_dir:+"$ib_home_dir"} \ ${ib_undo_dir:+"$ib_undo_dir"} \ ${ib_log_dir:+"$ib_log_dir"} \ "$DATA" -mindepth 1 -prune -regex "$cpat" \ - -o -exec rm -rfv {} 1>&2 \+ + -o -exec rm -rf {} >&2 \+ fi TDATA="$DATA" @@ -1393,7 +1374,6 @@ then wsrep_log_info "Preparing the backup at $DATA" setup_commands timeit 'mariabackup prepare stage' "$INNOAPPLY" - if [ $? -ne 0 ]; then wsrep_log_error "mariabackup apply finished with errors." \ "Check syslog or '$INNOAPPLYLOG' for details." @@ -1450,6 +1430,10 @@ then else wsrep_log_info "'$IST_FILE' received from donor: Running IST" + if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then + readonly WSREP_SST_OPT_BYPASS=1 + readonly WSREP_TRANSFER_TYPE='IST' + fi fi @@ -1458,12 +1442,13 @@ then exit 2 fi - coords=$(cat "$MAGIC_FILE") + # Remove special tags from the magic file, and from the output: + coords=$(grep -v -E "^$SECRET_TAG[[:space:]]" -- "$MAGIC_FILE") wsrep_log_info "Galera co-ords from recovery: $coords" - cat "$MAGIC_FILE" # Output : UUID:seqno wsrep_gtid_domain_id + echo "$coords" # Output : UUID:seqno wsrep_gtid_domain_id wsrep_log_info "Total time on joiner: $totime seconds" - wsrep_log_info "mariabackup SST/IST completed on joiner" fi +wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE" exit 0 diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index 3c92f489cb5..e1efcbf11ad 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -163,10 +163,11 @@ then echo "$STOP_WSREP" && $MYSQLDUMP && echo "$CSV_TABLES_FIX" && \ echo "$RESTORE_GENERAL_LOG" && echo "$RESTORE_SLOW_QUERY_LOG" && \ echo "$SET_START_POSITION" && echo "$SET_WSREP_GTID_DOMAIN_ID" \ - || echo "SST failed to complete;") | $MYSQL + || echo "SST failed to complete;") | $MYSQL || exit $? else wsrep_log_info "Bypassing state dump." - echo "$SET_START_POSITION" | $MYSQL + echo "$SET_START_POSITION" | $MYSQL || exit $? fi -# +wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE" +exit 0 diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 2c3622dff7a..1775281e634 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -34,6 +34,12 @@ wsrep_check_programs rsync cleanup_joiner() { + # Since this is invoked just after exit NNN + local estatus=$? + if [ $estatus -ne 0 ]; then + wsrep_log_error "Cleanup after exit with status: $estatus" + fi + local failure=0 [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" @@ -72,7 +78,9 @@ cleanup_joiner() wsrep_cleanup_progress_file fi - [ -f "$SST_PID" ] && rm -f "$SST_PID" + [ -f "$SST_PID" ] && rm -f "$SST_PID" || : + + exit $estatus } check_pid_and_port() @@ -310,6 +318,7 @@ if [ -n "$SSLMODE" -a "$SSLMODE" != 'DISABLED' ]; then fi readonly SECRET_TAG='secret' +readonly BYPASS_TAG='secret /bypass' SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid" @@ -325,6 +334,7 @@ while check_pid "$SST_PID" 0; do sleep 1 done +trap simple_cleanup EXIT echo $$ > "$SST_PID" # give some time for stunnel from the previous SST to complete: @@ -358,7 +368,7 @@ while check_pid "$RSYNC_PID" 1 "$RSYNC_CONF"; do sleep 1 done -[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" +[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" [ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE" if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then @@ -390,7 +400,7 @@ EOF ERROR="$WSREP_SST_OPT_DATA/sst_error" [ -f "$FLUSHED" ] && rm -f "$FLUSHED" - [ -f "$ERROR" ] && rm -f "$ERROR" + [ -f "$ERROR" ] && rm -f "$ERROR" echo 'flush tables' @@ -400,7 +410,7 @@ EOF # (c) ERROR file, in case flush tables operation failed. while [ ! -r "$FLUSHED" ] && \ - ! grep -q -F ':' '--' "$FLUSHED" >/dev/null 2>&1 + ! grep -q -F ':' -- "$FLUSHED" 2>/dev/null do # Check whether ERROR file exists. if [ -f "$ERROR" ]; then @@ -440,9 +450,16 @@ EOF tar_type=0 if tar --help | grep -qw -F -- '--transform'; then tar_type=1 - elif tar --version | grep -q -E '^bsdtar\>'; then + elif tar --version | grep -qw -E '^bsdtar'; then tar_type=2 fi + if [ $tar_type -eq 2 ]; then + if [ -n "$BASH_VERSION" ]; then + printf '%s' "$binlog_files" >&2 + else + echo "$binlog_files" >&2 + fi + fi if [ $tar_type -ne 0 ]; then # Preparing list of the binlog file names: echo "$binlog_files" | { @@ -501,9 +518,8 @@ EOF fi # Use deltaxfer only for WAN: - inv=$(basename "$0") WHOLE_FILE_OPT="" - if [ "${inv%wsrep_sst_rsync_wan*}" = "$inv" ]; then + if [ "${WSREP_METHOD%_wan}" = "$WSREP_METHOD" ]; then WHOLE_FILE_OPT='--whole-file' fi @@ -613,7 +629,6 @@ FILTER="-f '- /lost+found' wsrep_log_info "Transfer of data done" - else # BYPASS wsrep_log_info "Bypassing state dump." @@ -634,6 +649,10 @@ FILTER="-f '- /lost+found' echo "$SECRET_TAG $WSREP_SST_OPT_REMOTE_PSWD" >> "$MAGIC_FILE" fi + if [ $WSREP_SST_OPT_BYPASS -ne 0 ]; then + echo "$BYPASS_TAG" >> "$MAGIC_FILE" + fi + rsync ${STUNNEL:+--rsh="$STUNNEL"} \ --archive --quiet --checksum "$MAGIC_FILE" \ "rsync://$WSREP_SST_OPT_ADDR" >&2 || RC=$? @@ -647,15 +666,11 @@ FILTER="-f '- /lost+found' if [ -n "$STUNNEL" ]; then [ -f "$STUNNEL_CONF" ] && rm -f "$STUNNEL_CONF" - [ -f "$STUNNEL_PID" ] && rm -f "$STUNNEL_PID" + [ -f "$STUNNEL_PID" ] && rm -f "$STUNNEL_PID" fi - [ -f "$SST_PID" ] && rm -f "$SST_PID" - - wsrep_log_info "rsync SST/IST completed on donor" +else # joiner -elif [ "$WSREP_SST_OPT_ROLE" = 'joiner' ] -then check_sockets_utils ADDR="$WSREP_SST_OPT_HOST" @@ -663,8 +678,6 @@ then RSYNC_ADDR="$WSREP_SST_OPT_HOST" RSYNC_ADDR_UNESCAPED="$WSREP_SST_OPT_HOST_UNESCAPED" - trap 'exit 32' HUP PIPE - trap 'exit 3' INT TERM ABRT trap cleanup_joiner EXIT touch "$SST_PROGRESS_FILE" @@ -797,8 +810,7 @@ EOF sleep 1 done - if ! ps -p $MYSQLD_PID >/dev/null 2>&1 - then + if ! ps -p $MYSQLD_PID >/dev/null 2>&1; then wsrep_log_error \ "Parent mysqld process (PID: $MYSQLD_PID) terminated unexpectedly." kill -- -$MYSQLD_PID @@ -806,52 +818,68 @@ EOF exit 32 fi - if [ -r "$MAGIC_FILE" ]; then - if [ -n "$MY_SECRET" ]; then - # Check donor supplied secret: - SECRET=$(grep -F -- "$SECRET_TAG " "$MAGIC_FILE" 2>/dev/null | \ - cut -d ' ' -f2) - if [ "$SECRET" != "$MY_SECRET" ]; then - wsrep_log_error "Donor does not know my secret!" - wsrep_log_info "Donor: '$SECRET', my: '$MY_SECRET'" - exit 32 - fi - fi - else + if [ ! -r "$MAGIC_FILE" ]; then # This message should cause joiner to abort: - wsrep_log_info "rsync process ended without creating magic file" - echo "rsync process ended without creating '$MAGIC_FILE'" + wsrep_log_info "rsync process ended without creating" \ + "magic file ($MAGIC_FILE)" exit 32 fi - if [ -n "$WSREP_SST_OPT_BINLOG" ]; then - binlog_tar_present=0 - [ -f "$BINLOG_TAR_FILE" ] && binlog_tar_present=1 + if [ -n "$MY_SECRET" ]; then + # Select the "secret" tag whose value does not start + # with a slash symbol. All new tags must to start with + # the space and the slash symbol after the word "secret" - + # to be removed by older versions of the SST scripts: + SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]+[^/]" \ + -- "$MAGIC_FILE" || :) + # Check donor supplied secret: + SECRET=$(trim_string "${SECRET#$SECRET_TAG}") + if [ "$SECRET" != "$MY_SECRET" ]; then + wsrep_log_error "Donor does not know my secret!" + wsrep_log_info "Donor: '$SECRET', my: '$MY_SECRET'" + exit 32 + fi + fi + + if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then + if grep -m1 -qE "^$BYPASS_TAG([[space]]+.*)?\$" -- "$MAGIC_FILE"; then + readonly WSREP_SST_OPT_BYPASS=1 + readonly WSREP_TRANSFER_TYPE='IST' + fi + fi + + binlog_tar_present=0 + if [ -f "$BINLOG_TAR_FILE" ]; then + if [ $WSREP_SST_OPT_BYPASS -ne 0 ]; then + wsrep_log_warning "tar with binlogs transferred in the IST mode" + fi + binlog_tar_present=1 + fi + + if [ $WSREP_SST_OPT_BYPASS -eq 0 -a -n "$WSREP_SST_OPT_BINLOG" ]; then # If it is SST (not an IST) or tar with binlogs is present # among the transferred files, then we need to remove the # old binlogs: - if [ $WSREP_SST_OPT_BYPASS -eq 0 -o $binlog_tar_present -ne 0 ]; then - cd "$DATA" - # Clean up the old binlog files and index: - binlog_index="$WSREP_SST_OPT_BINLOG_INDEX" - if [ -f "$binlog_index" ]; then - while read bin_file || [ -n "$bin_file" ]; do - rm -f "$bin_file" || : - done < "$binlog_index" - rm -f "$binlog_index" - fi - binlog_cd=0 - # Change the directory to binlog base (if possible): - if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \ - -d "$binlog_dir" ] - then - binlog_cd=1 - cd "$binlog_dir" - fi - # Clean up unindexed binlog files: - rm -f "$binlog_base".[0-9]* || : - [ $binlog_cd -ne 0 ] && cd "$DATA_DIR" + cd "$DATA" + # Clean up the old binlog files and index: + binlog_index="$WSREP_SST_OPT_BINLOG_INDEX" + if [ -f "$binlog_index" ]; then + while read bin_file || [ -n "$bin_file" ]; do + rm -f "$bin_file" || : + done < "$binlog_index" + rm -f "$binlog_index" + fi + binlog_cd=0 + # Change the directory to binlog base (if possible): + if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \ + -d "$binlog_dir" ] + then + binlog_cd=1 + cd "$binlog_dir" fi + # Clean up unindexed binlog files: + rm -f "$binlog_base".[0-9]* || : + [ $binlog_cd -ne 0 ] && cd "$DATA_DIR" if [ $binlog_tar_present -ne 0 ]; then # Create a temporary file: tmpdir=$(parse_cnf '--mysqld|sst' 'tmpdir') @@ -875,7 +903,7 @@ EOF # Extracting binlog files: wsrep_log_info "Extracting binlog files:" RC=0 - if tar --version | grep -q -E '^bsdtar\>'; then + if tar --version | grep -qw -E '^bsdtar'; then tar -tf "$BINLOG_TAR_FILE" > "$tmpfile" && \ tar -xvf "$BINLOG_TAR_FILE" > /dev/null || RC=$? else @@ -883,8 +911,8 @@ EOF cat "$tmpfile" >&2 || RC=$? fi if [ $RC -ne 0 ]; then - rm -f "$tmpfile" wsrep_log_error "Error unpacking tar file with binlog files" + rm -f "$tmpfile" exit 32 fi # Rebuild binlog index: @@ -897,24 +925,13 @@ EOF fi fi - if [ -n "$MY_SECRET" ]; then - # remove secret from the magic file, and output - # the UUID:seqno & wsrep_gtid_domain_id: - grep -v -F -- "$SECRET_TAG " "$MAGIC_FILE" - else - # Output the UUID:seqno and wsrep_gtid_domain_id: - cat "$MAGIC_FILE" - fi - - wsrep_log_info "rsync SST/IST completed on joiner" - -# wsrep_cleanup_progress_file -# cleanup_joiner -else - wsrep_log_error "Unrecognized role: '$WSREP_SST_OPT_ROLE'" - exit 22 # EINVAL + # Remove special tags from the magic file, and from the output: + coords=$(grep -v -E "^$SECRET_TAG[[:space:]]" -- "$MAGIC_FILE") + wsrep_log_info "Galera co-ords from recovery: $coords" + echo "$coords" # Output : UUID:seqno wsrep_gtid_domain_id fi [ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE" +wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE" exit 0 diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc index 307f063fb43..25c80a7a796 100644 --- a/sql/gcalc_tools.cc +++ b/sql/gcalc_tools.cc @@ -132,7 +132,7 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type, int mask= (c_op & op_not) ? 1:0; uint n_ops= c_op & ~(op_any | op_not | v_mask); uint n_shape= c_op & ~(op_any | op_not | v_mask); /* same as n_ops */ - value v_state= (value) (c_op & v_mask); + op_type v_state= (op_type) (c_op & v_mask); int result= 0; const char *sav_cur_func= cur_func; diff --git a/sql/gcalc_tools.h b/sql/gcalc_tools.h index e625b355d95..bb1f473e180 100644 --- a/sql/gcalc_tools.h +++ b/sql/gcalc_tools.h @@ -52,17 +52,15 @@ private: int count_internal(const char *cur_func, uint set_type, const char **end); public: - enum value - { - v_empty= 0x0000000, - v_find_t= 0x1000000, - v_find_f= 0x2000000, - v_t_found= 0x3000000, - v_f_found= 0x4000000, - v_mask= 0x7000000 - }; enum op_type { + v_empty= 0x00000000, + v_find_t= 0x01000000, + v_find_f= 0x02000000, + v_t_found= 0x03000000, + v_f_found= 0x04000000, + v_mask= 0x07000000, + op_not= 0x80000000, op_shape= 0x00000000, op_union= 0x10000000, diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 29763447e6e..a9010e76389 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1616,7 +1616,6 @@ public: for (; part_id < part_id_end; ++part_id) { handler *file= m_file[part_id]; - DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), part_id)); file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_OPEN); part_recs+= file->stats.records; } diff --git a/sql/handler.h b/sql/handler.h index e8960d095e5..ed24f160385 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -965,6 +965,7 @@ typedef struct xid_t XID; */ typedef uint Binlog_file_id; const Binlog_file_id MAX_binlog_id= UINT_MAX; +const my_off_t MAX_off_t = (~(my_off_t) 0); /* Compound binlog-id and byte offset of transaction's first event in a sequence (e.g the recovery sequence) of binlog files. @@ -979,14 +980,22 @@ struct xid_recovery_member my_xid xid; uint in_engine_prepare; // number of engines that have xid prepared bool decided_to_commit; - Binlog_offset binlog_coord; // semisync recovery binlog offset + /* + Semisync recovery binlog offset. It's initialized with the maximum + unreachable offset. The max value will remain for any transaction + not found in binlog to yield its rollback decision as it's guaranteed + to be within a truncated tail part of the binlog. + */ + Binlog_offset binlog_coord; XID *full_xid; // needed by wsrep or past it recovery decltype(::server_id) server_id; // server id of orginal server xid_recovery_member(my_xid xid_arg, uint prepare_arg, bool decided_arg, XID *full_xid_arg, decltype(::server_id) server_id_arg) : xid(xid_arg), in_engine_prepare(prepare_arg), - decided_to_commit(decided_arg), full_xid(full_xid_arg) , server_id(server_id_arg) {}; + decided_to_commit(decided_arg), + binlog_coord(Binlog_offset(MAX_binlog_id, MAX_off_t)), + full_xid(full_xid_arg), server_id(server_id_arg) {}; }; /* for recover() handlerton call */ diff --git a/sql/item.h b/sql/item.h index f6c123e79d4..c3251259b43 100644 --- a/sql/item.h +++ b/sql/item.h @@ -6648,9 +6648,9 @@ public: bool get_date(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate) override; bool val_native(THD *thd, Native *to) override; bool val_native_result(THD *thd, Native *to) override; - longlong val_datetime_packed(THD *thd) + longlong val_datetime_packed(THD *thd) override { return Item::val_datetime_packed(thd); } - longlong val_time_packed(THD *thd) + longlong val_time_packed(THD *thd) override { return Item::val_time_packed(thd); } /* Result variants */ diff --git a/sql/item_sum.cc b/sql/item_sum.cc index ca757b6b94a..d33202d0a42 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -4255,9 +4255,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) result.set_charset(collation.collation); result_field= 0; null_value= 1; - max_length= (uint32)MY_MIN(thd->variables.group_concat_max_len - / collation.collation->mbminlen - * collation.collation->mbmaxlen, UINT_MAX32); + max_length= (uint32) MY_MIN((ulonglong) thd->variables.group_concat_max_len + / collation.collation->mbminlen + * collation.collation->mbmaxlen, UINT_MAX32); uint32 offset; if (separator->needs_conversion(separator->length(), separator->charset(), diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index 713c6ac4c3f..1e79e6444ff 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -333,7 +333,7 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size) " %s" " --bootstrap" " --datadir=." - " --loose-innodb-buffer-pool-size=10M" + " --loose-innodb-buffer-pool-size=20M" "\"" , mysqld_path, opt_verbose_bootstrap ? "--console" : ""); return cmdline; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f444fb19db7..ea1bfa1aaf3 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5374,7 +5374,9 @@ static int init_server_components() if (ha_recover(0)) unireg_abort(1); +#ifndef EMBEDDED_LIBRARY start_handle_manager(); +#endif if (opt_bin_log) { int error; diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 294834b84f0..6f3f6ec211a 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -891,8 +891,6 @@ void partition_info::vers_check_limit(THD *thd) uint32 part_id= vers_info->hist_part->id * sub_factor; const uint32 part_id_end= part_id + sub_factor; DBUG_ASSERT(part_id_end <= num_parts * sub_factor); - for (; part_id < part_id_end; ++part_id) - bitmap_set_bit(&read_partitions, part_id); ha_partition *hp= (ha_partition*)(table->file); ha_rows hist_rows= hp->part_records(vers_info->hist_part); diff --git a/sql/slave.cc b/sql/slave.cc index a8aa349b6cc..f9532752d3f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -7154,8 +7154,9 @@ dbug_gtid_accept: mi->using_gtid != Master_info::USE_GTID_NO && mi->events_queued_since_last_gtid > 0 && ( (mi->last_queued_gtid_standalone && - !Log_event::is_part_of_group((Log_event_type)(uchar) - buf[EVENT_TYPE_OFFSET])) || + (LOG_EVENT_IS_QUERY((Log_event_type)(uchar) + buf[EVENT_TYPE_OFFSET]) || + (uchar)buf[EVENT_TYPE_OFFSET] == INCIDENT_EVENT)) || (!mi->last_queued_gtid_standalone && ((uchar)buf[EVENT_TYPE_OFFSET] == XID_EVENT || (uchar)buf[EVENT_TYPE_OFFSET] == XA_PREPARE_LOG_EVENT || @@ -7189,33 +7190,8 @@ dbug_gtid_accept: mi->gtid_current_pos.update(&mi->last_queued_gtid); mi->events_queued_since_last_gtid= 0; - if (unlikely(gtid_skip_enqueue)) - { - error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE; - sql_print_error("Recieved a group closing %s event " - "at %llu position in the group while there are " - "still %llu events to skip upon reconnecting; " - "the last seen GTID is %u-%u-%llu", - Log_event::get_type_str((Log_event_type) (uchar) - buf[EVENT_TYPE_OFFSET]), - (mi->events_queued_since_last_gtid - - mi->gtid_reconnect_event_skip_count), - mi->events_queued_since_last_gtid, - mi->last_queued_gtid); - goto err; - } - else - { - /* - The whole of the current event group is queued. So in case of - reconnect we can start from after the current GTID. - */ - mi->gtid_current_pos.update(&mi->last_queued_gtid); - mi->events_queued_since_last_gtid= 0; - - /* Reset the domain_id_filter flag. */ - mi->domain_id_filter.reset_filter(); - } + /* Reset the domain_id_filter flag. */ + mi->domain_id_filter.reset_filter(); } skip_relay_logging: diff --git a/sql/sql_class.h b/sql/sql_class.h index f8985d2093d..a6f51d4b28f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5595,8 +5595,8 @@ my_eof(THD *thd) inline date_conv_mode_t sql_mode_for_dates(THD *thd) { - static_assert((date_conv_mode_t::KNOWN_MODES & - time_round_mode_t::KNOWN_MODES) == 0, + static_assert((ulonglong(date_conv_mode_t::KNOWN_MODES) & + ulonglong(time_round_mode_t::KNOWN_MODES)) == 0, "date_conv_mode_t and time_round_mode_t must use different " "bit values"); static_assert(MODE_NO_ZERO_DATE == date_mode_t::NO_ZERO_DATE && diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1a3bfa232e8..2fb98f5aa88 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -7800,7 +7800,7 @@ bool LEX::maybe_start_compound_statement(THD *thd) if (!make_sp_head(thd, NULL, &sp_handler_procedure, DEFAULT_AGGREGATE)) return true; sphead->set_suid(SP_IS_NOT_SUID); - sphead->set_body_start(thd, thd->m_parser_state->m_lip.get_cpp_ptr()); + sphead->set_body_start(thd, thd->m_parser_state->m_lip.get_cpp_tok_start()); } return false; } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4625e60703b..3233234fd39 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -2047,8 +2047,7 @@ public: @retval nonzero if the statement is a row injection */ inline bool is_stmt_row_injection() const { - return binlog_stmt_flags & - (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION)); + return binlog_stmt_flags & (1U << BINLOG_STMT_TYPE_ROW_INJECTION); } /** @@ -2058,8 +2057,7 @@ public: */ inline void set_stmt_row_injection() { DBUG_ENTER("set_stmt_row_injection"); - binlog_stmt_flags|= - (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION)); + binlog_stmt_flags|= (1U << BINLOG_STMT_TYPE_ROW_INJECTION); DBUG_VOID_RETURN; } @@ -2335,7 +2333,7 @@ private: The statement is a row injection (i.e., either a BINLOG statement or a row event executed by the slave SQL thread). */ - BINLOG_STMT_TYPE_ROW_INJECTION = 0, + BINLOG_STMT_TYPE_ROW_INJECTION = BINLOG_STMT_UNSAFE_COUNT, /** The last element of this enumeration type. */ BINLOG_STMT_TYPE_COUNT @@ -2349,8 +2347,8 @@ private: - The low BINLOG_STMT_UNSAFE_COUNT bits indicate the types of unsafeness that the current statement has. - - The next BINLOG_STMT_TYPE_COUNT bits indicate if the statement - is of some special type. + - The next BINLOG_STMT_TYPE_COUNT-BINLOG_STMT_TYPE_COUNT bits indicate if + the statement is of some special type. This must be a member of LEX, not of THD: each stored procedure needs to remember its unsafeness state between calls and each diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cdafc3f720e..f8f61c66df0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1505,22 +1505,6 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables) } #ifdef WITH_WSREP -static my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables) -{ - int opt_readonly_saved = opt_readonly; - privilege_t flag_saved= thd->security_ctx->master_access & PRIV_IGNORE_READ_ONLY; - - opt_readonly = 0; - thd->security_ctx->master_access &= ~PRIV_IGNORE_READ_ONLY; - - my_bool ret = !deny_updates_if_read_only_option(thd, all_tables); - - opt_readonly = opt_readonly_saved; - thd->security_ctx->master_access |= flag_saved; - - return ret; -} - static void wsrep_copy_query(THD *thd) { thd->wsrep_retry_command = thd->get_command(); @@ -7848,7 +7832,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, { bool is_autocommit= !thd->in_multi_stmt_transaction_mode() && - wsrep_read_only_option(thd, thd->lex->query_tables); + !thd->wsrep_applier; bool retry_autocommit; do { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4cc23c694d7..52deb20284c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -111,12 +111,19 @@ static void optimize_straight_join(JOIN *join, table_map join_tables); static bool greedy_search(JOIN *join, table_map remaining_tables, uint depth, uint prune_level, uint use_cond_selectivity); -static bool best_extension_by_limited_search(JOIN *join, - table_map remaining_tables, - uint idx, double record_count, - double read_time, uint depth, - uint prune_level, - uint use_cond_selectivity); +enum enum_best_search { + SEARCH_ABORT= -2, + SEARCH_ERROR= -1, + SEARCH_OK= 0, + SEARCH_FOUND_EDGE=1 +}; +static enum_best_search +best_extension_by_limited_search(JOIN *join, + table_map remaining_tables, + uint idx, double record_count, + double read_time, uint depth, + uint prune_level, + uint use_cond_selectivity); static uint determine_search_depth(JOIN* join); C_MODE_START static int join_tab_cmp(const void *dummy, const void* ptr1, const void* ptr2); @@ -384,6 +391,7 @@ POSITION::POSITION() range_rowid_filter_info= 0; ref_depend_map= dups_producing_tables= 0; inner_tables_handled_with_other_sjs= 0; + type= JT_UNKNOWN; dups_weedout_picker.set_empty(); firstmatch_picker.set_empty(); loosescan_picker.set_empty(); @@ -8445,6 +8453,7 @@ best_access_path(JOIN *join, pos->records_read= records; pos->read_time= best; pos->key= best_key; + pos->type= best_type; pos->table= s; pos->ref_depend_map= best_ref_depends_map; pos->loosescan_picker.loosescan_key= MAX_KEY; @@ -9100,9 +9109,12 @@ greedy_search(JOIN *join, do { /* Find the extension of the current QEP with the lowest cost */ join->best_read= DBL_MAX; - if (best_extension_by_limited_search(join, remaining_tables, idx, record_count, - read_time, search_depth, prune_level, - use_cond_selectivity)) + if ((int) best_extension_by_limited_search(join, remaining_tables, idx, + record_count, + read_time, search_depth, + prune_level, + use_cond_selectivity) < + (int) SEARCH_OK) DBUG_RETURN(TRUE); /* 'best_read < DBL_MAX' means that optimizer managed to find @@ -9738,6 +9750,28 @@ exit: } +/* + Check if the table is an EQ_REF or similar table and there is no cost + to gain by moveing it to a later stage. + We call such a table a edge table (or hanging leaf) as it will read at + most one row and will not add to the number of row combinations in the join. +*/ + +static inline enum_best_search +check_if_edge_table(POSITION *pos, + double pushdown_cond_selectivity) +{ + + if ((pos->type == JT_EQ_REF || + (pos->type == JT_REF && + pos->records_read == 1 && + !pos->range_rowid_filter_info)) && + pushdown_cond_selectivity >= 0.999) + return SEARCH_FOUND_EDGE; + return SEARCH_OK; +} + + /** Find a good, possibly optimal, query execution plan (QEP) by a possibly exhaustive search. @@ -9852,12 +9886,17 @@ exit: pushed to a table should be taken into account @retval - FALSE ok + enum_best_search::SEARCH_OK All fine @retval - TRUE Fatal error + enum_best_search::SEARCH_FOUND_EDGE All remaning tables are edge tables + @retval + enum_best_search::SEARCH_ABORT Killed by user + @retval + enum_best_search::SEARCH_ERROR Fatal error */ -static bool + +static enum_best_search best_extension_by_limited_search(JOIN *join, table_map remaining_tables, uint idx, @@ -9867,9 +9906,17 @@ best_extension_by_limited_search(JOIN *join, uint prune_level, uint use_cond_selectivity) { - DBUG_ENTER("best_extension_by_limited_search"); - THD *thd= join->thd; + /* + 'join' is a partial plan with lower cost than the best plan so far, + so continue expanding it further with the tables in 'remaining_tables'. + */ + JOIN_TAB *s; + double best_record_count= DBL_MAX; + double best_read_time= DBL_MAX; + bool disable_jbuf= join->thd->variables.join_cache_level == 0; + enum_best_search best_res; + DBUG_ENTER("best_extension_by_limited_search"); DBUG_EXECUTE_IF("show_explain_probe_best_ext_lim_search", if (dbug_user_var_equals_int(thd, @@ -9879,19 +9926,7 @@ best_extension_by_limited_search(JOIN *join, ); if (unlikely(thd->check_killed())) // Abort - DBUG_RETURN(TRUE); - - DBUG_EXECUTE("opt", print_plan(join, idx, read_time, record_count, idx, - "SOFAR:");); - - /* - 'join' is a partial plan with lower cost than the best plan so far, - so continue expanding it further with the tables in 'remaining_tables'. - */ - JOIN_TAB *s; - double best_record_count= DBL_MAX; - double best_read_time= DBL_MAX; - bool disable_jbuf= join->thd->variables.join_cache_level == 0; + DBUG_RETURN(SEARCH_ABORT); DBUG_EXECUTE("opt", print_plan(join, idx, record_count, read_time, read_time, "part_plan");); @@ -9907,15 +9942,18 @@ best_extension_by_limited_search(JOIN *join, for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++) { table_map real_table_bit= s->table->map; - if ((remaining_tables & real_table_bit) && - (allowed_tables & real_table_bit) && + DBUG_ASSERT(remaining_tables & real_table_bit); + + if ((allowed_tables & real_table_bit) && !(remaining_tables & s->dependent) && - (!idx || !check_interleaving_with_nj(s))) + !check_interleaving_with_nj(s)) { double current_record_count, current_read_time; + double partial_join_cardinality; POSITION *position= join->positions + idx; - + POSITION loose_scan_pos; Json_writer_object trace_one_table(thd); + if (unlikely(thd->trace_started())) { trace_plan_prefix(join, idx, remaining_tables); @@ -9923,7 +9961,6 @@ best_extension_by_limited_search(JOIN *join, } /* Find the best access method from 's' to the current partial plan */ - POSITION loose_scan_pos; best_access_path(join, s, remaining_tables, join->positions, idx, disable_jbuf, record_count, position, &loose_scan_pos); @@ -9998,32 +10035,51 @@ best_extension_by_limited_search(JOIN *join, double pushdown_cond_selectivity= 1.0; if (use_cond_selectivity > 1) pushdown_cond_selectivity= table_cond_selectivity(join, idx, s, - remaining_tables & + remaining_tables & ~real_table_bit); join->positions[idx].cond_selectivity= pushdown_cond_selectivity; - if (unlikely(thd->trace_started()) && pushdown_cond_selectivity < 1.0) - trace_one_table.add("selectivity", pushdown_cond_selectivity); + partial_join_cardinality= (current_record_count * + pushdown_cond_selectivity); - double partial_join_cardinality= current_record_count * - pushdown_cond_selectivity; - if ( (search_depth > 1) && (remaining_tables & ~real_table_bit) & allowed_tables ) - { /* Recursively expand the current partial plan */ + if (unlikely(thd->trace_started())) + { + if (pushdown_cond_selectivity < 1.0) + { + trace_one_table.add("selectivity", pushdown_cond_selectivity); + trace_one_table.add("estimated_join_cardinality", + partial_join_cardinality); + } + } + + if ((search_depth > 1) && (remaining_tables & ~real_table_bit) & + allowed_tables) + { + /* Recursively expand the current partial plan */ swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); Json_writer_array trace_rest(thd, "rest_of_plan"); - if (best_extension_by_limited_search(join, - remaining_tables & ~real_table_bit, - idx + 1, - partial_join_cardinality, - current_read_time, - search_depth - 1, - prune_level, - use_cond_selectivity)) - DBUG_RETURN(TRUE); + best_res= + best_extension_by_limited_search(join, + remaining_tables & + ~real_table_bit, + idx + 1, + partial_join_cardinality, + current_read_time, + search_depth - 1, + prune_level, + use_cond_selectivity); + if ((int) best_res < (int) SEARCH_OK) + DBUG_RETURN(best_res); // Abort swap_variables(JOIN_TAB*, join->best_ref[idx], *pos); + if (best_res == SEARCH_FOUND_EDGE && + check_if_edge_table(join->positions+ idx, + pushdown_cond_selectivity) != + SEARCH_FOUND_EDGE) + best_res= SEARCH_OK; } else - { /* + { + /* 'join' is either the best partial QEP with 'search_depth' relations, or the best complete QEP so far, whichever is smaller. */ @@ -10032,15 +10088,13 @@ best_extension_by_limited_search(JOIN *join, join->positions[join->const_tables].table->table) { /* - We may have to make a temp table, note that this is only a - heuristic since we cannot know for sure at this point. - Hence it may be wrong. + We may have to make a temp table, note that this is only a + heuristic since we cannot know for sure at this point. + Hence it may be wrong. */ trace_one_table.add("cost_for_sorting", current_record_count); current_read_time= COST_ADD(current_read_time, current_record_count); } - trace_one_table.add("estimated_join_cardinality", - partial_join_cardinality); if (current_read_time < join->best_read) { memcpy((uchar*) join->best_positions, (uchar*) join->positions, @@ -10053,12 +10107,19 @@ best_extension_by_limited_search(JOIN *join, read_time, current_read_time, "full_plan");); + best_res= check_if_edge_table(join->positions + idx, + pushdown_cond_selectivity); } restore_prev_nj_state(s); restore_prev_sj_state(remaining_tables, s, idx); + if (best_res == SEARCH_FOUND_EDGE) + { + trace_one_table.add("pruned_by_hanging_leaf", true); + DBUG_RETURN(best_res); + } } } - DBUG_RETURN(FALSE); + DBUG_RETURN(SEARCH_OK); } @@ -17210,7 +17271,6 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list) static bool check_interleaving_with_nj(JOIN_TAB *next_tab) { - TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding; JOIN *join= next_tab->join; if (join->cur_embedding_map & ~next_tab->embedding_map) @@ -17222,6 +17282,7 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab) return TRUE; } + TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding; /* Do update counters for "pairs of brackets" that we've left (marked as X,Y,Z in the above picture) diff --git a/sql/sql_select.h b/sql/sql_select.h index e854792b073..4a2929207a5 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -989,6 +989,8 @@ public: */ enum sj_strategy_enum sj_strategy; + /* Type of join (EQ_REF, REF etc) */ + enum join_type type; /* Valid only after fix_semijoin_strategies_for_picked_join_order() call: if sj_strategy!=SJ_OPT_NONE, this is the number of subsequent tables that diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f4f6aca59b8..93a0163b073 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2361,6 +2361,7 @@ create: lex->create_info.default_table_charset= NULL; lex->name= null_clex_str; lex->create_last_non_select_table= lex->last_table(); + lex->inc_select_stack_outer_barrier(); } create_body { diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index 70759e381a5..f99d33094df 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -232,6 +232,10 @@ static inline int wsrep_before_prepare(THD* thd, bool all) WSREP_DEBUG("wsrep_before_prepare: %d", wsrep_is_real(thd, all)); int ret= 0; DBUG_ASSERT(wsrep_run_commit_hook(thd, all)); + if ((ret= thd->wsrep_parallel_slave_wait_for_prior_commit())) + { + DBUG_RETURN(ret); + } if ((ret= thd->wsrep_cs().before_prepare()) == 0) { DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined()); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 6af73eab366..03c15ecebf7 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1113,15 +1113,19 @@ bool buf_pool_t::create() ut_ad(srv_buf_pool_size > 0); ut_ad(!resizing); ut_ad(!chunks_old); - ut_ad(!field_ref_zero); + /* mariabackup loads tablespaces, and it requires field_ref_zero to be + allocated before innodb initialization */ + ut_ad(srv_operation >= SRV_OPERATION_RESTORE || !field_ref_zero); NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; - if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) - field_ref_zero= static_cast<const byte*> - (memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); - else - return true; + if (!field_ref_zero) { + if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) + field_ref_zero= static_cast<const byte*> + (memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); + else + return true; + } chunk_t::map_reg= UT_NEW_NOKEY(chunk_t::map()); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b15827024fe..d9421eb538f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1033,10 +1033,6 @@ static SHOW_VAR innodb_status_variables[]= { /* Status variables for page compression */ {"page_compression_saved", &export_vars.innodb_page_compression_saved, SHOW_LONGLONG}, - {"num_index_pages_written", - &export_vars.innodb_index_pages_written, SHOW_LONGLONG}, - {"num_non_index_pages_written", - &export_vars.innodb_non_index_pages_written, SHOW_LONGLONG}, {"num_pages_page_compressed", &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG}, {"num_page_compressed_trim_op", @@ -1091,8 +1087,6 @@ static SHOW_VAR innodb_status_variables[]= { &export_vars.innodb_encryption_rotation_pages_flushed, SHOW_SIZE_T}, {"encryption_rotation_estimated_iops", &export_vars.innodb_encryption_rotation_estimated_iops, SHOW_SIZE_T}, - {"encryption_key_rotation_list_length", - &export_vars.innodb_key_rotation_list_length, SHOW_LONGLONG}, {"encryption_n_merge_blocks_encrypted", &export_vars.innodb_n_merge_blocks_encrypted, SHOW_LONGLONG}, {"encryption_n_merge_blocks_decrypted", diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index fe6c83c458c..971f6363bdb 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -2,7 +2,7 @@ Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, 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 @@ -174,8 +174,6 @@ enum monitor_id_t { MONITOR_OVLD_BUF_POOL_PAGES_FREE, MONITOR_OVLD_PAGE_CREATED, MONITOR_OVLD_PAGES_WRITTEN, - MONITOR_OVLD_INDEX_PAGES_WRITTEN, - MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN, MONITOR_OVLD_PAGES_READ, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index ecd2d0f3020..4cd77b08a60 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -114,10 +114,6 @@ struct srv_stats_t /** Number of bytes saved by page compression */ ulint_ctr_n_t page_compression_saved; - /* Number of index pages written */ - ulint_ctr_n_t index_pages_written; - /* Number of non index pages written */ - ulint_ctr_n_t non_index_pages_written; /* Number of pages compressed with page compression */ ulint_ctr_n_t pages_page_compressed; /* Number of TRIM operations induced by page compression */ @@ -175,9 +171,6 @@ struct srv_stats_t /** Number of encryption_get_latest_key_version calls */ ulint_ctr_n_t n_key_requests; - /** Number of spaces in keyrotation list */ - ulint_ctr_n_t key_rotation_list_length; - /** Number of temporary tablespace blocks encrypted */ ulint_ctr_n_t n_temp_blocks_encrypted; @@ -768,10 +761,6 @@ struct export_var_t{ int64_t innodb_page_compression_saved;/*!< Number of bytes saved by page compression */ - int64_t innodb_index_pages_written; /*!< Number of index pages - written */ - int64_t innodb_non_index_pages_written; /*!< Number of non index pages - written */ int64_t innodb_pages_page_compressed;/*!< Number of pages compressed by page compression */ int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations @@ -810,7 +799,6 @@ struct export_var_t{ ulint innodb_encryption_rotation_pages_flushed; ulint innodb_encryption_rotation_estimated_iops; int64_t innodb_encryption_key_requests; - int64_t innodb_key_rotation_list_length; }; extern tpool::thread_pool *srv_thread_pool; diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 132962dd5bd..8f6c40c2412 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -272,18 +272,6 @@ static monitor_info_t innodb_counter_info[] = MONITOR_EXISTING | MONITOR_DEFAULT_ON), MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_WRITTEN}, - {"buffer_index_pages_written", "buffer", - "Number of index pages written (innodb_index_pages_written)", - static_cast<monitor_type_t>( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_PAGES_WRITTEN}, - - {"buffer_non_index_pages_written", "buffer", - "Number of non index pages written (innodb_non_index_pages_written)", - static_cast<monitor_type_t>( - MONITOR_EXISTING | MONITOR_DEFAULT_ON), - MONITOR_DEFAULT_START, MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN}, - {"buffer_pages_read", "buffer", "Number of pages read (innodb_pages_read)", static_cast<monitor_type_t>( @@ -1505,16 +1493,6 @@ srv_mon_process_existing_counter( value = buf_pool.stat.n_pages_written; break; - /* innodb_index_pages_written, the number of index pages written */ - case MONITOR_OVLD_INDEX_PAGES_WRITTEN: - value = srv_stats.index_pages_written; - break; - - /* innodb_non_index_pages_written, the number of non index pages written */ - case MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN: - value = srv_stats.non_index_pages_written; - break; - case MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE: value = buf_lru_flush_page_count; break; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index d5f9dd31f01..440f78681c9 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1142,8 +1142,6 @@ srv_export_innodb_status(void) srv_truncated_status_writes; export_vars.innodb_page_compression_saved = srv_stats.page_compression_saved; - export_vars.innodb_index_pages_written = srv_stats.index_pages_written; - export_vars.innodb_non_index_pages_written = srv_stats.non_index_pages_written; export_vars.innodb_pages_page_compressed = srv_stats.pages_page_compressed; export_vars.innodb_page_compressed_trim_op = srv_stats.page_compressed_trim_op; export_vars.innodb_pages_page_decompressed = srv_stats.pages_page_decompressed; @@ -1188,8 +1186,6 @@ srv_export_innodb_status(void) crypt_stat.estimated_iops; export_vars.innodb_encryption_key_requests = srv_stats.n_key_requests; - export_vars.innodb_key_rotation_list_length = - srv_stats.key_rotation_list_length; } mysql_mutex_unlock(&srv_innodb_monitor_mutex); diff --git a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result index 8f0357a8954..1b3b43c0304 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result @@ -51,8 +51,6 @@ buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Buffer pages currently free (innodb_buffer_pool_pages_free) buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages created (innodb_pages_created) buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages written (innodb_pages_written) -buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of index pages written (innodb_index_pages_written) -buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of non index pages written (innodb_non_index_pages_written) buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pages read (innodb_pages_read) buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads triggered cluster read buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of secondary record reads avoided triggering cluster read diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 03dc1ebd49f..0f37707c6ed 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -3891,27 +3891,15 @@ int spider_db_mbase::append_lock_tables( conn_link_idx = tmp_spider->conn_link_idx[tmp_link_idx]; spider_mbase_share *db_share = (spider_mbase_share *) tmp_spider->share->dbton_share[conn->dbton_id]; - if (&db_share->db_names_str[conn_link_idx]) - { - db_name = db_share->db_names_str[conn_link_idx].ptr(); - db_name_length = db_share->db_names_str[conn_link_idx].length(); - db_name_charset = tmp_spider->share->access_charset; - } else { - db_name = tmp_spider->share->tgt_dbs[conn_link_idx]; - db_name_length = tmp_spider->share->tgt_dbs_lengths[conn_link_idx]; - db_name_charset = system_charset_info; - } - if (&db_share->table_names_str[conn_link_idx]) - { - table_name = db_share->table_names_str[conn_link_idx].ptr(); - table_name_length = db_share->table_names_str[conn_link_idx].length(); - table_name_charset = tmp_spider->share->access_charset; - } else { - table_name = tmp_spider->share->tgt_table_names[conn_link_idx]; - table_name_length = - tmp_spider->share->tgt_table_names_lengths[conn_link_idx]; - table_name_charset = system_charset_info; - } + + db_name = db_share->db_names_str[conn_link_idx].ptr(); + db_name_length = db_share->db_names_str[conn_link_idx].length(); + db_name_charset = tmp_spider->share->access_charset; + + table_name = db_share->table_names_str[conn_link_idx].ptr(); + table_name_length = db_share->table_names_str[conn_link_idx].length(); + table_name_charset = tmp_spider->share->access_charset; + if ((error_num = spider_db_mbase_utility-> append_lock_table_body( str, diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp index 328e73accb8..dbd0b36745f 100644 --- a/win/packaging/ca/CustomAction.cpp +++ b/win/packaging/ca/CustomAction.cpp @@ -664,6 +664,12 @@ unsigned long long GetMaxBufferSize(unsigned long long totalPhys) /* + Magic undocumented number for bufferpool minimum, + allows innodb to start also for all page sizes. +*/ +static constexpr unsigned long long minBufferpoolMB= 20; + +/* Checks SERVICENAME, PORT and BUFFERSIZE parameters */ extern "C" UINT __stdcall CheckDatabaseProperties (MSIHANDLE hInstall) @@ -791,34 +797,37 @@ extern "C" UINT __stdcall CheckDatabaseProperties (MSIHANDLE hInstall) unsigned long long availableMemory= GetMaxBufferSize(memstatus.ullTotalPhys)/ONE_MB; swprintf_s(invalidValueMsg, - L"Invalid buffer pool size. Please use a number between 1 and %llu", - availableMemory); - if(BufferPoolSizeLen == 0 || BufferPoolSizeLen > 15) + L"Invalid buffer pool size. Please use a number between %llu and %llu", + minBufferpoolMB, availableMemory); + if (BufferPoolSizeLen == 0 || BufferPoolSizeLen > 15 || !BufferPoolSize[0]) { ErrorMsg= invalidValueMsg; goto LExit; } - for (DWORD i=0; i < BufferPoolSizeLen && BufferPoolSize[BufferPoolSizeLen]; - i++) - { - if(BufferPoolSize[i]< '0' || BufferPoolSize[i] > '9') - { - ErrorMsg= invalidValueMsg; - goto LExit; - } - } + BufferPoolSize[BufferPoolSizeLen]=0; MsiSetPropertyW(hInstall, L"BUFFERPOOLSIZE", BufferPoolSize); - long long sz = _wtoi64(BufferPoolSize); - if(sz <= 0 || sz > (long long)availableMemory) + wchar_t *end; + unsigned long long sz = wcstoull(BufferPoolSize, &end, 10); + if (sz > availableMemory || sz < minBufferpoolMB || *end) { - if(sz > 0) + if (*end == 0) { - swprintf_s(invalidValueMsg, - L"Value for buffer pool size is too large." - L"Only approximately %llu MB is available for allocation." - L"Please use a number between 1 and %llu.", - availableMemory, availableMemory); + if(sz > availableMemory) + { + swprintf_s(invalidValueMsg, + L"Value for buffer pool size is too large." + L"Only approximately %llu MB is available for allocation." + L"Please use a number between %llu and %llu.", + availableMemory, minBufferpoolMB, availableMemory); + } + else if(sz < minBufferpoolMB) + { + swprintf_s(invalidValueMsg, + L"Value for buffer pool size is too small." + L"Please use a number between %llu and %llu.", + minBufferpoolMB, availableMemory); + } } ErrorMsg= invalidValueMsg; goto LExit; |