File: replication_options.sb.pl

package info (click to toggle)
mysql-sandbox 3.2.05-1.1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 916 kB
  • sloc: perl: 9,878; sh: 191; makefile: 8
file content (174 lines) | stat: -rw-r--r-- 5,324 bytes parent folder | download | duplicates (2)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#
# Test replication parameters.
# You can affect the replication installation with some 
# command line options
#  * --master_options only master
#  * --slave_options only slaves
#  * --node_options all nodes, master and slaves
#
my $TEST_VERSION = $ENV{TEST_VERSION};
my ($version, $name_version, $major, $minor, $rev) = get_bare_version($TEST_VERSION);
my $replication_dir = "rsandbox_$name_version";
my $custom_port = 11000;
my $custom_port1 = $custom_port + 1;

my $check_uuid =0;
if ( ($major ==5) &&  ($minor >= 6) )
{
    $check_uuid=1;
}

$ENV{MASTER_OPTIONS} = '';
$ENV{SLAVE_OPTIONS}  = '';
$ENV{NODE_OPTIONS}   = '';
my $master_options   = '-c key-buffer-size=20M';
my $slave_options    = '-c key-buffer-size=25M';
my $node_options     = '-c max_allowed_packet=3M';

my $command_line_options =   "--master_options='$master_options' "
                           . "--slave_options='$slave_options' "
                           . "--node_options='$node_options' $TEST_VERSION ";

ok_exec({
    command     => "make_replication_sandbox $command_line_options $TEST_VERSION ",
    expected    => 'replication directory installed',
    msg         => 'replication directory installed',
});
sleep 2;
ok_sql({
    path    => "$sandbox_home/$replication_dir/master",
    query   => "show variables like 'key_buffer_size'",
    expected => '20971520',
    msg      => 'master key buffer (20M)',    
});
ok_sql({
    path    => "$sandbox_home/$replication_dir/master",
    query   => "show variables like 'max_allowed_packet'",
    expected => '3145728',
    msg      => 'master max allowed packet (3M)',    
});
ok_sql({
    path    => "$sandbox_home/$replication_dir/node1",
    query   => "show variables like 'max_allowed_packet'",
    expected => '3145728',
    msg      => 'node 1 max allowed packet (3M)',    
});
ok_sql({
    path    => "$sandbox_home/$replication_dir/node2",
    query   => "show variables like 'max_allowed_packet'",
    expected => '3145728',
    msg      => 'node 2 max allowed packet (3M)',    
});

ok_sql({
    path    => "$sandbox_home/$replication_dir/node1",
    query   => "show variables like 'key_buffer_size'",
    expected => '26214400',
    msg      => 'slave 1 key buffer (25M)',    
});
ok_sql({
    path    => "$sandbox_home/$replication_dir/node2",
    query   => "show variables like 'key_buffer_size'",
    expected => '26214400',
    msg      => 'slave 2 key buffer (25M)',    
});
ok_exec( {
    command => "sbtool -o delete -s $sandbox_home/$replication_dir ", 
    expected => 'has been removed',
    msg      => "$replication_dir removed"
});

# Test --master and --slaveof
my $master_extra_options='';
# workaround for Bug#77732 added to low_level_make_sandbox
#if ($TEST_VERSION =~ /5\.7\.8/)
#{
#    $master_extra_options .= ' -c show_compatibility_56=on '
#}
ok_exec({
    command     => "make_sandbox $TEST_VERSION -- --master --sandbox_directory=msb_master --sandbox_port=$custom_port --no_confirm $master_extra_options",
    expected    => 'sandbox server started',
    msg         => 'sandbox master installed',
});
sleep 2;
ok_exec({
    command     => "make_sandbox $TEST_VERSION -- --no_confirm --sandbox_port=$custom_port1 --sandbox_directory=msb_slave --slaveof='master_port=$custom_port' ",
    expected    => 'sandbox server started',
    msg         => 'sandbox master installed',
});
sleep 2;
ok_sql({
    path    => "$sandbox_home/msb_master/",
    query   => "show variables like 'log_bin'",
    expected => 'ON',
    msg      => 'master binlog',    
});
ok_sql({
    path    => "$sandbox_home/msb_master/",
    query   => "show variables like 'server_id'",
    expected => $custom_port,
    msg      => 'master server ID',    
});

if ($check_uuid)
{
    ok_sql({
        path    => "$sandbox_home/msb_master/",
        query   => "show variables like 'server_uuid'",
        expected => $custom_port,
        msg      => 'master server UUID',
    });
}
else
{
    ok(1, 'skip UUID check');
}

ok_sql({
    path    => "$sandbox_home/msb_slave/",
    query   => "show variables like 'server_id'",
    expected => $custom_port1,
    msg      => 'slave server ID',    
});

ok_sql({
    path    => "$sandbox_home/msb_slave/",
    query   => "show slave status \\G",
    expected => ['Slave_IO_Running: Yes', 'Slave_SQL_Running: Yes'],
    msg      => 'slave server ID',    
});


ok_exec( {
    command => "sbtool -o delete -s $sandbox_home/msb_master ", 
    expected => 'has been removed',
    msg      => "msb_master removed"
});

ok_exec( {
    command => "sbtool -o delete -s $sandbox_home/msb_slave ", 
    expected => 'has been removed',
    msg      => "msb_slave removed"
});

# testing --high_performance
#
ok_exec({
    command     => "make_sandbox $TEST_VERSION -- --high_performance --sandbox_directory=msb_hp --sandbox_port=$custom_port --no_confirm",
    expected    => 'sandbox server started',
    msg         => 'sandbox hp installed',
});
sleep 2;
ok_sql({
    path    => "$sandbox_home/msb_hp/",
    query   => "show variables like 'innodb%'",
    expected => ['innodb_buffer_pool_size\s*536870912', 'innodb_flush_method\s*O_DIRECT'],
    msg      => 'high performance options',    
});

ok_exec( {
    command => "sbtool -o delete -s $sandbox_home/msb_hp ", 
    expected => 'has been removed',
    msg      => "msb_hp removed"
});