Debian Codegraph @

mysql-test/suite/group_replication/t/gr_variables_mysqladmin.test

raw
1 ###############################################################################
2 # Check mysqladmin output to test group_replication variable's values.
3 # Test :
4 # 0. This test requires 2 servers which should be in group replication
5 # 1. Bring up the group replication with 2 servers
6 # 2. Use myqladmin executable and dump all the variables to a file
7 # 3. Using perl script go through the dumped file and print all the
8 # group replication variable with values
9 # 4. Cleanup
10 ###############################################################################
11 --source include/have_group_replication_plugin.inc
12 --let $rpl_skip_group_replication_start= 1
13 --source include/group_replication.inc
14
15 SET @@GLOBAL.group_replication_ip_allowlist= "AUTOMATIC";
16 --source include/start_and_bootstrap_group_replication.inc
17
18 #=============== Checking the group replication variable values ================
19 --echo =====mysqladmin -u root -P MASTER_MYPORT --protocol=TCP check all the GR variable outputs=====
20 --exec $MYSQLADMIN -u root -P $MASTER_MYPORT --protocol=TCP variables >$MYSQLTEST_VARDIR/tmp/group_replication_variables_mysqladmin.tmp
21
22 # This subroutine checks for group replication variables in the dump file and
23 # adds it to @varlist and then prints the item from the list
24 # Currently it takes one search pattern string and seraches for that
25 # particular gr variable and prints it.
26
27 perl;
28 sub mySubroutine () {
29 my $search_file="$ENV{'MYSQLTEST_VARDIR'}/tmp/group_replication_variables_mysqladmin.tmp" or die "SEARCH_FILE not set";
30 my $search_pattern="$_[0]";
31 my $found=0;
32 my $line;
33 my @varlist;
34
35 open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n");
36 my @file_content=<FILE>;
37 foreach $line ( @file_content ) {
38 if ( $line =~ /($search_pattern)/ ) {
39 $found= 1;
40 # Split based on | and spaces and add it to @varlist
41 push @varlist,split (/[\|\s]+/,$line)
42 }
43 }
44 close(FILE);
45 print join("\n",@varlist);
46
47 if ( ($found == 0) && (not $line =~ m{$search_pattern}) ) {
48 die("# ERROR: The file '$search_file' does not contain the expected pattern $search_pattern\n->$line<-\n");
49 }
50 }
51
52 # Calling the subroutine for the variables which needs to be searched and printed
53 # Many other variables are not considered due to their dynamic values and
54 # values with different runs across different machines
55
56 &mySubroutine('group_replication_allow_local_lower_version_join');
57 &mySubroutine('group_replication_auto_increment_increment');
58 &mySubroutine('group_replication_bootstrap_group');
59 &mySubroutine('group_replication_components_stop_timeout');
60 &mySubroutine('group_replication_compression_threshold');
61 &mySubroutine('group_replication_force_members');
62 &mySubroutine('group_replication_ip_allowlist');
63 &mySubroutine('group_replication_poll_spin_loops');
64 &mySubroutine('group_replication_recovery_complete_at');
65 &mySubroutine('group_replication_recovery_reconnect_interval');
66 &mySubroutine('group_replication_recovery_retry_count');
67 &mySubroutine('group_replication_start_on_boot');
68 EOF
69
70 --remove_file "$MYSQLTEST_VARDIR/tmp/group_replication_variables_mysqladmin.tmp";
71 --echo
72 --source include/group_replication_end.inc
73