1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
################################################################################
# BUG#21495778 - VIEW CHANGE ID GENERATION CAN POSSIBLY REPEAT IDS
#
# This test checks that the view_id generated for 100 view_changes do not
# conflict with any of the already existing view_id
#
# It starts/stops the group 100 times and check if the view_id is getting
# repeated.
#
# Test:
# 0. The test requires one server.
# 1. Set bootstrap group ON on member and iterate START and STOP
# GROUP_REPLICATION 100 times.
# 2. Check for view_ids. View_id should not be repeated.
################################################################################
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--source include/gr_set_bootstrap_group.inc
--let $iterations_expected=50
--let $iteration_count=0
# disable the logging of the include files since they will just increase the
# size of the result log file.
--let $include_silent=1
while ($iteration_count < $iterations_expected)
{
--source include/start_group_replication.inc
--source include/stop_group_replication.inc
if (!$include_silent)
{
--echo ITERATION_COUNT=$iteration_count
}
--inc $iteration_count
}
--let $include_silent=0
--let $grep_file=$MYSQLTEST_VARDIR/log/mysqld.1.err
--let _GP_GREP_FILE= $grep_file
--let _ITERATIONS_EXPECTED= $iterations_expected
--perl
use strict;
my $file= $ENV{'_GP_GREP_FILE'} or die "grep_file is not set";
my $iterations_expected= $ENV{'_ITERATIONS_EXPECTED'} or die "iterations_expected not set";
open(FILE, "$file") or die("Unable to open $file: $!\n");
my $pattern= 'Group membership changed to';
my @view_id;
my $count= 0;
my $count_occurence= 0;
while(<FILE>)
{
my $line = $_;
if ($line =~ /CURRENT_TEST: /)
{
@view_id = ();
$count= 0;
$count_occurence= 0;
}
if ($line =~ /$pattern/)
{
my $result = index($line, $pattern);
my $first = substr($line, $result+length($pattern));
push(@view_id, $first);
$count_occurence++;
}
}
if ($count_occurence != $iterations_expected)
{
die("Failed to generate the specified number of view_id's: expected: $iterations_expected, observed: $count_occurence \n");
}
my @B = sort @view_id;
my $previous = pop @B;
foreach my $value (@B)
{
if ($previous eq $value)
{
$count++;
}
$previous = $value;
}
print $count ? "View_id repeated.\n" : "View_id not repeated.\n";
close (FILE) or die "Error closing $file: $!";
EOF
--source include/group_replication_end.inc
|