Revert to r243 to undo pt-table-sync changes.

This commit is contained in:
Daniel Nichter
2011-12-22 12:06:25 -07:00
parent 2760322c87
commit 1d8da408fc
10 changed files with 4800 additions and 4285 deletions

View File

@@ -28,7 +28,7 @@ elsif ( !$slave_dbh ) {
plan skip_all => 'Cannot connect to sandbox slave';
}
else {
plan tests => 9;
plan tests => 17;
}
$sb->wipe_clean($master_dbh);
@@ -82,17 +82,56 @@ is_deeply(
'Synced OK with no alg'
);
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
$output = run('test1', 'test2', '--algorithms Stream --no-bin-log');
is($output, "INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('1', 'en');
INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('2', 'ca');", 'Basic Stream sync');
is_deeply(
query_slave('select * from test.test2'),
[ { a => 1, b => 'en' }, { a => 2, b => 'ca' } ],
'Synced OK with Stream'
);
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
$output = run('test1', 'test2', '--algorithms GroupBy --no-bin-log');
is($output, "INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('1', 'en');
INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('2', 'ca');", 'Basic GroupBy sync');
is_deeply(
query_slave('select * from test.test2'),
[ { a => 1, b => 'en' }, { a => 2, b => 'ca' } ],
'Synced OK with GroupBy'
);
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
$output = run('test1', 'test2', '--algorithms Chunk,GroupBy --no-bin-log');
is($output, "INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('1', 'en');
INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('2', 'ca');", 'Basic Chunk sync');
is_deeply(
query_slave('select * from test.test2'),
[ { a => 1, b => 'en' }, { a => 2, b => 'ca' } ],
'Synced OK with Chunk'
);
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
$output = run('test1', 'test2', '--algorithms Nibble --no-bin-log');
is($output, "INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('1', 'en');
INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('2', 'ca');", 'Basic Nibble sync');
is_deeply(
query_slave('select * from test.test2'),
[ { a => 1, b => 'en' }, { a => 2, b => 'ca' } ],
'Synced OK with Nibble'
);
# Save original MKDEBUG env because we modify it below.
my $dbg = $ENV{MKDEBUG};
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
$ENV{MKDEBUG} = 1;
$output = run_cmd('test1', 'test2', '--no-bin-log --chunk-size 1 --transaction --lock 1');
$output = run_cmd('test1', 'test2', '--algorithms Nibble --no-bin-log --chunk-size 1 --transaction --lock 1');
delete $ENV{MKDEBUG};
# TODO: rewrite this poor test
like(
$output,
qr/START TRANSACTION/,
qr/Executing statement on source/,
'Nibble with transactions and locking'
);
is_deeply(
@@ -117,12 +156,12 @@ like(
);
like(
$output,
qr/2\s+\S+\s+\S+\s+2\s+test.test3/,
qr/2 Chunk\s+\S+\s+\S+\s+2\s+test.test3/,
'Right number of rows to update',
);
# Sync a table with Nibble and a chunksize in data size, not number of rows
$output = run('test3', 'test4', '--chunk-size 1k --print --no-bin-log --verbose --function MD5');
$output = run('test3', 'test4', '--algorithms Nibble --chunk-size 1k --print --verbose --function MD5');
# If it lived, it's OK.
ok($output, 'Synced with Nibble and data-size chunksize');