File: gr_variables_mysqladmin.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (73 lines) | stat: -rw-r--r-- 3,133 bytes parent folder | download
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
###############################################################################
# Check mysqladmin output to test group_replication variable's values.
# Test :
# 0. This test requires 2 servers which should be in group replication
# 1. Bring up the group replication with 2 servers
# 2. Use myqladmin executable and dump all the variables to a file
# 3. Using perl script go through the dumped file and print all the
#    group replication variable with values
# 4. Cleanup
###############################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc

SET @@GLOBAL.group_replication_ip_allowlist= "AUTOMATIC";
--source include/start_and_bootstrap_group_replication.inc

#=============== Checking the group replication variable values ================
--echo =====mysqladmin -u root -P MASTER_MYPORT --protocol=TCP check all the GR variable outputs=====
--exec $MYSQLADMIN -u root -P $MASTER_MYPORT --protocol=TCP variables >$MYSQLTEST_VARDIR/tmp/group_replication_variables_mysqladmin.tmp

# This subroutine checks for group replication variables in the dump file and
# adds it to @varlist and then prints the item from the list
# Currently it takes one search pattern string and seraches for that
# particular gr variable and prints it.

perl;
sub mySubroutine () {
my $search_file="$ENV{'MYSQLTEST_VARDIR'}/tmp/group_replication_variables_mysqladmin.tmp" or die "SEARCH_FILE not set";
my $search_pattern="$_[0]";
my $found=0;
my $line;
my @varlist;

open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n");
my @file_content=<FILE>;
foreach $line ( @file_content ) {
    if ( $line =~ /($search_pattern)/ ) {
        $found= 1;
	# Split based on | and spaces and add it to @varlist
	push @varlist,split (/[\|\s]+/,$line)
    }
}
close(FILE);
print join("\n",@varlist);

if ( ($found == 0) && (not $line =~ m{$search_pattern}) ) {
    die("# ERROR: The file '$search_file' does not contain the expected pattern  $search_pattern\n->$line<-\n");
    }
}

# Calling the subroutine for the variables which needs to be searched and printed
# Many other variables are not considered due to their dynamic values and
# values with different runs across different machines

&mySubroutine('group_replication_allow_local_lower_version_join');
&mySubroutine('group_replication_auto_increment_increment');
&mySubroutine('group_replication_bootstrap_group');
&mySubroutine('group_replication_components_stop_timeout');
&mySubroutine('group_replication_compression_threshold');
&mySubroutine('group_replication_force_members');
&mySubroutine('group_replication_ip_allowlist');
&mySubroutine('group_replication_poll_spin_loops');
&mySubroutine('group_replication_recovery_complete_at');
&mySubroutine('group_replication_recovery_reconnect_interval');
&mySubroutine('group_replication_recovery_retry_count');
&mySubroutine('group_replication_start_on_boot');
EOF

--remove_file "$MYSQLTEST_VARDIR/tmp/group_replication_variables_mysqladmin.tmp";
--echo
--source include/group_replication_end.inc