mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-17 01:01:39 +08:00
pqd: Removed --table-access
This commit is contained in:
@@ -14242,14 +14242,6 @@ sub print_reports {
|
|||||||
$tls->[$i]->reset_aggregated_data();
|
$tls->[$i]->reset_aggregated_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $o->get('table-access') ) { # --table-access
|
|
||||||
print_table_access_report(
|
|
||||||
ea => $eas->[$i],
|
|
||||||
worst => $worst,
|
|
||||||
%args,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$eas->[$i]->reset_aggregated_data(); # Reset for next iteration.
|
$eas->[$i]->reset_aggregated_data(); # Reset for next iteration.
|
||||||
|
|
||||||
# Print header report only once. So remove it from the
|
# Print header report only once. So remove it from the
|
||||||
@@ -14435,54 +14427,6 @@ sub get_worst_queries {
|
|||||||
return $ea->top_events(%top_spec);
|
return $ea->top_events(%top_spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub print_table_access_report {
|
|
||||||
my ( %args ) = @_;
|
|
||||||
my @required_args = qw(ea worst QueryParser QueryRewriter OptionParser Quoter);
|
|
||||||
foreach my $arg ( @required_args ) {
|
|
||||||
die "I need a $arg argument" unless $args{$arg};
|
|
||||||
}
|
|
||||||
my ($ea, $worst, $qp, $qr, $o, $q) = @args{@required_args};
|
|
||||||
|
|
||||||
my %seen;
|
|
||||||
PTDEBUG && _d('Doing table access report');
|
|
||||||
|
|
||||||
foreach my $worst_info ( @$worst ) {
|
|
||||||
my $item = $worst_info->[0];
|
|
||||||
my $stats = $ea->results->{classes}->{$item};
|
|
||||||
my $sample = $ea->results->{samples}->{$item};
|
|
||||||
my $samp_query = $sample->{arg} || '';
|
|
||||||
my ($default_db) = $sample->{db} ? $sample->{db}
|
|
||||||
: $stats->{db}->{unq} ? keys %{$stats->{db}->{unq}}
|
|
||||||
: undef;
|
|
||||||
eval {
|
|
||||||
QUERY:
|
|
||||||
foreach my $query ( $qp->split($samp_query) ) {
|
|
||||||
my $rw = $qp->query_type($query, $qr)->{rw};
|
|
||||||
next QUERY unless $rw;
|
|
||||||
my @tables = $qp->extract_tables(
|
|
||||||
query => $query,
|
|
||||||
default_db => $default_db,
|
|
||||||
Quoter => $args{Quoter},
|
|
||||||
);
|
|
||||||
next QUERY unless scalar @tables;
|
|
||||||
DB_TBL:
|
|
||||||
foreach my $tbl_info ( @tables ) {
|
|
||||||
my ($db, $tbl) = @$tbl_info;
|
|
||||||
$db = $db ? "`$db`." : '';
|
|
||||||
next DB_TBL if $seen{"$db$tbl"}++; # Unique-ify for issue 337.
|
|
||||||
print "$rw $db`$tbl`\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if ( $EVAL_ERROR ) {
|
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
|
||||||
warn "Cannot get table access for query $_";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub update_query_review_tables {
|
sub update_query_review_tables {
|
||||||
my ( %args ) = @_;
|
my ( %args ) = @_;
|
||||||
foreach my $arg ( qw(ea worst QueryReview OptionParser) ) {
|
foreach my $arg ( qw(ea worst QueryReview OptionParser) ) {
|
||||||
@@ -16019,26 +15963,6 @@ short form: -S; type: string
|
|||||||
|
|
||||||
Socket file to use for connection.
|
Socket file to use for connection.
|
||||||
|
|
||||||
=item --table-access
|
|
||||||
|
|
||||||
Print a table access report.
|
|
||||||
|
|
||||||
The table access report shows which tables are accessed by all the queries
|
|
||||||
and if the access is a read or write. The report looks like:
|
|
||||||
|
|
||||||
write `baz`.`tbl`
|
|
||||||
read `baz`.`new_tbl`
|
|
||||||
write `baz`.`tbl3`
|
|
||||||
write `db6`.`tbl6`
|
|
||||||
|
|
||||||
If you pipe the output to L<sort>, the read and write tables will be grouped
|
|
||||||
together and sorted alphabetically:
|
|
||||||
|
|
||||||
read `baz`.`new_tbl`
|
|
||||||
write `baz`.`tbl`
|
|
||||||
write `baz`.`tbl3`
|
|
||||||
write `db6`.`tbl6`
|
|
||||||
|
|
||||||
=item --tcpdump-errors
|
=item --tcpdump-errors
|
||||||
|
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
read `db2`.`foo`
|
|
||||||
write `db`.`tbl`
|
|
||||||
read `db1`.`foo`
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
read `foo`
|
|
||||||
read `bar`
|
|
||||||
@@ -276,24 +276,6 @@ ok(
|
|||||||
'Distill UNLOCK and LOCK TABLES'
|
'Distill UNLOCK and LOCK TABLES'
|
||||||
);
|
);
|
||||||
|
|
||||||
# Test --table-access.
|
|
||||||
ok(
|
|
||||||
no_diff(
|
|
||||||
sub { pt_query_digest::main(@args, $sample.'slow020.txt', qw(--no-report --table-access)) },
|
|
||||||
"t/pt-query-digest/samples/slow020_table_access.txt",
|
|
||||||
),
|
|
||||||
'Analysis for slow020 with --table-access'
|
|
||||||
);
|
|
||||||
|
|
||||||
# This one tests that the list of tables is unique.
|
|
||||||
ok(
|
|
||||||
no_diff(
|
|
||||||
sub { pt_query_digest::main(@args, $sample.'slow030.txt', qw(--no-report --table-access)) },
|
|
||||||
"t/pt-query-digest/samples/slow030_table_access.txt"
|
|
||||||
),
|
|
||||||
'Analysis for slow030 with --table-access'
|
|
||||||
);
|
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
sub { pt_query_digest::main(@args, $sample.'slow034.txt', qw(--order-by Lock_time:sum),
|
sub { pt_query_digest::main(@args, $sample.'slow034.txt', qw(--order-by Lock_time:sum),
|
||||||
|
|||||||
Reference in New Issue
Block a user