Commit 9fd692ae authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent bfb5e1c3
......@@ -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
......
--innodb-buffer-pool-size=1G
--innodb-buffer-pool-size=8m --innodb-buffer-pool-chunk-size=1m
--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 #
......
......@@ -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
......
......@@ -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 @@ buf_pool_resize()
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment