mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-26 01:02:25 +08:00
Added tests for BUG-1595678 / pt-table-sync
This commit is contained in:
@@ -12463,6 +12463,22 @@ The tool will examine server B's copy of the table. If it looks like server B's
|
|||||||
data in table C<test.tbl1> is different from server A's copy, the tool will not
|
data in table C<test.tbl1> is different from server A's copy, the tool will not
|
||||||
sync that table on servers C and D.
|
sync that table on servers C and D.
|
||||||
|
|
||||||
|
=item --slave-user
|
||||||
|
|
||||||
|
type: string
|
||||||
|
|
||||||
|
Sets the user to be used to connect to the slaves.
|
||||||
|
This parameter allows you to have a different user with less privileges on the
|
||||||
|
slaves but that user must exist on all slaves.
|
||||||
|
|
||||||
|
=item --slave-password
|
||||||
|
|
||||||
|
type: string
|
||||||
|
|
||||||
|
Sets the password to be used to connect to the slaves.
|
||||||
|
It can be used with --slave-user and the password for the user must be the same
|
||||||
|
on all slaves.
|
||||||
|
|
||||||
=item --set-vars
|
=item --set-vars
|
||||||
|
|
||||||
type: Array
|
type: Array
|
||||||
|
|||||||
@@ -110,6 +110,25 @@ is_deeply(
|
|||||||
'Synced OK with Chunk'
|
'Synced OK with Chunk'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Create a new user that is going to be replicated on slaves.
|
||||||
|
# After that, stop replication, delete the user from the master just to ensure that
|
||||||
|
# on the master we are using the sandbox user, and start relication again to run
|
||||||
|
# the tests
|
||||||
|
$sb->do_as_root("master", q/GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'slave_password'/);
|
||||||
|
$sb->do_as_root("master", q/set sql_log_bin=0/);
|
||||||
|
$sb->do_as_root("master", q/DROP USER 'slave_user'/);
|
||||||
|
$sb->do_as_root("master", q/set sql_log_bin=1/);
|
||||||
|
|
||||||
|
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
|
||||||
|
$output = run('test1', 'test2', '--algorithms Chunk,GroupBy --no-bin-log --slave-user slave_user --slave-password slave_password');
|
||||||
|
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 --slave-user'
|
||||||
|
);
|
||||||
|
|
||||||
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
|
$sb->load_file('master', 't/pt-table-sync/samples/before.sql');
|
||||||
$output = run('test1', 'test2', '--algorithms Nibble --no-bin-log');
|
$output = run('test1', 'test2', '--algorithms Nibble --no-bin-log');
|
||||||
is($output, "INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('1', 'en');
|
is($output, "INSERT INTO `test`.`test2`(`a`, `b`) VALUES ('1', 'en');
|
||||||
|
|||||||
Reference in New Issue
Block a user