← Back
Editing: gr_random_view_id_generator.test
################################################################################ # 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 ../inc/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source ../inc/group_replication.inc --source ../inc/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/tmp/random_view_id_generator.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 =~ /$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 ../inc/group_replication_end.inc
Save File
Cancel