mirror of
https://github.com/MariaDB/server.git
synced 2025-02-05 13:22:17 +01:00
fa8a46eb68
By design, InnoDB has always hung when permanently running out of buffer pool, for example when several threads are waiting to allocate a block, and all of the buffer pool is buffer-fixed by the active threads. The hang that we are fixing here occurs when the buffer pool is only temporarily running out and the situation could be rescued by writing out some dirty pages or evicting some clean pages. buf_LRU_get_free_block(): Simplify the way how we wait for the buf_flush_page_cleaner thread. This fixes occasional hangs of the test encryption.innochecksum that were introduced by commita55b951e60
(MDEV-26827). To play it safe, we use a timed wait when waiting for the buf_flush_page_cleaner() thread to perform its job. Should that thread get stuck, we will invoke buf_pool.LRU_warn() in order to display a message that pages could not be freed, and keep trying to wake up the buf_flush_page_cleaner() thread. The INFORMATION_SCHEMA.INNODB_METRICS counters buffer_LRU_single_flush_failure_count and buffer_LRU_get_free_waits will be removed. The latter is represented by buffer_pool_wait_free. Also removed will be the message "InnoDB: Difficult to find free blocks in the buffer pool" because ind34479dc66
we introduced a more precise message "InnoDB: Could not free any blocks in the buffer pool" in the buf_flush_page_cleaner thread. buf_pool_t::LRU_warn(): Issue the warning message that we could not free any blocks in the buffer pool. This may also be invoked by buf_LRU_get_free_block() if buf_flush_page_cleaner() appears to be stuck. buf_pool_t::n_flush_dec(): Remove. buf_pool_t::n_flush_dec_holding_mutex(): Rename to n_flush_dec(). buf_flush_LRU_list_batch(): Increment the eviction counter for blocks of temporary, discarded or dropped tablespaces. buf_flush_LRU(): Make static, and remove the constant parameter evict=false. The only caller will be the buf_flush_page_cleaner() thread. IORequest::is_LRU(): Remove. The only case of evicting pages on write completion will be when we are writing out pages of the temporary tablespace. Those pages are not in buf_pool.flush_list, only in buf_pool.LRU. buf_page_t::flush(): Remove the parameter evict. buf_page_t::write_complete(): Change the parameter "bool temporary" to "bool persistent" and add a parameter for an already read state(). Reviewed by: Debarun Banerjee
89 lines
3.2 KiB
Text
89 lines
3.2 KiB
Text
#************************************************************
|
|
# WL6045:Improve Innochecksum
|
|
#************************************************************
|
|
--source include/innodb_page_size_small.inc
|
|
--source include/have_debug.inc
|
|
# Avoid CrashReporter popup on Mac.
|
|
--source include/not_crashrep.inc
|
|
|
|
--source include/not_embedded.inc
|
|
-- source include/big_test.inc
|
|
|
|
let MYSQLD_BASEDIR= `SELECT @@basedir`;
|
|
let MYSQLD_DATADIR= `SELECT @@datadir`;
|
|
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
|
|
let $restart_noprint=2;
|
|
|
|
SET GLOBAL innodb_compression_level=0;
|
|
SELECT @@innodb_compression_level;
|
|
|
|
CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
|
INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
|
|
let $i=10;
|
|
while ($i > 0) {
|
|
INSERT INTO t1 SELECT * from t1;
|
|
dec $i;
|
|
}
|
|
|
|
--echo # stop the server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
# Page_type_dump for t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/t1.ibd
|
|
--file_exists $MYSQLTEST_VARDIR/tmp/dump.txt
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
|
|
|
|
--echo [1]:# check the both short and long options for "help"
|
|
--exec $INNOCHECKSUM --help $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_long.txt
|
|
--exec $INNOCHECKSUM -I $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_short.txt
|
|
--diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/help_output_short.txt
|
|
|
|
--echo [2]:# Run the innochecksum when file isn't provided.
|
|
--echo # It will print the innochecksum usage similar to --help option.
|
|
--error 1
|
|
--exec $INNOCHECKSUM > $MYSQLTEST_VARDIR/tmp/usage.txt
|
|
--diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/usage.txt
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/usage.txt
|
|
|
|
perl;
|
|
use strict;
|
|
use warnings;
|
|
use File::Copy;
|
|
my $dir = $ENV{'MYSQLTEST_VARDIR'};
|
|
my $file= 'help_output_long.txt';
|
|
# open file in write mode
|
|
open IN_FILE,"<", "$dir/tmp/$file" or die $!;
|
|
open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
|
|
while(<IN_FILE>) {
|
|
unless ($_=~ /^debug.*$/ || $_=~ /\-#, \-\-debug.*$/ || $_=~ /http:.*html/) {
|
|
$_=~ s/^\S*innochecksum.+Ver.+[0-9]*\.[0-9]*\.[0-9]*.+$/innochecksum Ver #.#.#/g;
|
|
$_=~ s/(Copyright\s\(c\))\s([0-9]*),\s([0-9]*)(.*)/$1 YEAR, YEAR $4/g;
|
|
$_=~ s/Usage:.*\[-c/Usage: innochecksum [-c/g;
|
|
print OUT_FILE $_;
|
|
}
|
|
}
|
|
close(IN_FILE);
|
|
close(OUT_FILE);
|
|
# move the new content from tmp file to the orginal file.
|
|
move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
|
|
EOF
|
|
|
|
--cat_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/help_output_short.txt
|
|
|
|
--echo [3]:# check the both short and long options for "count" and exit
|
|
--replace_regex /[0-9]+/#/
|
|
--exec $INNOCHECKSUM --count $MYSQLD_DATADIR/test/t1.ibd
|
|
--replace_regex /[0-9]+/#/
|
|
--exec $INNOCHECKSUM -c $MYSQLD_DATADIR/test/t1.ibd
|
|
|
|
--echo [4]:# Print the version of innochecksum and exit
|
|
--replace_regex /.*innochecksum.*Ver.*[0-9]*.[0-9]*.[0-9]*.*/innochecksum Ver #.#.#/
|
|
--exec $INNOCHECKSUM -V $MYSQLD_DATADIR/test/t1.ibd
|
|
|
|
--echo # Restart the DB server
|
|
--source include/start_mysqld.inc
|
|
|
|
DROP TABLE t1;
|