From ae96b47f9ed184cdfe6622f564312209e2cd9251 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Sun, 18 Nov 2018 17:38:48 +0200 Subject: [PATCH 1/2] MDEV-17507 Make MTR tests work for builds without Aria for temporary tables Skip tests which expectedly fail when Aria is not used for temporary tables --- mysql-test/include/have_aria_used_for_temp_tables.inc | 4 ++++ .../suite/sys_vars/t/aria_used_for_temp_tables_basic.test | 1 + mysql-test/suite/sys_vars/t/sysvars_aria.test | 1 + mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test | 2 ++ mysql-test/t/information_schema.test | 4 ++++ 5 files changed, 12 insertions(+) create mode 100644 mysql-test/include/have_aria_used_for_temp_tables.inc diff --git a/mysql-test/include/have_aria_used_for_temp_tables.inc b/mysql-test/include/have_aria_used_for_temp_tables.inc new file mode 100644 index 00000000000..c921ba91d22 --- /dev/null +++ b/mysql-test/include/have_aria_used_for_temp_tables.inc @@ -0,0 +1,4 @@ +if (!`SELECT @@aria_used_for_temp_tables`) +{ + skip Need Aria to be used for temporary tables; +} diff --git a/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test b/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test index e962dcf178d..07f0c431138 100644 --- a/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test +++ b/mysql-test/suite/sys_vars/t/aria_used_for_temp_tables_basic.test @@ -1,5 +1,6 @@ # bool readonly +--source include/have_aria_used_for_temp_tables.inc --source include/have_maria.inc # # show the global and session values; diff --git a/mysql-test/suite/sys_vars/t/sysvars_aria.test b/mysql-test/suite/sys_vars/t/sysvars_aria.test index 5ff5c0d4b2b..67fb0baa4f1 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_aria.test +++ b/mysql-test/suite/sys_vars/t/sysvars_aria.test @@ -1,4 +1,5 @@ --source include/have_aria.inc +--source include/have_aria_used_for_temp_tables.inc --source include/word_size.inc --vertical_results diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test index bf93b4646d9..9c1e596d3e4 100644 --- a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test +++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test @@ -1,5 +1,7 @@ ###################### tmp_memory_table_size_func.test ######################## +--source include/have_aria_used_for_temp_tables.inc + --source include/load_sysvars.inc --source include/have_sequence.inc diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 417390dcafe..76a187e8c2e 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -8,6 +8,10 @@ # on the presence of the log tables (which are CSV-based). --source include/have_csv.inc +# Without aria_used_for_temp_tables some I_S tables will be MyISAM, +# while the test expects them to be Aria +-- source include/have_aria_used_for_temp_tables.inc + -- source include/have_innodb.inc # Save the initial number of concurrent sessions From b86e18cb44fd4ab42c08e4b7aae1b7e131a3ea46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 20 Nov 2018 14:55:44 +0200 Subject: [PATCH 2/2] MDEV-17780 innodb.truncate_recover crashes in recovery due to out-of-bounds page read recv_addr_trim(): Do not try to detach the hash bucket, because the code for doing that does not always work. recv_apply_hashed_log_recs(): Do not attempt to read pages for which there exist no redo log records. --- storage/innobase/log/log0recv.cc | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index f8e9a64f9d4..f71067fddf2 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -232,9 +232,8 @@ static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn) hash_cell_t* const cell = hash_get_nth_cell( recv_sys->addr_hash, i); for (recv_addr_t* addr = static_cast(cell->node), - *prev = NULL, *next; - addr; - prev = addr, addr = next) { + *next; + addr; addr = next) { next = static_cast(addr->addr_hash); if (addr->space != space_id || addr->page_no < pages) { @@ -256,22 +255,6 @@ static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn) } recv = n; } - - if (UT_LIST_GET_LEN(addr->rec_list)) { - DBUG_PRINT("ib_log", - ("preserving " ULINTPF - " records for page %u:%u", - UT_LIST_GET_LEN(addr->rec_list), - addr->space, addr->page_no)); - } else { - ut_ad(recv_sys->n_addrs); - --recv_sys->n_addrs; - if (addr == cell->node) { - cell->node = next; - } else { - prev->addr_hash = next; - } - } } } if (fil_space_t* space = fil_space_get(space_id)) { @@ -2169,8 +2152,7 @@ static ulint recv_read_in_area(const page_id_t page_id) /** Apply the hash table of stored log records to persistent data pages. @param[in] last_batch whether the change buffer merge will be performed as part of the operation */ -void -recv_apply_hashed_log_recs(bool last_batch) +void recv_apply_hashed_log_recs(bool last_batch) { ut_ad(srv_operation == SRV_OPERATION_NORMAL || srv_operation == SRV_OPERATION_RESTORE @@ -2233,7 +2215,8 @@ recv_apply_hashed_log_recs(bool last_batch) continue; } - if (recv_addr->state == RECV_DISCARDED) { + if (recv_addr->state == RECV_DISCARDED + || !UT_LIST_GET_LEN(recv_addr->rec_list)) { ut_a(recv_sys->n_addrs); recv_sys->n_addrs--; continue;