Skip to content

Commit

Permalink
MDEV-20139 innodb.innodb_buffer_pool_dump_pct failed in buildbot with…
Browse files Browse the repository at this point in the history
… timeout

This test was using a sleep of 1 second in an attempt to ensure that the
timestamp that is part of an InnoDB status string would increase.
This not only prolongs the test execution time by 1+1 seconds, but it
also is inaccurate. It is possible that the actual sleep duration is
less than a second.

Let us wait for the creation of the file ib_buffer_pool and then wait
for the buffer pool dump completion. In that way, the test can complete
in a dozen or two milliseconds (1% of the previous duration) and work
more reliably.
  • Loading branch information
dr-m committed Dec 12, 2023
1 parent 61daac5 commit 9f5078a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 35 deletions.
9 changes: 0 additions & 9 deletions mysql-test/suite/innodb/r/innodb_buffer_pool_dump_pct.result
Expand Up @@ -3,17 +3,8 @@ col2 VARCHAR(25), col3 varchar(25)) ENGINE=InnoDB;
CREATE INDEX idx1 ON tab5(col2(10));
CREATE INDEX idx2 ON tab5(col3(10));
SET GLOBAL innodb_buffer_pool_dump_pct=100;
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;
SET GLOBAL innodb_buffer_pool_dump_pct=1;
SELECT @@global.innodb_buffer_pool_dump_pct;
@@global.innodb_buffer_pool_dump_pct
1
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;
SET GLOBAL innodb_buffer_pool_dump_pct=DEFAULT;
DROP TABLE tab5;
47 changes: 21 additions & 26 deletions mysql-test/suite/innodb/t/innodb_buffer_pool_dump_pct.test
Expand Up @@ -35,49 +35,44 @@ SET GLOBAL innodb_buffer_pool_dump_pct=100;
# - The granularity of the timestamp is one second.
# - There could have been some dump caused by some previous test
# just a few milliseconds before.
# In order to avoid conflict with previous tests, read the current value
# of INNODB_BUFFER_POOL_DUMP_STATUS
# and confirm that the timestamp is different after the dump
#***********************************************************

# Read the current value to compare with the new value.
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
SET GLOBAL innodb_buffer_pool_dump_now=ON;

# Sleep one second in order to ensure that the time stamp is
# different at next dump
--sleep 1
--error 0,1
--remove_file $MYSQLD_DATADIR/ib_buffer_pool

SET GLOBAL innodb_buffer_pool_dump_now=ON;
perl;
my $f="$ENV{MYSQLD_DATADIR}/ib_buffer_pool";
my $count=300;
until (-e $f)
{
select(undef, undef, undef, .1);
die "File $f was not created\n" if (0 > --$count);
}
EOF
let $wait_condition = SELECT count(*) = 1
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'
AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc

--move_file $MYSQLD_DATADIR/ib_buffer_pool $MYSQLD_DATADIR/ib_buffer_pool100
SET GLOBAL innodb_buffer_pool_dump_pct=1;
SELECT @@global.innodb_buffer_pool_dump_pct;

# Read the current value to compare with the new value.
--disable_warnings
SELECT variable_value INTO @IBPDS
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
--enable_warnings

SET GLOBAL innodb_buffer_pool_dump_now=ON;

# Sleep one second in order to ensure that the time stamp is
# different at next dump
--sleep 1
perl;
my $f="$ENV{MYSQLD_DATADIR}/ib_buffer_pool";
my $count=300;
until (-e $f)
{
select(undef, undef, undef, .1);
die "File $f was not created\n" if (0 > --$count);
}
EOF

let $wait_condition = SELECT count(*) = 1
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'
AND variable_value != @IBPDS
AND variable_value like 'Buffer pool(s) dump completed at%';
--source include/wait_condition.inc

Expand Down

0 comments on commit 9f5078a

Please sign in to comment.