From 36fcca635efc6c379f090de2484d63fb9ad7b331 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 23 Nov 2022 17:20:59 +0200 Subject: Fixed a memory leak in aria_read_log --- storage/maria/ma_control_file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c index 87e8c0eac18..a6daa8bef24 100644 --- a/storage/maria/ma_control_file.c +++ b/storage/maria/ma_control_file.c @@ -640,7 +640,7 @@ my_bool print_aria_log_control() open_flags, MYF(MY_WME))) < 0) { errmsg= "Can't open file"; - goto err; + goto err2; } file_size= mysql_file_seek(file, 0, SEEK_END, MYF(MY_WME)); @@ -723,10 +723,12 @@ my_bool print_aria_log_control() (buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET)[0]; printf("recovery_failures: %u\n", recovery_fails); } - + mysql_file_close(file, MYF(0)); DBUG_RETURN(0); err: + mysql_file_close(file, MYF(0)); +err2: my_printf_error(HA_ERR_INITIALIZATION, "Got error '%s' when trying to use aria control file " "'%s'", 0, errmsg, name); -- cgit v1.2.1 From 604e844944c039a913aa41cc3a1db80c3db2c6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 24 Nov 2022 15:04:25 +0200 Subject: MDEV-21452 fixup: Remove PFS_NOT_INSTRUMENTED --- storage/innobase/include/univ.i | 9 --------- 1 file changed, 9 deletions(-) diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 1dffd25b27f..c5f62f6cf57 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -101,15 +101,6 @@ HAVE_PSI_INTERFACE is defined. */ # define UNIV_PFS_MEMORY # endif /* HAVE_PSI_MEMORY_INTERFACE */ -/* There are mutexes/rwlocks that we want to exclude from -instrumentation even if their corresponding performance schema -define is set. And this PFS_NOT_INSTRUMENTED is used -as the key value to identify those objects that would -be excluded from instrumentation. */ -# define PFS_NOT_INSTRUMENTED ULINT32_UNDEFINED - -# define PFS_IS_INSTRUMENTED(key) ((key) != PFS_NOT_INSTRUMENTED) - #ifdef HAVE_PFS_THREAD_PROVIDER_H /* For PSI_MUTEX_CALL() and similar. */ #include "pfs_thread_provider.h" -- cgit v1.2.1 From 05cd10b74cffe882d04c6dd3333ef0beec2b41c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 24 Nov 2022 16:46:34 +0200 Subject: MDEV-29603 fixup: GCC -Wunused-but-set-variable --- storage/innobase/mtr/mtr0mtr.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 66f8db34e73..6f4a4ab9353 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -894,14 +894,14 @@ bool mtr_t::have_x_latch(const buf_block_t &block) const if (!m_memo) return false; - const mtr_memo_slot_t *found= nullptr; + ut_d(const mtr_memo_slot_t *found= nullptr); for (const mtr_memo_slot_t &slot : *m_memo) { if (slot.object != &block) continue; - found= &slot; + ut_d(found= &slot); if (!(slot.type & MTR_MEMO_PAGE_X_FIX)) continue; -- cgit v1.2.1 From d43153e3531a2579e4375392d177391c961874a5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 24 Nov 2022 22:09:14 +0100 Subject: fix password_reuse_check plugin to link in embedded it uses C client API, so needs RECOMPILE_FOR_EMBEDDED --- plugin/password_reuse_check/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/password_reuse_check/CMakeLists.txt b/plugin/password_reuse_check/CMakeLists.txt index b9175eb9f74..6c816071747 100644 --- a/plugin/password_reuse_check/CMakeLists.txt +++ b/plugin/password_reuse_check/CMakeLists.txt @@ -1,2 +1,3 @@ -MYSQL_ADD_PLUGIN(password_reuse_check password_reuse_check.c) +MYSQL_ADD_PLUGIN(password_reuse_check password_reuse_check.c + RECOMPILE_FOR_EMBEDDED) -- cgit v1.2.1 From 7141c260948ab48702482b350797638877130fbf Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 25 Nov 2022 16:27:24 +1100 Subject: MDEV-29760: DROP DATABASE hangs when particular query cache is present Fix the regression introduced in dfb41fddf69ccbca89fd322901f2809bc3bcc0e9. In the restructure of mysql_rm_table_no_locks the early condition of !frm_error that enabled non_tmp_table_deleted, and hence the query cache invalidation, was removed. The query_cache_invalidate1(thd, dbnorm) called after mysql_rm_table_no_locks depends on the query cache removal (for unexamined reasons). Under DROP DATABASE, in mysql_rm_table_no_locks, dont_log_query is true preventing the late setting of non_tmp_table_deleted (which retained one of its purposes as a replication deletion of temporary tables, but not query cache invalidation). The non_temp_tables_count however can still be used to invalidate the query cache. --- mysql-test/main/query_cache_notembedded.result | 21 ++++++++++++++++++++ mysql-test/main/query_cache_notembedded.test | 27 ++++++++++++++++++++++++++ sql/sql_table.cc | 6 ++++-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/query_cache_notembedded.result b/mysql-test/main/query_cache_notembedded.result index 29a091b68c1..3477161e9cf 100644 --- a/mysql-test/main/query_cache_notembedded.result +++ b/mysql-test/main/query_cache_notembedded.result @@ -462,6 +462,27 @@ flush query cache| delete from t1| drop procedure bug3583| drop table t1| +# +# MDEV-29760 DROP DATABASE hangs when particular query cache is present +# +create table t1 (id int); +create table t2 like t1; +create table t3 like t1; +create database d; +create table d.t1 like test.t1; +create table d.t2 like test.t2; +set LOCAL query_cache_type=ON; +select id from t3; +id +select 'x' a, 'y' b from d.t1; +a b +select 'x' a, 'y' b from d.t1, d.t2; +a b +drop database d; +drop table t1, t2, t3; +# +# End of 10.5 tests +# SET GLOBAL query_cache_size=@query_cache_size_save; SET GLOBAL query_cache_type=@query_cache_type_save; set GLOBAL sql_mode=@sql_mode_save; diff --git a/mysql-test/main/query_cache_notembedded.test b/mysql-test/main/query_cache_notembedded.test index 03c9d9e4cd4..83c7b1628e8 100644 --- a/mysql-test/main/query_cache_notembedded.test +++ b/mysql-test/main/query_cache_notembedded.test @@ -325,6 +325,33 @@ drop procedure bug3583| drop table t1| delimiter ;| +--echo # +--echo # MDEV-29760 DROP DATABASE hangs when particular query cache is present +--echo # + +create table t1 (id int); +create table t2 like t1; +create table t3 like t1; + +create database d; + +create table d.t1 like test.t1; +create table d.t2 like test.t2; + +set LOCAL query_cache_type=ON; + +select id from t3; +select 'x' a, 'y' b from d.t1; +select 'x' a, 'y' b from d.t1, d.t2; + +drop database d; + +drop table t1, t2, t3; + +--echo # +--echo # End of 10.5 tests +--echo # + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc SET GLOBAL query_cache_size=@query_cache_size_save; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1ca09332872..499d7552b43 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2691,13 +2691,16 @@ err: } error= thd->is_error(); + if (non_temp_tables_count) + query_cache_invalidate3(thd, tables, 0); + /* We are always logging drop of temporary tables. The reason is to handle the following case: - Use statement based replication - CREATE TEMPORARY TABLE foo (logged) - set row based replication - - DROP TEMPORAY TABLE foo (needs to be logged) + - DROP TEMPORARY TABLE foo (needs to be logged) This should be fixed so that we remember if creation of the temporary table was logged and only log it if the creation was logged. @@ -2709,7 +2712,6 @@ err: if (non_trans_tmp_table_deleted || trans_tmp_table_deleted) thd->transaction->stmt.mark_dropped_temp_table(); - query_cache_invalidate3(thd, tables, 0); if (!dont_log_query && mysql_bin_log.is_open()) { if (non_trans_tmp_table_deleted) -- cgit v1.2.1 From 7919b14387179260c5ae0af4bff3f5ee4ae82cb6 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 25 Nov 2022 17:28:09 +1100 Subject: Query cache: removed unused THD from few functions A few query cache functions don't use THD pointer so its removed from their interface. --- sql/sql_cache.cc | 16 +++++++--------- sql/sql_cache.h | 5 ++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 60ac8274d84..8655a75a455 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2131,8 +2131,7 @@ lookup: ("Handler require invalidation queries of %.*s %llu-%llu", (int)qcache_se_key_len, qcache_se_key_name, engine_data, table->engine_data())); - invalidate_table_internal(thd, - (uchar *) table->db(), + invalidate_table_internal((uchar *) table->db(), table->key_length()); } else @@ -2381,7 +2380,7 @@ void Query_cache::invalidate(THD *thd, const char *db) if (strcmp(table->db(),db) == 0) { Query_cache_block_table *list_root= table_block->table(0); - invalidate_query_block_list(thd,list_root); + invalidate_query_block_list(list_root); } table_block= next; @@ -3320,7 +3319,7 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, size_t key_length) DEBUG_SYNC(thd, "wait_in_query_cache_invalidate2"); if (query_cache_size > 0) - invalidate_table_internal(thd, key, key_length); + invalidate_table_internal(key, key_length); unlock(); } @@ -3335,14 +3334,14 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, size_t key_length) */ void -Query_cache::invalidate_table_internal(THD *thd, uchar *key, size_t key_length) +Query_cache::invalidate_table_internal(uchar *key, size_t key_length) { Query_cache_block *table_block= (Query_cache_block*)my_hash_search(&tables, key, key_length); if (table_block) { Query_cache_block_table *list_root= table_block->table(0); - invalidate_query_block_list(thd, list_root); + invalidate_query_block_list(list_root); } } @@ -3359,8 +3358,7 @@ Query_cache::invalidate_table_internal(THD *thd, uchar *key, size_t key_length) */ void -Query_cache::invalidate_query_block_list(THD *thd, - Query_cache_block_table *list_root) +Query_cache::invalidate_query_block_list(Query_cache_block_table *list_root) { while (list_root->next != list_root) { @@ -3543,7 +3541,7 @@ Query_cache::insert_table(THD *thd, size_t key_len, const char *key, */ { Query_cache_block_table *list_root= table_block->table(0); - invalidate_query_block_list(thd, list_root); + invalidate_query_block_list(list_root); } table_block= 0; diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 372d697015e..3c561b3bd15 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -319,7 +319,7 @@ private: Cache_staus m_cache_status; void free_query_internal(Query_cache_block *point); - void invalidate_table_internal(THD *thd, uchar *key, size_t key_length); + void invalidate_table_internal(uchar *key, size_t key_length); protected: /* @@ -375,8 +375,7 @@ protected: void invalidate_table(THD *thd, TABLE *table); void invalidate_table(THD *thd, uchar *key, size_t key_length); void invalidate_table(THD *thd, Query_cache_block *table_block); - void invalidate_query_block_list(THD *thd, - Query_cache_block_table *list_root); + void invalidate_query_block_list(Query_cache_block_table *list_root); TABLE_COUNTER_TYPE register_tables_from_list(THD *thd, TABLE_LIST *tables_used, -- cgit v1.2.1 From 812443c251e163b83252638a3229cc6d48e61a5f Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Tue, 27 Sep 2022 10:31:24 -0600 Subject: MDEV-29607: binlog.binlog_checkpoint fails in buildbot with result content mismatch Problem: ======== There is a race condition in binlog.binlog_checkpoint between the binlog background thread creating a binlog checkpoint event, and the connection thread binlogging a query event for creating a table. Because the test outputs the events for validation, the order between these two events can be different, resulting in a failed test. Solution: ======== Instead of outputting the binlog events, use assert_grep to validate the content of the binlog is correct. Reviewed By: ============ Andrei Elkin --- mysql-test/suite/binlog/r/binlog_checkpoint.result | 25 +++------------------- mysql-test/suite/binlog/t/binlog_checkpoint.test | 18 +++++++++++++++- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/mysql-test/suite/binlog/r/binlog_checkpoint.result b/mysql-test/suite/binlog/r/binlog_checkpoint.result index 7578a9fc6d9..a00b1c0c1a3 100644 --- a/mysql-test/suite/binlog/r/binlog_checkpoint.result +++ b/mysql-test/suite/binlog/r/binlog_checkpoint.result @@ -164,28 +164,9 @@ connection default; SET GLOBAL debug_dbug="+d,only_kill_system_threads_no_loop"; # restart ** Proof of shutdown caused ROLLBACK-completed transaction -include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION -master-bin.000002 # Gtid_list # # [] -master-bin.000002 # Binlog_checkpoint # # master-bin.000001 -master-bin.000002 # Binlog_checkpoint # # master-bin.000002 -master-bin.000002 # Gtid # # GTID #-#-# -master-bin.000002 # Query # # use `test`; CREATE TABLE tm (a INT) ENGINE = myisam -master-bin.000002 # Gtid # # BEGIN GTID #-#-# -master-bin.000002 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Table \'./test/tm\' is marked as crashed' COLLATE 'latin1_swedish_ci')) -master-bin.000002 # Query # # COMMIT -master-bin.000002 # Gtid # # BEGIN GTID #-#-# -master-bin.000002 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Checking table' COLLATE 'latin1_swedish_ci')) -master-bin.000002 # Query # # COMMIT -master-bin.000002 # Gtid # # BEGIN GTID #-#-# -master-bin.000002 # Query # # use `test`; INSERT INTO tm SET a = 1 -master-bin.000002 # Query # # COMMIT -master-bin.000002 # Gtid # # BEGIN GTID #-#-# -master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (2, 1) -master-bin.000002 # Query # # use `test`; INSERT INTO t1 VALUES (3, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") -master-bin.000002 # Query # # ROLLBACK -master-bin.000002 # Rotate # # master-bin.000003;pos=POS +# MYSQL_BINLOG datadir/binlog_file --result-file=assert_file +include/assert_grep.inc [No XA statements should be written into the binary log] +include/assert_grep.inc [The transaction should be rolled back] SELECT * FROM tm; a 1 diff --git a/mysql-test/suite/binlog/t/binlog_checkpoint.test b/mysql-test/suite/binlog/t/binlog_checkpoint.test index 19b48ef68b0..4237f33c8af 100644 --- a/mysql-test/suite/binlog/t/binlog_checkpoint.test +++ b/mysql-test/suite/binlog/t/binlog_checkpoint.test @@ -212,7 +212,23 @@ XA END 'xa1'; --source include/start_mysqld.inc --echo ** Proof of shutdown caused ROLLBACK-completed transaction ---source include/show_binlog_events.inc + +--let assert_file=$MYSQLTEST_VARDIR/tmp/binlog_decoded.out +--let datadir=`select @@datadir` + +--echo # MYSQL_BINLOG datadir/binlog_file --result-file=assert_file +--exec $MYSQL_BINLOG $datadir/$binlog_file --result-file=$assert_file + +--let $assert_text= No XA statements should be written into the binary log +--let $assert_count= 0 +--let assert_select= XA START|XA END|XA PREPARE|XA COMMIT|XA ROLLBACK +--source include/assert_grep.inc + +--let $assert_text= The transaction should be rolled back +--let $assert_count= 1 +--let assert_select= ^ROLLBACK\$ +--source include/assert_grep.inc + SELECT * FROM tm; --eval SELECT * FROM t1 WHERE a = $a -- cgit v1.2.1 From 091ac533497cb569df18c11323d31cf468712f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 28 Nov 2022 09:40:52 +0200 Subject: MDEV-29841 fixup: Correct error message translations This fixes up 0e6f2757d11502d74d21e4a75fa5247fc3334024 and 6f8fb41f213dd34b43ef6f3819b4be12f6b26c01 which corrupted the Chinese and Spanish translations of the changed error message ER_PARTITION_WRONG_TYPE. --- sql/share/errmsg-utf8.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index b61bfbfc199..45a09ea62f1 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -9773,9 +9773,9 @@ ER_UNUSED_23 spa "Nunca debería vd de ver esto" ER_PARTITION_WRONG_TYPE - chi "错误的分区类型,预期类型:%`s for partitioning by %`s" + chi "错误分区类型%`s,应当是%`s" eng "Wrong partition type %`s for partitioning by %`s" - spa "Tipo de partición equivocada, tipo esperado: %`s for partitioning by %`s" + spa "Tipo de partición equivocada %`s para particionado mediante %`s" WARN_VERS_PART_FULL chi "版本化表%`s.%`s:partition%`s已满,添加更多历史分区(out of %s)" -- cgit v1.2.1 From 183ca823bbddec81bbb2ec64bd314a50851e39c5 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 22 Nov 2022 08:37:27 +1100 Subject: MDEV-25417: Remove innodb buffer pool load throttling The very lightest of load would decimate any buffer pool loading to ~1 page per second. As seen in MDEV-29343 this resulting in a load taking over an hour on a high end system. Since MDEV-26547 the fetching is asynchronous, however the loading has equal access to the IO as the SQL queries. --- storage/innobase/buf/buf0dump.cc | 72 ---------------------------------------- 1 file changed, 72 deletions(-) diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index aaf07dd17eb..269ef448c31 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -410,72 +410,6 @@ done: export_vars.innodb_buffer_pool_load_incomplete = 0; } -/*****************************************************************//** -Artificially delay the buffer pool loading if necessary. The idea of -this function is to prevent hogging the server with IO and slowing down -too much normal client queries. */ -UNIV_INLINE -void -buf_load_throttle_if_needed( -/*========================*/ - ulint* last_check_time, /*!< in/out: milliseconds since epoch - of the last time we did check if - throttling is needed, we do the check - every srv_io_capacity IO ops. */ - ulint* last_activity_count, - ulint n_io) /*!< in: number of IO ops done since - buffer pool load has started */ -{ - if (n_io % srv_io_capacity < srv_io_capacity - 1) { - return; - } - - if (*last_check_time == 0 || *last_activity_count == 0) { - *last_check_time = ut_time_ms(); - *last_activity_count = srv_get_activity_count(); - return; - } - - /* srv_io_capacity IO operations have been performed by buffer pool - load since the last time we were here. */ - - /* If no other activity, then keep going without any delay. */ - if (srv_get_activity_count() == *last_activity_count) { - return; - } - - /* There has been other activity, throttle. */ - - ulint now = ut_time_ms(); - ulint elapsed_time = now - *last_check_time; - - /* Notice that elapsed_time is not the time for the last - srv_io_capacity IO operations performed by BP load. It is the - time elapsed since the last time we detected that there has been - other activity. This has a small and acceptable deficiency, e.g.: - 1. BP load runs and there is no other activity. - 2. Other activity occurs, we run N IO operations after that and - enter here (where 0 <= N < srv_io_capacity). - 3. last_check_time is very old and we do not sleep at this time, but - only update last_check_time and last_activity_count. - 4. We run srv_io_capacity more IO operations and call this function - again. - 5. There has been more other activity and thus we enter here. - 6. Now last_check_time is recent and we sleep if necessary to prevent - more than srv_io_capacity IO operations per second. - The deficiency is that we could have slept at 3., but for this we - would have to update last_check_time before the - "cur_activity_count == *last_activity_count" check and calling - ut_time_ms() that often may turn out to be too expensive. */ - - if (elapsed_time < 1000 /* 1 sec (1000 milli secs) */) { - os_thread_sleep((1000 - elapsed_time) * 1000 /* micro secs */); - } - - *last_check_time = ut_time_ms(); - *last_activity_count = srv_get_activity_count(); -} - /*****************************************************************//** Perform a buffer pool load from the file specified by innodb_buffer_pool_filename. If any errors occur then the value of @@ -622,9 +556,6 @@ buf_load() std::sort(dump, dump + dump_n); } - ulint last_check_time = 0; - ulint last_activity_cnt = 0; - /* Avoid calling the expensive fil_space_t::get() for each page within the same tablespace. dump[] is sorted by (space, page), so all pages from a given tablespace are consecutive. */ @@ -699,9 +630,6 @@ buf_load() return; } - buf_load_throttle_if_needed( - &last_check_time, &last_activity_cnt, i); - #ifdef UNIV_DEBUG if ((i+1) >= srv_buf_pool_load_pages_abort) { buf_load_abort_flag = true; -- cgit v1.2.1 From e0d672f30b8a7d5486c367b5ed8ec58e41c1b6b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 28 Nov 2022 11:34:00 +0200 Subject: MDEV-30089 Metrics not incremented for 1st iteration in buf_LRU_free_from_common_LRU_list() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In commit a03dd94be804a4b8b1406696920834bb2c0bedbd as well as mysql/mysql-server@6ef8c343445a26aaf9ebd76d72cf57db44b481f5 the iterations were changed so that the variable "scanned" would remain 0 when the first list item qualifies for eviction. buf_LRU_free_from_unzip_LRU_list(), buf_LRU_free_from_common_LRU_list(): Increment "scanned" when a block can be freed. buf_LRU_free_from_common_LRU_list(): Remove a redundant condition. Whenever this function is invoked, buf_pool.LRU should be nonempty, hence something should always be scanned. Thanks to Jean-François Gagné for reporting this. --- storage/innobase/buf/buf0lru.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index b282eb17dae..b8f3b23a477 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 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 Free Software @@ -189,8 +189,6 @@ LRU list. The compressed page is preserved, and it need not be clean. @return true if freed */ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit) { - mysql_mutex_assert_owner(&buf_pool.mutex); - if (!buf_LRU_evict_from_unzip_LRU()) { return(false); } @@ -208,6 +206,7 @@ static bool buf_LRU_free_from_unzip_LRU_list(ulint limit) freed = buf_LRU_free_page(&block->page, false); if (freed) { + scanned++; break; } @@ -252,17 +251,16 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit) } freed = true; + scanned++; break; } } - if (scanned) { - MONITOR_INC_VALUE_CUMULATIVE( - MONITOR_LRU_SEARCH_SCANNED, - MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, - MONITOR_LRU_SEARCH_SCANNED_PER_CALL, - scanned); - } + MONITOR_INC_VALUE_CUMULATIVE( + MONITOR_LRU_SEARCH_SCANNED, + MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, + MONITOR_LRU_SEARCH_SCANNED_PER_CALL, + scanned); return(freed); } -- cgit v1.2.1 From db14eb16f9977453467ec4765f481bb2f71814ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 28 Nov 2022 11:34:22 +0200 Subject: MDEV-30106 InnoDB fails to validate the change buffer on startup ibuf_init_at_db_start(): Validate the change buffer root page. A later version may stop creating a change buffer, and this validation check will prevent a downgrade from such later versions. ibuf_max_size_update(): If the change buffer was not loaded, do nothing. dict_boot(): Merge the local variable "error" to "err". Ignore failures of ibuf_init_at_db_start() if innodb_force_recovery>=4. --- mysql-test/suite/innodb/t/log_corruption.test | 1 + storage/innobase/dict/dict0boot.cc | 26 +++++++------ storage/innobase/ibuf/ibuf0ibuf.cc | 55 +++++++++++++++++---------- storage/innobase/srv/srv0start.cc | 3 +- 4 files changed, 52 insertions(+), 33 deletions(-) diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test index 7c7f32b8d85..a3ab4510743 100644 --- a/mysql-test/suite/innodb/t/log_corruption.test +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -19,6 +19,7 @@ call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 fa call mtr.add_suppression("InnoDB: Decrypting checkpoint failed"); call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfile0 to start up the database\\? Log sequence number in the ib_logfile0 is 1213964,"); call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files 2097152 bytes!"); +call mtr.add_suppression("InnoDB: The change buffer is corrupted"); --enable_query_log let bugdir= $MYSQLTEST_VARDIR/tmp/log_corruption; diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc index bd2cf4ffdd8..1414f21221f 100644 --- a/storage/innobase/dict/dict0boot.cc +++ b/storage/innobase/dict/dict0boot.cc @@ -313,9 +313,9 @@ dict_boot(void) dict_mem_index_add_field(index, "NAME", 0); index->id = DICT_TABLES_ID; - dberr_t error = dict_index_add_to_cache( + dberr_t err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_TABLES)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); @@ -325,9 +325,9 @@ dict_boot(void) dict_mem_index_add_field(index, "ID", 0); index->id = DICT_TABLE_IDS_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_TABLE_IDS)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); /*-------------------------*/ table = dict_mem_table_create("SYS_COLUMNS", fil_system.sys_space, @@ -355,9 +355,9 @@ dict_boot(void) dict_mem_index_add_field(index, "POS", 0); index->id = DICT_COLUMNS_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_COLUMNS)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); @@ -398,9 +398,9 @@ dict_boot(void) dict_mem_index_add_field(index, "ID", 0); index->id = DICT_INDEXES_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_INDEXES)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); @@ -427,9 +427,9 @@ dict_boot(void) dict_mem_index_add_field(index, "POS", 0); index->id = DICT_FIELDS_ID; - error = dict_index_add_to_cache( + err = dict_index_add_to_cache( index, mach_read_from_4(dict_hdr + DICT_HDR_FIELDS)); - ut_a(error == DB_SUCCESS); + ut_a(err == DB_SUCCESS); ut_ad(!table->is_instant()); table->indexes.start->n_core_null_bytes = static_cast( UT_BITS_IN_BYTES(unsigned(table->indexes.start->n_nullable))); @@ -440,9 +440,11 @@ dict_boot(void) /* Initialize the insert buffer table and index for each tablespace */ - dberr_t err = ibuf_init_at_db_start(); + err = ibuf_init_at_db_start(); - if (err == DB_SUCCESS) { + if (err == DB_SUCCESS + || srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + err = DB_SUCCESS; /* Load definitions of other indexes on system tables */ dict_load_sys_table(dict_sys.sys_tables); diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index ee462bc68c2..d88c2b0027e 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -50,6 +50,7 @@ Created 7/19/1997 Heikki Tuuri #include "que0que.h" #include "srv0start.h" /* srv_shutdown_state */ #include "rem0cmp.h" +#include "log.h" /* STRUCTURE OF AN INSERT BUFFER RECORD @@ -408,35 +409,24 @@ ibuf_init_at_db_start(void) ulint n_used; ut_ad(!ibuf.index); + dberr_t err; mtr_t mtr; mtr.start(); compile_time_assert(IBUF_SPACE_ID == TRX_SYS_SPACE); compile_time_assert(IBUF_SPACE_ID == 0); mtr_x_lock_space(fil_system.sys_space, &mtr); - buf_block_t* header_page = buf_page_get( + buf_block_t* header_page = buf_page_get_gen( page_id_t(IBUF_SPACE_ID, FSP_IBUF_HEADER_PAGE_NO), - 0, RW_X_LATCH, &mtr); + 0, RW_X_LATCH, nullptr, BUF_GET, + __FILE__, __LINE__, &mtr, &err); if (!header_page) { +err_exit: + sql_print_error("InnoDB: The change buffer is corrupted"); mtr.commit(); - return DB_DECRYPTION_FAILED; + return err; } - /* At startup we intialize ibuf to have a maximum of - CHANGE_BUFFER_DEFAULT_SIZE in terms of percentage of the - buffer pool size. Once ibuf struct is initialized this - value is updated with the user supplied size by calling - ibuf_max_size_update(). */ - ibuf.max_size = ((buf_pool_get_curr_size() >> srv_page_size_shift) - * CHANGE_BUFFER_DEFAULT_SIZE) / 100; - - mutex_create(LATCH_ID_IBUF, &ibuf_mutex); - - mutex_create(LATCH_ID_IBUF_PESSIMISTIC_INSERT, - &ibuf_pessimistic_insert_mutex); - - mutex_enter(&ibuf_mutex); - fseg_n_reserved_pages(*header_page, IBUF_HEADER + IBUF_TREE_SEG_HEADER + header_page->frame, &n_used, &mtr); @@ -448,15 +438,39 @@ ibuf_init_at_db_start(void) { buf_block_t* block; - block = buf_page_get( + block = buf_page_get_gen( page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO), - 0, RW_X_LATCH, &mtr); + 0, RW_X_LATCH, nullptr, BUF_GET, + __FILE__, __LINE__, &mtr, &err); + + if (!block) goto err_exit; buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE); root = buf_block_get_frame(block); } + if (page_is_comp(root) || fil_page_get_type(root) != FIL_PAGE_INDEX + || btr_page_get_index_id(root) != DICT_IBUF_ID_MIN) { + err = DB_CORRUPTION; + goto err_exit; + } + + /* At startup we initialize ibuf to have a maximum of + CHANGE_BUFFER_DEFAULT_SIZE in terms of percentage of the + buffer pool size. Once ibuf struct is initialized this + value is updated with the user supplied size by calling + ibuf_max_size_update(). */ + ibuf.max_size = ((buf_pool_get_curr_size() >> srv_page_size_shift) + * CHANGE_BUFFER_DEFAULT_SIZE) / 100; + + mutex_create(LATCH_ID_IBUF, &ibuf_mutex); + + mutex_create(LATCH_ID_IBUF_PESSIMISTIC_INSERT, + &ibuf_pessimistic_insert_mutex); + + mutex_enter(&ibuf_mutex); + ibuf_size_update(root); mutex_exit(&ibuf_mutex); @@ -507,6 +521,7 @@ ibuf_max_size_update( ulint new_val) /*!< in: new value in terms of percentage of the buffer pool size */ { + if (UNIV_UNLIKELY(!ibuf.index)) return; ulint new_size = ((buf_pool_get_curr_size() >> srv_page_size_shift) * new_val) / 100; mutex_enter(&ibuf_mutex); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index c0b2f5e02f0..ae4f831bf2d 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2056,7 +2056,8 @@ void innodb_shutdown() || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); ut_ad(lock_sys.is_initialised() || !srv_was_started); ut_ad(log_sys.is_initialised() || !srv_was_started); - ut_ad(ibuf.index || !srv_was_started); + ut_ad(ibuf.index || !srv_was_started + || srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE); dict_stats_deinit(); -- cgit v1.2.1 From bd694bb7b28f64eb36704dd795ae351117ebeea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 28 Nov 2022 11:56:09 +0200 Subject: MDEV-24412 InnoDB: Upgrade after a crash is not supported recv_log_recover_10_4(): Widen the operand of bitwise and to 64 bits, so that the upgrade check will work when the redo log record is located more than 4 gigabytes from the start of the first file. --- .../r/innodb_encrypt_log_corruption.result | 10 +++++- mysql-test/suite/innodb/r/log_corruption.result | 10 +++++- mysql-test/suite/innodb/t/log_corruption.test | 36 ++++++++++++++++++++++ storage/innobase/log/log0recv.cc | 2 +- 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result b/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result index 8d1eb447b03..7563100babb 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result +++ b/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result @@ -69,6 +69,14 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); COUNT(*) 1 FOUND 3 /InnoDB: Upgrading redo log:/ in mysqld.1.err +# Empty large multi-file redo log from after MariaDB 10.2.2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 4 /InnoDB: Upgrading redo log:/ in mysqld.1.err # redo log from "after" MariaDB 10.2.2, but with invalid header checksum # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption SELECT * FROM INFORMATION_SCHEMA.ENGINES @@ -179,7 +187,7 @@ WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); COUNT(*) 1 -FOUND 5 /InnoDB: Upgrading redo log:/ in mysqld.1.err +FOUND 6 /InnoDB: Upgrading redo log:/ in mysqld.1.err # Minimal MariaDB 10.1.21 encrypted redo log # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result index bf92f77d30c..890e3296164 100644 --- a/mysql-test/suite/innodb/r/log_corruption.result +++ b/mysql-test/suite/innodb/r/log_corruption.result @@ -69,6 +69,14 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); COUNT(*) 1 FOUND 3 /InnoDB: Upgrading redo log:/ in mysqld.1.err +# Empty large multi-file redo log from after MariaDB 10.2.2 +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +FOUND 4 /InnoDB: Upgrading redo log:/ in mysqld.1.err # redo log from "after" MariaDB 10.2.2, but with invalid header checksum # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption SELECT * FROM INFORMATION_SCHEMA.ENGINES @@ -179,7 +187,7 @@ WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); COUNT(*) 1 -FOUND 5 /InnoDB: Upgrading redo log:/ in mysqld.1.err +FOUND 6 /InnoDB: Upgrading redo log:/ in mysqld.1.err # Minimal MariaDB 10.1.21 encrypted redo log # restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 SELECT * FROM INFORMATION_SCHEMA.ENGINES diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test index a3ab4510743..27fae80a135 100644 --- a/mysql-test/suite/innodb/t/log_corruption.test +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -291,6 +291,42 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED'); --source include/search_pattern_in_file.inc --let $restart_parameters= $dirs +--echo # Empty large multi-file redo log from after MariaDB 10.2.2 +perl; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; +my $polynomial = 0x82f63b78; # CRC-32C + +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +$_= pack("Nx[5]nx[5]", 1, 0x1286) . "BogoDB 4.3.2.1" . chr(0) x 478; +print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); +# checkpoint page 1 and all-zero checkpoint 2 +$_= pack("x[13]nCNNx[484]", 0x1286, 12, 2, 0x80c); +print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); +print OUT chr(0) x 1024; +die unless seek(OUT, 0x1FFFFFFFF, 0); +print OUT chr(0); +close OUT or die; +die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; +binmode OUT; +die unless seek(OUT, 0x800, 0); # the first 2048 bytes are unused! +$_= pack("Nnnx[500]", 0x80000944, 12, 12); +print OUT $_, pack("N", mycrc32($_, 0, $polynomial)); +die unless seek(OUT, 0x1FFFFFFFF, 0); +print OUT chr(0); +close OUT or die; +EOF + +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=2m +--source include/start_mysqld.inc +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +--source include/shutdown_mysqld.inc +--let SEARCH_PATTERN= InnoDB: Upgrading redo log: +--source include/search_pattern_in_file.inc +--let $restart_parameters= $dirs + --remove_file $bugdir/ib_logfile0 --move_file $bugdir/ib_logfile $bugdir/ib_logfile0 diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 8db270b2a9b..511ccc5afe6 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1412,7 +1412,7 @@ static dberr_t recv_log_recover_10_4() return DB_CORRUPTION; } - recv_sys.read(source_offset & ~(OS_FILE_LOG_BLOCK_SIZE - 1), + recv_sys.read(source_offset & ~lsn_t(OS_FILE_LOG_BLOCK_SIZE - 1), {buf, OS_FILE_LOG_BLOCK_SIZE}); ulint crc = log_block_calc_checksum_crc32(buf); -- cgit v1.2.1