Description:
The size of the buf_block_t structure in the debug version is different from that in the release version. The release version is 384 bytes, but the debug version is not.
When calculating innodb_buffer_pool_size:
For the release version, the 384*24*1024*1024/(16*1024) result value is 64 KB aligned, and no external memory space is generated. The calculated innodb_buffer_pool_size is 24 MB.
However, the structure size of the debug version is not 384 bytes. As a result, the calculation result is not 64 KB-aligned. As a result, more than (16KB + sizeof(buf_block_t)) extra spaces are required, and the calculated innodb_buffer_pool_size is greater than 24 MB.
As a result, the mtr cases sys_vars.innodb_buffer_pool_size_basic and innodb.innodb_buffer_pool_resize_with_chunks fail to be executed in the debug version.
How to repeat:
MySQL 8.0.21 Debug Version
srv_buf_pool_chunk_unit = 24M
innodb_page_size = 16K
kernel pagesize = 64K
[mysql@localhost mysql-test]$ ./mtr --force --timestamp --timer --max-test-fail=0 --suite-timeout=6000 --testcase-timeout=300 --retry=0 --parallel=8 --big-test --debug-server sys_vars.innodb_buffer_pool_size_basic
Logging: ./mtr --force --timestamp --timer --max-test-fail=0 --suite-timeout=6000 --testcase-timeout=300 --retry=0 --parallel=8 --big-test --debug-server sys_vars.innodb_buffer_pool_size_basic
MySQL Version 8.0.21
Checking supported features
- Binaries are debug compiled
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/home/mysql/mysql-8.0.21-pagesizefix/build_debug_nofix/install/mysql-test/var'
Installing system database
Using parallel: 1
==============================================================================
TEST NAME RESULT TIME (ms) COMMENT
------------------------------------------------------------------------------
200806 11:23:42 [ 50%] sys_vars.innodb_buffer_pool_size_basic [ fail ]
Test ended at 2020-08-06 11:23:42
MTR's internal check of the test case 'sys_vars.innodb_buffer_pool_size_basic' failed.
This means that the test case does not preserve the state that existed
before the test case was executed. Most likely the test case did not
do a proper clean-up. It could also be caused by the previous test run
by this thread, if the server wasn't restarted.
This is the diff of the states of the servers before and after the
test case was executed:
mysqltest: Results saved in '/home/mysql/mysql-8.0.21-pagesizefix/build_debug_nofix/install/mysql-test/var/tmp/check-mysqld_1.result'.
mysqltest: Logging to '/home/mysql/mysql-8.0.21-pagesizefix/build_debug_nofix/install/mysql-test/var/tmp/check-mysqld_1.log'.
mysqltest: Connecting to server localhost:13000 (socket /home/mysql/mysql-8.0.21-pagesizefix/build_debug_nofix/install/mysql-test/var/tmp/mysqld.1.sock) as 'root', connection 'default', attempt 0 ...
mysqltest: ... Connected.
mysqltest: Start processing test commands from './include/check-testcase.test' ...
mysqltest: ... Done processing test commands.
--- /home/mysql/mysql-8.0.21-pagesizefix/build_debug_nofix/install/mysql-test/var/tmp/check-mysqld_1.result 2020-08-06 06:23:40.750000000 +0300
+++ /home/mysql/mysql-8.0.21-pagesizefix/build_debug_nofix/install/mysql-test/var/tmp/check-mysqld_1.reject 2020-08-06 06:23:41.670000000 +0300
@@ -466,7 +466,7 @@
innodb_buffer_pool_load_abort OFF
innodb_buffer_pool_load_at_startup ON
innodb_buffer_pool_load_now OFF
-innodb_buffer_pool_size 25165824
+innodb_buffer_pool_size 27262976
innodb_change_buffer_max_size 25
innodb_change_buffering all
innodb_change_buffering_debug 0
mysqltest: Result content mismatch
not ok
safe_process[106332]: Child process: 106333, exit: 1
- the logfile can be found in '/home/mysql/mysql-8.0.21-pagesizefix/build_debug_nofix/install/mysql-test/var/log/sys_vars.innodb_buffer_pool_size_basic/innodb_buffer_pool_size_basic.log'
Suggested fix:
in file storage\innobase\buf\buf0buf.cc:1026 (buf_chunk_init function),modify the code as follows:
/* Subtract the space needed for block descriptors. */
{
ulint size = chunk->size;
while (frame < (byte *)(chunk->blocks + size)) {
frame += UNIV_PAGE_SIZE;
size--;
}
#ifdef UNIV_DEBUG
while (size * UNIV_PAGE_SIZE > srv_buf_pool_chunk_unit) {
frame += UNIV_PAGE_SIZE;
size--;
}
#endif
chunk->size = size;
}