mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-08 08:18:08 +00:00
Simplify and reword --statistics code, tests, and docs.
This commit is contained in:
@@ -637,36 +637,28 @@ test_alter_table(
|
||||
|
||||
$sb->load_file('master', "$sample/bug_1045317.sql");
|
||||
|
||||
($output, $exit) = full_output(
|
||||
sub { pt_online_schema_change::main(@args, "$dsn,D=bug_1045317,t=bits",
|
||||
'--dry-run', '--statistics', # We'll never get any statistics with --dry-run
|
||||
'--alter', "modify column val ENUM('M','E','H') NOT NULL") }
|
||||
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"
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/\#\Q No statistics for errors or warnings./,
|
||||
"--statistics works as expected with --dry-run"
|
||||
) or diag($output);
|
||||
|
||||
($output, $exit) = full_output(
|
||||
sub { pt_online_schema_change::main(@args, "$dsn,D=bug_1045317,t=bits",
|
||||
'--execute', '--statistics',
|
||||
'--alter', "modify column val ENUM('E','H') NOT NULL") }
|
||||
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"
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/\#\Q Event Count\E\s*
|
||||
\#\Q ========== =====\E\s*
|
||||
\#\Q INSERTS 1\E\s*
|
||||
\#\Q Error 1592 1\E\s*
|
||||
\#\Q Error 1265 1\E\s*/x,
|
||||
"--statistics works as expected with 1 ignore & 1 warning"
|
||||
);
|
||||
|
||||
$master_dbh->do(q{DROP DATABASE bug_1045317});
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
@@ -674,4 +666,3 @@ $master_dbh->do("UPDATE mysql.proc SET created='2012-06-05 00:00:00', modified='
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
||||
exit;
|
||||
|
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