pt-upgrade should have an option to ignore query times
Many times I find myself just needing to check if queries return different results. I don't care if the execution times are different. pt-upgrade is a great tool for processing a slow log and comparing two different MySQL hosts. But the reports are hard to read when 99% of the report is telling me query 1 executed 34x faster on one host vs another.
This patch adds a new flag, --ignore-
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- Matthew B
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
[percona@
--- /usr/bin/pt-upgrade 2014-02-20 19:11:00.000000000 +1100
+++ ./pt-upgrade 2015-12-24 09:13:48.311110892 +1100
@@ -9438,6 +9438,7 @@
read_only => $o->get(
progress => $o->get(
+ ignore_times => $o->get(
);
if ( $host1 && $host2 ) {
@@ -9703,6 +9704,7 @@
my $read_only = $args{read_only};
my $allowed_errors = $args{allowed_
my $progress = $args{progress};
+ my $ignore_times = $args{ignore_times} || 0;
# Get set up to execute and compare queries.
my $clear_warnings_sql = "SELECT * FROM $upgrade_table LIMIT 1 "
@@ -9767,6 +9769,7 @@
+ ignore_times => $ignore_times,
);
}
};
@@ -9911,6 +9914,7 @@
my $ignore_warnings = $args{ignore_
my $allowed_errors = $args{allowed_
my $progress = $args{progress};
+ my $ignore_times = $args{ignore_times} || 0;
my $clear_warnings_sql = "SELECT * FROM $upgrade_table LIMIT 1 "
@@ -9971,6 +9975,7 @@
+ ignore_times => $ignore_times,
);
}
};
@@ -10008,6 +10013,7 @@
# Optional args
my $ignore_warnings = $args{ignore_
+ my $ignore_times = $args{ignore_
if ( $results1->{error} && $results2->{error} ) {
PTDEBUG && _d('Failed query');
@@ -10029,10 +10035,13 @@
);
}
else {
- my $query_time_diffs = diff_query_times(
- query_time1 => $results1-
- query_time2 => $results2-
- );
+ my $query_time_diffs = 0;
+ if ( ! $ignore_times ) {
+ $query_time_diffs = diff_query_times(
+ query_time1 => $results1-
+ query_time2 => $results2-
+ );
+ }
my $warning_diffs = diff_warnings(
warnings1 => $results1-
@@ -10845,6 +10854,12 @@
Ignore these MySQL warning codes when comparing warnings.
+=item --ignore-
+
+When comparing the execution times of queries between hosts or between saved
+results and a host, ignore any query time differences. This is useful if
+you only care about seeing queries that produce difference results.
+
=item --log
type: string