mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-08 08:18:08 +00:00
Merge fix-1045317-pt-osc-statistics
This commit is contained in:
@@ -32,9 +32,6 @@ if ( !$master_dbh ) {
|
||||
elsif ( !$slave_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave';
|
||||
}
|
||||
else {
|
||||
plan tests => 119;
|
||||
}
|
||||
|
||||
my $q = new Quoter();
|
||||
my $tp = new TableParser(Quoter => $q);
|
||||
@@ -634,10 +631,38 @@ test_alter_table(
|
||||
qw(--no-drop-new-table)],
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# --statistics
|
||||
# #############################################################################
|
||||
|
||||
$sb->load_file('master', "$sample/bug_1045317.sql");
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_online_schema_change::main(@args, "$dsn,D=bug_1045317,t=bits",
|
||||
'--dry-run', '--statistics',
|
||||
'--alter', "modify column val ENUM('M','E','H') NOT NULL")
|
||||
},
|
||||
"$sample/stats-dry-run.txt",
|
||||
),
|
||||
"--statistics --dry-run"
|
||||
);
|
||||
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_online_schema_change::main(@args, "$dsn,D=bug_1045317,t=bits",
|
||||
'--execute', '--statistics',
|
||||
'--alter', "modify column val ENUM('M','E','H') NOT NULL")
|
||||
},
|
||||
"$sample/stats-execute.txt",
|
||||
),
|
||||
"--statistics --execute"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$master_dbh->do("UPDATE mysql.proc SET created='2012-06-05 00:00:00', modified='2012-06-05 00:00:00'");
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
done_testing;
|
||||
|
@@ -51,6 +51,12 @@ like(
|
||||
"--execute FALSE by default"
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/--statistics\s+FALSE/,
|
||||
"--statistics is FALSE by default"
|
||||
);
|
||||
|
||||
$output = `$cmd h=127.1,P=12345,u=msandbox,p=msandbox --alter-foreign-keys-method drop_swap --no-drop-new-table`;
|
||||
like(
|
||||
$output,
|
||||
|
10
t/pt-online-schema-change/samples/bug_1045317.sql
Normal file
10
t/pt-online-schema-change/samples/bug_1045317.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
DROP DATABASE IF EXISTS bug_1045317;
|
||||
CREATE DATABASE bug_1045317;
|
||||
USE bug_1045317;
|
||||
CREATE TABLE `bits` (
|
||||
`id` int,
|
||||
`val` ENUM('M','E','H') NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
INSERT INTO `bits` VALUES (1, 'M'), (2, 'E'), (3, 'H');
|
16
t/pt-online-schema-change/samples/stats-dry-run.txt
Normal file
16
t/pt-online-schema-change/samples/stats-dry-run.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Starting a dry run. `bug_1045317`.`bits` will not be altered. Specify --execute instead of --dry-run to alter the table.
|
||||
Not dropping triggers because this is a dry run.
|
||||
Dropping new table...
|
||||
Dropped new table OK.
|
||||
Dry run complete. `bug_1045317`.`bits` was not altered.
|
||||
Creating new table...
|
||||
Created new table bug_1045317._bits_new OK.
|
||||
Altering new table...
|
||||
Altered `bug_1045317`.`_bits_new` OK.
|
||||
Not creating triggers because this is a dry run.
|
||||
Not copying rows because this is a dry run.
|
||||
Not swapping tables because this is a dry run.
|
||||
Not dropping old table because this is a dry run.
|
||||
# Event Count
|
||||
# ====== =====
|
||||
# INSERT 0
|
19
t/pt-online-schema-change/samples/stats-execute.txt
Normal file
19
t/pt-online-schema-change/samples/stats-execute.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Altering `bug_1045317`.`bits`...
|
||||
Dropping triggers...
|
||||
Dropped triggers OK.
|
||||
Successfully altered `bug_1045317`.`bits`.
|
||||
Creating new table...
|
||||
Created new table bug_1045317._bits_new OK.
|
||||
Altering new table...
|
||||
Altered `bug_1045317`.`_bits_new` OK.
|
||||
Creating triggers...
|
||||
Created triggers OK.
|
||||
Copying approximately 3 rows...
|
||||
Copied rows OK.
|
||||
Swapping tables...
|
||||
Swapped original and new tables OK.
|
||||
Dropping old table...
|
||||
Dropped old table `bug_1045317`.`_bits_old` OK.
|
||||
# Event Count
|
||||
# ====== =====
|
||||
# INSERT 1
|
Reference in New Issue
Block a user