Merge pull request #60 from percona/pt-osc-recursion-method-error-lp1523685

pt-osc fixed recursion method dsn - lp1523685
This commit is contained in:
Frank Cizmich
2016-01-28 16:10:37 -03:00
5 changed files with 79 additions and 65 deletions
+21
View File
@@ -46,6 +46,7 @@ my $exit = 0;
my $sample = "t/pt-online-schema-change/samples";
my $rows;
# #############################################################################
# Tool shouldn't run without --execute (bug 933232).
# #############################################################################
@@ -798,6 +799,26 @@ test_alter_table(
],
);
# #############################################################################
# --recursion-method=dns (lp: 1523685)
# #############################################################################
$sb->load_file('master', "$sample/create_dsns.sql");
($output, $exit) = full_output(
sub { pt_online_schema_change::main(@args,
"$dsn,D=sakila,t=actor", ('--recursion-method=dsn=D=test_recursion_method,t=dsns,h=127.0.0.1,P=12345,u=msandbox,p=msandbox', '--alter-foreign-keys-method', 'drop_swap', '--execute', '--alter', 'ENGINE=InnoDB')) },
stderr => 1,
);
like(
$output,
qr/Found 2 slaves.*Successfully altered/si,
"--recursion-method=dns works"
);
$master_dbh->do("DROP DATABASE test_recursion_method");
# #############################################################################
# Done.
# #############################################################################
@@ -0,0 +1,13 @@
CREATE DATABASE IF NOT EXISTS test_recursion_method;
USE test_recursion_method;
DROP TABLE IF EXISTS `dsns`;
CREATE TABLE `dsns` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) DEFAULT NULL,
`dsn` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
INSERT INTO `dsns` VALUES (1, 12345, "D=test_recursion_method,t=dsns,P=12346,h=127.0.0.1,u=root,p=msandbox");
INSERT INTO `dsns` VALUES (2, 12345, "D=test_recursion_method,t=dsns,P=12347,h=127.0.0.1,u=root,p=msandbox");