diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-19 12:57:22 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-03-19 13:01:20 +0200 |
commit | 9fd692aecacfc944fd3a6a58f4cae5a49eeb1cf0 (patch) | |
tree | a1c83f242567b0a52c0cf86380a37b80783c41a9 | |
parent | bfb5e1c3f0ba57b54f245d7cc2d1dfabaa7c4462 (diff) | |
download | mariadb-git-9fd692aecacfc944fd3a6a58f4cae5a49eeb1cf0.tar.gz |
MDEV-13626: Clean up the buffer pool resizing tests from MySQL 5.7
buf_pool_resize(): Simplify the fault injection
for innodb.buf_pool_resize_oom.
innodb.buf_pool_resize_oom: Use a small buffer pool.
innodb.innodb_buffer_pool_load_now: Make use of the sequence engine,
to avoid creating explicit InnoDB record locks. Clean up the
accesses to information_schema.innodb_buffer_page_lru.
-rw-r--r-- | mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result | 32 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/buf_pool_resize_oom.opt | 2 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/buf_pool_resize_oom.test | 2 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test | 51 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 22 |
5 files changed, 42 insertions, 67 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result index b2b1da92b4c..14ea44550e0 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_load_now.result @@ -2,22 +2,26 @@ SET GLOBAL innodb_buffer_pool_dump_pct=100; CREATE TABLE ib_bp_test (a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) ENGINE=INNODB; +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +3 +4 +SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; +INSERT INTO ib_bp_test +SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382; SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; +WHERE table_name = '`test`.`ib_bp_test`'; COUNT(*) -2 -SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; -COUNT(*) -{checked_valid} +596 SET GLOBAL innodb_buffer_pool_dump_now = ON; -SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; -COUNT(*) -0 -select count(*) from ib_bp_test where a = 1; +SET GLOBAL innodb_fast_shutdown=0; +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; +PAGE_NUMBER +select count(*) from ib_bp_test LIMIT 0; count(*) -1 SET GLOBAL innodb_buffer_pool_load_now = ON; SELECT variable_value FROM information_schema.global_status @@ -25,9 +29,9 @@ WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; variable_value Buffer pool(s) load completed at TIMESTAMP_NOW SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; +WHERE table_name = '`test`.`ib_bp_test`'; COUNT(*) -{checked_valid} +596 call mtr.add_suppression("InnoDB: Error parsing"); SET GLOBAL innodb_buffer_pool_load_now = ON; # Re-write some valid pages to the dump file, make sure the space diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt index 21350cdcfaf..09fd8bd8e35 100644 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt @@ -1 +1 @@ ---innodb-buffer-pool-size=1G +--innodb-buffer-pool-size=8m --innodb-buffer-pool-chunk-size=1m diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test index 4bddac78594..b0aa20b566f 100644 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test +++ b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test @@ -1,7 +1,5 @@ --source include/have_innodb.inc --source include/have_debug.inc -# Allocating 1 GiB of buffer pool is pretty steep! ---source include/big_test.inc --source include/not_embedded.inc --echo # diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test index 5bc07dbce0d..baced6e9e11 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -11,6 +11,7 @@ --source include/have_innodb.inc # include/restart_mysqld.inc does not work in embedded mode --source include/not_embedded.inc +--source include/have_sequence.inc --let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` @@ -26,32 +27,19 @@ CREATE TABLE ib_bp_test (a INT AUTO_INCREMENT, b VARCHAR(64), c TEXT, PRIMARY KEY (a), KEY (b, c(128))) ENGINE=INNODB; -let $check_cnt = +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; + +SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; + +let SPACE=`SELECT @space`; + +INSERT INTO ib_bp_test +SELECT NULL, REPEAT('b', 64), REPEAT('c', 256) FROM seq_1_to_16382; + SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru -WHERE table_name LIKE '%ib_bp_test%'; - ---let SPACE = `SELECT space FROM information_schema.innodb_sys_tables WHERE name LIKE '%ib_bp_test%'` - -# See that we have a small number of pages in the LRU ---eval $check_cnt - -# Here we end up with 16382 rows in the table ---disable_query_log -INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('b', 64), REPEAT('c', 256)); -INSERT INTO ib_bp_test (b, c) VALUES (REPEAT('B', 64), REPEAT('C', 256)); -let $i=12; -while ($i) -{ - --eval INSERT INTO ib_bp_test (b, c) VALUES ($i, $i * $i); - INSERT INTO ib_bp_test (b, c) SELECT b, c FROM ib_bp_test; - dec $i; -} ---enable_query_log - -# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size, -# 662 for 8k page size & 1392 for 4k page size ---replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid} ---eval $check_cnt +WHERE table_name = '`test`.`ib_bp_test`'; # Dump SET GLOBAL innodb_buffer_pool_dump_now = ON; @@ -81,6 +69,8 @@ EOF --move_file $file $file.now +# Complete purge (and change buffer merge). +SET GLOBAL innodb_fast_shutdown=0; --source include/shutdown_mysqld.inc # Make sure no dump after shutdown @@ -92,10 +82,11 @@ EOF --move_file $file.now $file # See that we have no pages in the LRU ---eval $check_cnt +SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; # Load the table so that entries in the I_S table do not appear as NULL -select count(*) from ib_bp_test where a = 1; +select count(*) from ib_bp_test LIMIT 0; # Load SET GLOBAL innodb_buffer_pool_load_now = ON; @@ -117,10 +108,8 @@ FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status'; --enable_warnings -# Accept 83 for 64k page size, 163 for 32k page size, 329 for 16k page size, -# 662 for 8k page size & 1392 for 4k page size ---replace_result 83 {checked_valid} 163 {checked_valid} 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid} ---eval $check_cnt +SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru +WHERE table_name = '`test`.`ib_bp_test`'; # Add some total garbage to the dump file --let IBDUMPFILE = $file diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index d80eadcfc70..57dc54f38b4 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -2648,23 +2648,6 @@ buf_pool_resize_hash( buf_pool->zip_hash = new_hash_table; } -#ifndef DBUG_OFF -/** This is a debug routine to inject an memory allocation failure error. */ -static -void -buf_pool_resize_chunk_make_null(buf_chunk_t** new_chunks) -{ - static int count = 0; - - if (count == 1) { - ut_free(*new_chunks); - *new_chunks = NULL; - } - - count++; -} -#endif // DBUG_OFF - /** Resize the buffer pool based on srv_buf_pool_size from srv_buf_pool_old_size. */ static @@ -2931,7 +2914,8 @@ withdraw_retry: ut_zalloc_nokey_nofatal(new_chunks_size)); DBUG_EXECUTE_IF("buf_pool_resize_chunk_null", - buf_pool_resize_chunk_make_null(&new_chunks);); + ut_free(new_chunks); + new_chunks = NULL;); if (new_chunks == NULL) { ib::error() << "buffer pool " << i |