mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-19 01:09:21 +08:00
Add failing test case.
This commit is contained in:
@@ -193,6 +193,26 @@ is_deeply(
|
|||||||
|
|
||||||
$master_dbh->do(q{DROP DATABASE IF EXISTS `bug_1041372`});
|
$master_dbh->do(q{DROP DATABASE IF EXISTS `bug_1041372`});
|
||||||
|
|
||||||
|
# ############################################################################
|
||||||
|
# https://bugs.launchpad.net/percona-toolkit/+bug/1068562
|
||||||
|
# pt-online-schema-change loses data when renaming columns
|
||||||
|
# ############################################################################
|
||||||
|
$sb->load_file('master', "$sample/data-loss-bug-1068562.sql");
|
||||||
|
|
||||||
|
($output, $exit_status) = full_output(
|
||||||
|
sub { pt_online_schema_change::main(@args,
|
||||||
|
"$master_dsn,D=bug1068562,t=simon",
|
||||||
|
"--alter", "change old_column_name new_column_name varchar(255) NULL",
|
||||||
|
qw(--execute)) },
|
||||||
|
);
|
||||||
|
|
||||||
|
my $rows = $master_dbh->selectall_arrayref("SELECT * FROM bug1068562.simon ORDER BY id");
|
||||||
|
is_deeply(
|
||||||
|
$rows,
|
||||||
|
[ [qw(1 a)], [qw(2 b)], [qw(3 c)] ],
|
||||||
|
"Bug 1068562: no data lost"
|
||||||
|
) or diag(Dumper($rows));
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|||||||
11
t/pt-online-schema-change/samples/data-loss-bug-1068562.sql
Normal file
11
t/pt-online-schema-change/samples/data-loss-bug-1068562.sql
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
drop database if exists bug1068562;
|
||||||
|
create database bug1068562;
|
||||||
|
use bug1068562;
|
||||||
|
|
||||||
|
CREATE TABLE `simon` (
|
||||||
|
`id` int(11) NOT NULL,
|
||||||
|
`old_column_name` varchar(255) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
insert into simon values (1,'a'),(2,'b'),(3,'c');
|
||||||
Reference in New Issue
Block a user