1
0
mirror of https://github.com/MariaDB/server.git synced 2025-05-25 13:42:52 +03:00
mariadb/mysql-test/include/wait_for_line_count_in_file.inc
Sergey Vojtovich 06219c2ad4 MDEV-21599 - plugins.server_audit fails sporadically in buildbot
Fixed a couple of race conditions in the test case to ensure stable order
of events. Also removed all sleeps. Test execution time is down from 18s
to 0.15s.

On disconnect audit event is triggered after control is returned to
mysqltest client. Which means mysqltest may issue more commands
concurrently before disconnect is actually logged.

Similar problem happens with regular query execution: an event is
triggered after control is returner to the client. Which may end
up with unstable order of events in different connections.

Delayed insert rows are enqueued separately and can either be combined
into single event or go as separate events. Reduced number of inserted
rows to 1 to stabilize result.

Also backported 2b3f6ab from 10.5.
2020-04-10 19:35:53 +04:00

19 lines
535 B
PHP

perl;
use strict;
use Time::HiRes qw(sleep);
my $search_count= $ENV{'SEARCH_COUNT'} or die "SEARCH_COUNT not set";
my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set";
my $wait_counter= 100; # 10 seconds
while (1)
{
my $cnt= 0;
open(FILE, $search_file) or die("Unable to open '$search_file': $!\n");
$cnt++ while (<FILE>);
close(FILE);
last if ($cnt == $search_count);
$wait_counter-- or
die "Timeout waiting for $search_count lines in $search_file\n";
sleep(0.1);
}
EOF