Merge lp:~gryp/percona-toolkit/pt-slave-restart-gtid-support into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.8

Proposed by Kenny Gryp on 2014-04-30
Status: Merged
Approved by: Daniel Nichter on 2014-05-28
Approved revision: 604
Merged at revision: 601
Proposed branch: lp:~gryp/percona-toolkit/pt-slave-restart-gtid-support
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.8
Diff against target: 533 lines (+419/-13)
7 files modified
bin/pt-slave-restart (+132/-6)
lib/Sandbox.pm (+1/-0)
sandbox/start-sandbox (+8/-0)
sandbox/test-env (+10/-7)
t/pt-slave-restart/gtid.t (+203/-0)
t/pt-slave-restart/gtid_parallelreplication.t (+64/-0)
util/checksum-test-dataset (+1/-0)
To merge this branch: bzr merge lp:~gryp/percona-toolkit/pt-slave-restart-gtid-support
Reviewer Review Type Date Requested Status
Daniel Nichter 2014-04-30 Approve on 2014-05-28
Review via email: mp+217776@code.launchpad.net

Commit message

Added GTID support for pt-slave-restart.

Description of the change

Basic support for GTID's.

Documentation:

GLOBAL TRANSACTION IDS
       pt-slave-restart supports Global Transaction IDs, which has been
       introduced in MySQL in 5.6.5.

       It's important to keep in mind that:

       o pt-slave-restart will not skip transactions when multiple
           replication threads are being used (slave_parallel_workers>0).
           pt-slave-restart does not know what the GTID event is of the
           failed
           transaction of a specific slave thread.

       o The default behavior is to skip the next transaction from the
           slave's master. Writes can originate on different servers,each
           with their own unique UUID.

           See "--skip-gtid-uuid".

       --skip-gtid-uuid
           type: string; default: master

           When using GTID, an empty transaction should be created in
           order to
           skip it. If writes are coming from different nodes in the
           replication tree above, it is not possible to know which event
           from which UUID to skip.

           By default, the UUID from the slave's master is being used to
           skip.
           ("SHOW GLOBAL STATUS Master_UUID" column).

           Example: Master -> Slave1 -> Slave2. When skipping events from
           'Slave2', and writes originated from 'Master', --skip-gtid-uuid
           should be specified with the 'Master' it's UUID.

           See "GLOBAL TRANSACTION IDS".

To post a comment you must log in.
604. By Kenny Gryp on 2014-05-28

