mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-34753 memory pressure - erroneous termination condition
Fix race condition in test case by waiting for the expected state to occur. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
committed by
Daniel Black
parent
eb29190398
commit
abc46259c6
@ -18,6 +18,10 @@
|
||||
# Optionally, SEARCH_ABORT can be set to "FOUND" or "NOT FOUND" and this
|
||||
# will abort if the search result doesn't match the requested one.
|
||||
#
|
||||
# Optionally, SEARCH_WAIT can be set to "FOUND" or "NOT FOUND", and this
|
||||
# will wait for the condition to occur. The timeout can be set in
|
||||
# SEARCH_TIMEOUT, default is 60 seconds.
|
||||
#
|
||||
# Optionally, SEARCH_OUTPUT can be set to control the format of output.
|
||||
# Supported formats:
|
||||
# - (default) : "FOUND n /pattern/ in FILE " or "NOT FOUND ..."
|
||||
@ -55,6 +59,12 @@ perl;
|
||||
my @search_files= glob($ENV{SEARCH_FILE});
|
||||
my $search_pattern= $ENV{SEARCH_PATTERN} or die "SEARCH_PATTERN not set";
|
||||
my $search_range= $ENV{SEARCH_RANGE};
|
||||
my $timeout= $ENV{SEARCH_TIMEOUT} || 60;
|
||||
my @matches;
|
||||
my $res;
|
||||
|
||||
my $start_time= time();
|
||||
for (;;) {
|
||||
my $content;
|
||||
foreach my $search_file (@search_files) {
|
||||
open(FILE, '<', $search_file) || die("Can't open file $search_file: $!");
|
||||
@ -78,8 +88,21 @@ perl;
|
||||
close(FILE);
|
||||
$content.= $file_content;
|
||||
}
|
||||
my @matches= ($content =~ /$search_pattern/gs);
|
||||
my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND";
|
||||
@matches= ($content =~ /$search_pattern/gs);
|
||||
$res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND";
|
||||
|
||||
if (($ENV{SEARCH_WAIT} eq 'FOUND' && $res eq 'NOT FOUND') ||
|
||||
($ENV{SEARCH_WAIT} eq 'NOT FOUND' && $res =~ m{^FOUND })) {
|
||||
if (time() - $start_time < $timeout) {
|
||||
# Millisceond sleep emulated with select
|
||||
select(undef, undef, undef, 0.1);
|
||||
next;
|
||||
}
|
||||
die "Timeout waiting for $ENV{SEARCH_WAIT} ".
|
||||
"for /$search_pattern/ in $ENV{SEARCH_FILE}\n";
|
||||
}
|
||||
last;
|
||||
}
|
||||
|
||||
$ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1};
|
||||
|
||||
|
@ -38,11 +38,16 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
let SEARCH_PATTERN= [Mm]emory pressure.*;
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
# The garbage collection happens asynchronously after trigger, in a background
|
||||
# thread. So wait for it to happen to avoid sporadic failure.
|
||||
let $wait_condition=
|
||||
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
|
||||
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
|
||||
|
||||
--source include/wait_condition.inc
|
||||
eval $wait_condition;
|
||||
let SEARCH_PATTERN= InnoDB: Memory pressure event freed.*;
|
||||
let SEARCH_WAIT= FOUND;
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
set debug_dbug=@save_dbug;
|
||||
|
Reference in New Issue
Block a user