merge branch daniel

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/pt-slave-restart'
--- bin/pt-slave-restart 2014-02-20 08:10:16 +0000
+++ bin/pt-slave-restart 2014-05-28 22:19:33 +0000
@@ -4766,6 +4766,12 @@
4766use Percona::Toolkit;4766use Percona::Toolkit;
4767use constant PTDEBUG => $ENV{PTDEBUG} || 0;4767use constant PTDEBUG => $ENV{PTDEBUG} || 0;
47684768
4769use Data::Dumper;
4770
4771local $Data::Dumper::Indent = 1;
4772local $Data::Dumper::Sortkeys = 1;
4773local $Data::Dumper::Quotekeys = 0;
4774
4769$OUTPUT_AUTOFLUSH = 1;4775$OUTPUT_AUTOFLUSH = 1;
47704776
4771my $o;4777my $o;
@@ -4976,10 +4982,36 @@
4976 $start_sql .= " UNTIL RELAY_LOG_FILE = '$file', RELAY_LOG_POS = $pos";4982 $start_sql .= " UNTIL RELAY_LOG_FILE = '$file', RELAY_LOG_POS = $pos";
4977 }4983 }
49784984
4979 my $set_skip = $dbh->prepare("SET GLOBAL SQL_SLAVE_SKIP_COUNTER = "4985 my $start = $dbh->prepare($start_sql);
4980 . $o->get('skip-count'));4986 my $stop = $dbh->prepare('STOP SLAVE');
4981 my $start = $dbh->prepare($start_sql);4987
4982 my $stop = $dbh->prepare('STOP SLAVE');4988 # ########################################################################
4989 # Detect if GTID is enabled. Skipping an event is done differently.
4990 # ########################################################################
4991 # When MySQL 5.6.5 or higher is used and gtid is enabled, skipping a
4992 # transaction is not possible with SQL_SLAVE_SKIP_COUNTER
4993 my $skip_event;
4994 my $have_gtid = 0;
4995 if ( VersionParser->new($dbh) >= '5.6.5' ) {
4996 my $row = $dbh->selectrow_arrayref('SELECT @@GLOBAL.gtid_mode');
4997 PTDEBUG && _d('@@GLOBAL.gtid_mode:', $row->[0]);
4998 if ( $row && $row->[0] eq 'ON' ) {
4999 $have_gtid = 1;
5000 }
5001 }
5002 PTDEBUG && _d('Have GTID:', $have_gtid);
5003
5004 # If GTID is enabled, slave_parallel_workers should be == 0.
5005 # It's currently not possible to know what GTID event the failed trx is.
5006 if ( $have_gtid ) {
5007 my $threads = $dbh->selectrow_hashref(
5008 'SELECT @@GLOBAL.slave_parallel_workers AS threads');
5009 if ( $threads->{threads} > 0 ) {
5010 die "Cannot skip transactions properly because GTID is enabled "
5011 . "and slave_parallel_workers > 0. See 'GLOBAL TRANSACTION IDS' "
5012 . "in the tool's documentation.\n";
5013 }
5014 }
49835015
4984 # ########################################################################5016 # ########################################################################
4985 # Lookup tables of things to do when a problem is detected.5017 # Lookup tables of things to do when a problem is detected.
@@ -4989,7 +5021,7 @@
4989 [ qr/Could not parse relay log event entry/ => 'refetch_relay_log' ],5021 [ qr/Could not parse relay log event entry/ => 'refetch_relay_log' ],
4990 [ qr/Incorrect key file for table/ => 'repair_table' ],5022 [ qr/Incorrect key file for table/ => 'repair_table' ],
4991 # This must be the last one. It's a catch-all rule: skip and restart.5023 # This must be the last one. It's a catch-all rule: skip and restart.
4992 [ qr/./ => 'skip' ],5024 [ qr/./ => ($have_gtid ? 'skip_gtid' : 'skip') ],
4993 );5025 );
49945026
4995 # ########################################################################5027 # ########################################################################
@@ -5012,9 +5044,61 @@
5012 },5044 },
5013 skip => sub {5045 skip => sub {
5014 my ( $stat, $dbh ) = @_;5046 my ( $stat, $dbh ) = @_;
5015 PTDEBUG && _d('Found non-relay-log error');5047 my $set_skip = $dbh->prepare("SET GLOBAL SQL_SLAVE_SKIP_COUNTER = "
5048 . $o->get('skip-count'));
5016 $set_skip->execute();5049 $set_skip->execute();
5017 },5050 },
5051 skip_gtid => sub {
5052 my ( $stat, $dbh ) = @_;
5053
5054 # Get master_uuid from SHOW SLAVE STATUS if a UUID is not specified
5055 # with --master-uuid.
5056 my $gtid_uuid = $o->get('master-uuid');
5057 if ( !$gtid_uuid ) {
5058 $gtid_uuid = $stat->{master_uuid};
5059 die "No master_uuid" unless $gtid_uuid; # shouldn't happen
5060 }
5061
5062 # We need the highest transaction in the executed_gtid_set.
5063 # and then we need to increase it by 1 (the one we want to skip)
5064 # Notes:
5065 # - does not work with parallel replication
5066 # - it skips the next transaction from the master_uuid
5067 # (when a slaveB is replicating from slaveA,
5068 # the master_uuid is it's own master, slaveA)
5069 my ($gtid_exec_ids) = ($stat->{executed_gtid_set} || '') =~ m/$gtid_uuid([0-9-:]*)/;
5070 $gtid_exec_ids =~ s/:[0-9]-/:/g;
5071 die "No executed GTIDs" unless $gtid_exec_ids;
5072
5073 my @gtid_exec_ranges = split(/:/, $gtid_exec_ids);
5074 delete $gtid_exec_ranges[0]; # undef the first value, it's always empty
5075
5076 # Get the highest id by sorting the array, removing the undef value.
5077 my @gtid_exec_sorted = sort { $a <=> $b }
5078 grep { defined($_) } @gtid_exec_ranges;
5079 my $gtid_exec_last = $gtid_exec_sorted[-1];
5080
5081 PTDEBUG && _d("\n",
5082 "GTID: master_uuid:", $gtid_uuid, "\n",
5083 "GTID: executed_gtid_set:", $gtid_exec_ids, "\n",
5084 "GTID: max for master_uuid:", $gtid_exec_sorted[-1], "\n",
5085 "GTID: last executed gtid:", $gtid_uuid, ":", $gtid_exec_last);
5086
5087 # Set the sessions next gtid, write an empty transaction
5088 my $skipped = 0;
5089 while ( $skipped++ < $o->get('skip-count') ) {
5090 my $gtid_next = $gtid_exec_last + $skipped;
5091 my $sql = "SET GTID_NEXT='$gtid_uuid:$gtid_next'";
5092 PTDEBUG && _d($sql);
5093 my $sth = $dbh->prepare($sql);
5094 $sth->execute();
5095 $dbh->begin_work();
5096 $dbh->commit();
5097 }
5098
5099 # Set the session back to the automatically generated GTID_NEXT.
5100 $dbh->do("SET GTID_NEXT='AUTOMATIC'");
5101 },
5018 repair_table => sub {5102 repair_table => sub {
5019 my ( $stat, $dbh ) = @_;5103 my ( $stat, $dbh ) = @_;
5020 PTDEBUG && _d('Found corrupt table');5104 PTDEBUG && _d('Found corrupt table');
@@ -5301,6 +5385,28 @@
53015385
5302=back5386=back
53035387
5388=head1 GLOBAL TRANSACTION IDS
5389
5390As of Percona Toolkit 2.2.8, pt-slave-restart supports Global Transaction IDs
5391introduced in MySQL 5.6.5. It's important to keep in mind that:
5392
5393=over
5394
5395=item *
5396
5397pt-slave-restart will not skip transactions when multiple replication threads
5398are being used (slave_parallel_workers > 0). pt-slave-restart does not know
5399what the GTID event is of the failed transaction of a specific slave thread.
5400
5401=item *
5402
5403The default behavior is to skip the next transaction from the slave's master.
5404Writes can originate on different servers, each with their own UUID.
5405
5406See L<"--master-uuid">.
5407
5408=back
5409
5304=head1 EXIT STATUS5410=head1 EXIT STATUS
53055411
5306An exit status of 0 (sometimes also called a return value or return code)5412An exit status of 0 (sometimes also called a return value or return code)
@@ -5555,6 +5661,26 @@
55555661
5556Number of statements to skip when restarting the slave.5662Number of statements to skip when restarting the slave.
55575663
5664=item --master-uuid
5665
5666type: string
5667
5668When using GTID, an empty transaction should be created in order to skip it.
5669If writes are coming from different nodes in the replication tree above, it is
5670not possible to know which event from which UUID to skip.
5671
5672By default, transactions from the slave's master (C<'Master_UUID'> from
5673C<SHOW SLAVE STATUS>) are skipped.
5674
5675For example, with
5676
5677 master1 -> slave1 -> slave2
5678
5679When skipping events on slave2 that were written to master1, you must specify
5680the UUID of master1, else the tool will use the UUID of slave1 by default.
5681
5682See L<"GLOBAL TRANSACTION IDS">.
5683
5558=item --sleep5684=item --sleep
55595685
5560type: int; default: 15686type: int; default: 1
55615687
=== modified file 'lib/Sandbox.pm'
--- lib/Sandbox.pm 2013-08-12 21:19:57 +0000
+++ lib/Sandbox.pm 2014-05-28 22:19:33 +0000
@@ -379,6 +379,7 @@
379 # Diff the two sets of checksums: host to master (ref).379 # Diff the two sets of checksums: host to master (ref).
380 my @diffs;380 my @diffs;
381 foreach my $c ( @checksums ) {381 foreach my $c ( @checksums ) {
382 next unless $c->{checksum};
382 if ( $c->{checksum} ne $ref->{$c->{table}}->{checksum} ) {383 if ( $c->{checksum} ne $ref->{$c->{table}}->{checksum} ) {
383 push @diffs, $c->{table};384 push @diffs, $c->{table};
384 }385 }
385386
=== modified file 'sandbox/start-sandbox'
--- sandbox/start-sandbox 2013-06-26 01:18:29 +0000
+++ sandbox/start-sandbox 2014-05-28 22:19:33 +0000
@@ -113,6 +113,14 @@
113 echo "query_cache_size=$QUERY_CACHE_SIZE" >> /tmp/$port/my.sandbox.cnf113 echo "query_cache_size=$QUERY_CACHE_SIZE" >> /tmp/$port/my.sandbox.cnf
114 fi114 fi
115115
116 if [ -n "$GTID" ]; then
117 echo "gtid_mode=on" >> /tmp/$port/my.sandbox.cnf
118 echo "enforce_gtid_consistency" >> /tmp/$port/my.sandbox.cnf
119 fi
120 if [ -n "$REPLICATION_THREADS" ]; then
121 echo "slave_parallel_workers=$REPLICATION_THREADS" >> /tmp/$port/my.sandbox.cnf
122 fi
123
116 if [ -n "$EXTRA_DEFAULTS_FILE" ]; then124 if [ -n "$EXTRA_DEFAULTS_FILE" ]; then
117 cat "$EXTRA_DEFAULTS_FILE" >> /tmp/$port/my.sandbox.cnf125 cat "$EXTRA_DEFAULTS_FILE" >> /tmp/$port/my.sandbox.cnf
118 fi126 fi
119127
=== modified file 'sandbox/test-env'
--- sandbox/test-env 2013-03-07 21:17:01 +0000
+++ sandbox/test-env 2014-05-28 22:19:33 +0000
@@ -315,13 +315,16 @@
315 fi315 fi
316316
317 if [ $? -eq 0 -a "$MYSQL_VERSION" '>' "4.1" ]; then317 if [ $? -eq 0 -a "$MYSQL_VERSION" '>' "4.1" ]; then
318 echo -n "Loading sakila database... "318 SAKILA=${SAKILA:-1}
319 ./load-sakila-db 12345 "${2:-""}"319 if [ $SAKILA -eq 1 ]; then
320 exit_status=$((exit_status | $?)) 320 echo -n "Loading sakila database... "
321 if [ $exit_status -ne 0 ]; then321 ./load-sakila-db 12345 "${2:-""}"
322 echo "FAILED"322 exit_status=$((exit_status | $?))
323 else323 if [ $exit_status -ne 0 ]; then
324 echo "OK"324 echo "FAILED"
325 else
326 echo "OK"
327 fi
325 fi328 fi
326329
327 # Create percona_test db and checksum all the tables.330 # Create percona_test db and checksum all the tables.
328331
=== added file 't/pt-slave-restart/gtid.t'
--- t/pt-slave-restart/gtid.t 1970-01-01 00:00:00 +0000
+++ t/pt-slave-restart/gtid.t 2014-05-28 22:19:33 +0000
@@ -0,0 +1,203 @@
1#!/usr/bin/env perl
2
3BEGIN {
4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
5 unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
6 unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
7};
8
9use strict;
10use warnings FATAL => 'all';
11use English qw(-no_match_vars);
12use Test::More;
13
14use PerconaTest;
15use Sandbox;
16require "$trunk/bin/pt-slave-restart";
17
18if ( $sandbox_version lt '5.6' ) {
19 plan skip_all => "Requires MySQL 5.6";
20}
21
22diag(`SAKILA=0 GTID=1 $trunk/sandbox/test-env restart`);
23
24my $dp = new DSNParser(opts=>$dsn_opts);
25my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
26my $master_dbh = $sb->get_dbh_for('master');
27my $slave1_dbh = $sb->get_dbh_for('slave1');
28my $slave2_dbh = $sb->get_dbh_for('slave2');
29
30if ( !$master_dbh ) {
31 plan skip_all => 'Cannot connect to sandbox master';
32}
33elsif ( !$slave1_dbh ) {
34 plan skip_all => 'Cannot connect to sandbox slave1';
35}
36elsif ( !$slave2_dbh ) {
37 plan skip_all => 'Cannot connect to sandbox slave2';
38}
39
40my $slave1_dsn = $sb->dsn_for("slave1");
41my $slave2_dsn = $sb->dsn_for("slave2");
42
43my $pid_file = "/tmp/pt-slave-restart-test-$PID.pid";
44my $log_file = "/tmp/pt-slave-restart-test-$PID.log";
45my $cmd = "$trunk/bin/pt-slave-restart --daemonize --run-time 5 --max-sleep .25 --pid $pid_file --log $log_file";
46
47sub start {
48 my ( $extra ) = @_;
49 stop() or return;
50 system "$cmd $extra";
51 PerconaTest::wait_for_files($pid_file);
52}
53
54sub stop() {
55 return 1 if !is_running();
56 diag(`$trunk/bin/pt-slave-restart --stop -q >/dev/null 2>&1 &`);
57 wait_until(sub { !-f $pid_file }, 0.3, 2);
58 diag(`rm -f /tmp/pt-slave-restart-sentinel`);
59 return is_running() ? 0 : 1;
60}
61
62sub is_running {
63 chomp(my $running = `ps -eaf | grep -v grep | grep '$cmd'`);
64 if (!-f $pid_file && !$running) {
65 return 0;
66 } elsif (-f $pid_file && !$running) {
67 diag(`rm -f $pid_file`);
68 return 0;
69 }
70 return 1;
71}
72
73sub wait_repl_broke {
74 my $dbh = shift;
75 return wait_until(
76 sub {
77 my $row = $dbh->selectrow_hashref('show slave status');
78 return $row->{last_sql_errno};
79 }
80 );
81}
82
83sub wait_repl_ok {
84 my $dbh = shift;
85 wait_until(
86 sub {
87 my $row = $dbh->selectrow_hashref('show slave status');
88 return $row->{last_sql_errno} == 0;
89 },
90 0.30,
91 5,
92 );
93}
94
95# #############################################################################
96# Basic test to see if restart works with GTID.
97# #############################################################################
98
99$master_dbh->do('DROP DATABASE IF EXISTS test');
100$master_dbh->do('CREATE DATABASE test');
101$master_dbh->do('CREATE TABLE test.t (a INT)');
102$sb->wait_for_slaves;
103
104# Bust replication
105$slave1_dbh->do('DROP TABLE test.t');
106$master_dbh->do('INSERT INTO test.t SELECT 1');
107wait_repl_broke($slave1_dbh) or die "Failed to break replication";
108
109my $r = $slave1_dbh->selectrow_hashref('show slave status');
110like($r->{last_error}, qr/Table 'test.t' doesn't exist'/, 'slave: Replication broke');
111
112# Start pt-slave-restart and wait up to 5s for it to fix replication
113# (it should take < 1s but tests can be really slow sometimes).
114start("$slave1_dsn") or die "Failed to start pt-slave-restart";
115wait_repl_ok($slave1_dbh);
116
117# Check if replication is fixed.
118$r = $slave1_dbh->selectrow_hashref('show slave status');
119like(
120 $r->{last_errno},
121 qr/^0$/,
122 'Event is skipped',
123) or BAIL_OUT("Replication is broken");
124
125# Stop pt-slave-restart.
126stop() or die "Failed to stop pt-slave-restart";
127
128# #############################################################################
129# Test the slave of the master.
130# #############################################################################
131
132$master_dbh->do('DROP DATABASE IF EXISTS test');
133$master_dbh->do('CREATE DATABASE test');
134$master_dbh->do('CREATE TABLE test.t (a INT)');
135$sb->wait_for_slaves;
136
137# Bust replication
138$slave2_dbh->do('DROP TABLE test.t');
139$master_dbh->do('INSERT INTO test.t SELECT 1');
140wait_repl_broke($slave2_dbh) or die "Failed to break replication";
141
142# fetch the master uuid, which is the machine we need to skip an event from
143$r = $master_dbh->selectrow_hashref('select @@GLOBAL.server_uuid as uuid');
144my $uuid = $r->{uuid};
145
146$r = $slave2_dbh->selectrow_hashref('show slave status');
147like($r->{last_error}, qr/Table 'test.t' doesn't exist'/, 'slaveofslave: Replication broke');
148
149# Start an instance
150start("--master-uuid=$uuid $slave2_dsn") or die;
151wait_repl_ok($slave2_dbh);
152
153$r = $slave2_dbh->selectrow_hashref('show slave status');
154like(
155 $r->{last_errno},
156 qr/^0$/,
157 'Skips event from master on slave2'
158) or BAIL_OUT("Replication is broken");
159
160stop() or die "Failed to stop pt-slave-restart";
161
162# #############################################################################
163# Test skipping 2 events in a row.
164# #############################################################################
165
166$master_dbh->do('DROP DATABASE IF EXISTS test');
167$master_dbh->do('CREATE DATABASE test');
168$master_dbh->do('CREATE TABLE test.t (a INT)');
169$sb->wait_for_slaves;
170
171# Bust replication
172$slave2_dbh->do('DROP TABLE test.t');
173$master_dbh->do('INSERT INTO test.t SELECT 1');
174$master_dbh->do('INSERT INTO test.t SELECT 1');
175wait_repl_broke($slave2_dbh) or die "Failed to break replication";
176
177# fetch the master uuid, which is the machine we need to skip an event from
178$r = $master_dbh->selectrow_hashref('select @@GLOBAL.server_uuid as uuid');
179$uuid = $r->{uuid};
180
181$r = $slave2_dbh->selectrow_hashref('show slave status');
182like($r->{last_error}, qr/Table 'test.t' doesn't exist'/, 'slaveofslaveskip2: Replication broke');
183
184# Start an instance
185start("--skip-count=2 --master-uuid=$uuid $slave2_dsn") or die;
186wait_repl_ok($slave2_dbh);
187
188$r = $slave2_dbh->selectrow_hashref('show slave status');
189like(
190 $r->{last_errno},
191 qr/^0$/,
192 'Skips multiple events'
193) or BAIL_OUT("Replication is broken");
194
195stop() or die "Failed to stop pt-slave-restart";
196
197# #############################################################################
198# Done.
199# #############################################################################
200diag(`rm -f $pid_file $log_file >/dev/null`);
201diag(`$trunk/sandbox/test-env restart`);
202ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
203done_testing;
0204
=== added file 't/pt-slave-restart/gtid_parallelreplication.t'
--- t/pt-slave-restart/gtid_parallelreplication.t 1970-01-01 00:00:00 +0000
+++ t/pt-slave-restart/gtid_parallelreplication.t 2014-05-28 22:19:33 +0000
@@ -0,0 +1,64 @@
1#!/usr/bin/env perl
2
3BEGIN {
4 die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
5 unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
6 unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
7};
8
9use strict;
10use warnings FATAL => 'all';
11use English qw(-no_match_vars);
12use Test::More;
13
14use PerconaTest;
15use Sandbox;
16require "$trunk/bin/pt-slave-restart";
17
18if ( $sandbox_version lt '5.6' ) {
19 plan skip_all => 'MySQL Version ' . $sandbox_version
20 . ' < 5.6, GTID is not available, skipping tests';
21}
22
23diag("Stopping/reconfiguring/restarting sandboxes 12345, 12346 and 12347");
24
25diag(`$trunk/sandbox/test-env stop >/dev/null`);
26diag(`REPLICATION_THREADS=2 GTID=1 $trunk/sandbox/test-env start >/dev/null`);
27
28my $dp = new DSNParser(opts=>$dsn_opts);
29my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
30my $master_dbh = $sb->get_dbh_for('master');
31my $slave_dbh = $sb->get_dbh_for('slave1');
32my $slave2_dbh = $sb->get_dbh_for('slave2');
33
34if ( !$master_dbh ) {
35 plan skip_all => 'Cannot connect to sandbox master';
36}
37elsif ( !$slave_dbh ) {
38 plan skip_all => 'Cannot connect to sandbox slave1';
39}
40elsif ( !$slave2_dbh ) {
41 plan skip_all => 'Cannot connect to sandbox slave2';
42}
43
44# #############################################################################
45# pt-slave-restart should exit!
46# #############################################################################
47# Start an instance
48my $output=`$trunk/bin/pt-slave-restart --run-time=1s -h 127.0.0.1 -P 12346 -u msandbox -p msandbox 2>&1`;
49
50like(
51 $output,
52 qr/It is impossible to skip transactions properly./,
53 "pt-slave-restart exits with multiple replication threads"
54);
55
56# #############################################################################
57# Done.
58# #############################################################################
59diag(`rm -f /tmp/pt-slave-re*`);
60diag(`$trunk/sandbox/test-env stop >/dev/null`);
61diag(`$trunk/sandbox/test-env start >/dev/null`);
62
63ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
64done_testing;
065
=== modified file 'util/checksum-test-dataset'
--- util/checksum-test-dataset 2013-02-19 00:28:12 +0000
+++ util/checksum-test-dataset 2014-05-28 22:19:33 +0000
@@ -61,6 +61,7 @@
61 . join(", ", map { "sakila.$_" } @tables_in_sakila);61 . join(", ", map { "sakila.$_" } @tables_in_sakila);
62my @checksums = @{$dbh->selectall_arrayref($sql, {Slice => {} })};62my @checksums = @{$dbh->selectall_arrayref($sql, {Slice => {} })};
63foreach my $c ( @checksums ) {63foreach my $c ( @checksums ) {
64 next unless $c->{Checksum};
64 $dbh->do("INSERT INTO percona_test.checksums(db_tbl, checksum)65 $dbh->do("INSERT INTO percona_test.checksums(db_tbl, checksum)
65 VALUES('$c->{Table}', $c->{Checksum})");66 VALUES('$c->{Table}', $c->{Checksum})");
66}67}

Subscribers

People subscribed via source and target branches