Replace the last instances of MKDEBUG

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-06-05 12:28:36 -03:00
parent 6b93d51e43
commit 345a21a82e
22 changed files with 278 additions and 278 deletions

View File

@@ -59,10 +59,10 @@ Print more information.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=head1 VERSION

View File

@@ -106,10 +106,10 @@ other negatable.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=head1 SYSTEM REQUIREMENTS
@@ -128,7 +128,7 @@ support or report bugs: L<http://sourceforge.net/projects/maatkit/>.
Please include the complete command-line used to reproduce the problem you are
seeing, the version of all MySQL servers involved, the complete output of the
tool when run with L<"--version">, and if possible, debugging output produced by
running with the C<MKDEBUG=1> environment variable.
running with the C<PTDEBUG=1> environment variable.
=head1 COPYRIGHT, LICENSE AND WARRANTY

View File

@@ -14,10 +14,10 @@ etc.)--those are tested in pod_sample_02.txt.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=head1 SYSTEM REQUIREMENTS
@@ -36,7 +36,7 @@ support or report bugs: L<http://sourceforge.net/projects/maatkit/>.
Please include the complete command-line used to reproduce the problem you are
seeing, the version of all MySQL servers involved, the complete output of the
tool when run with L<"--version">, and if possible, debugging output produced by
running with the C<MKDEBUG=1> environment variable.
running with the C<PTDEBUG=1> environment variable.
=head1 COPYRIGHT, LICENSE AND WARRANTY

View File

@@ -20,10 +20,10 @@ etc.)--those are tested in pod_sample_02.txt.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=head1 SYSTEM REQUIREMENTS
@@ -42,7 +42,7 @@ support or report bugs: L<http://sourceforge.net/projects/maatkit/>.
Please include the complete command-line used to reproduce the problem you are
seeing, the version of all MySQL servers involved, the complete output of the
tool when run with L<"--version">, and if possible, debugging output produced by
running with the C<MKDEBUG=1> environment variable.
running with the C<PTDEBUG=1> environment variable.
=head1 COPYRIGHT, LICENSE AND WARRANTY

View File

@@ -30,10 +30,10 @@ This option also has a description.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=head1 SYSTEM REQUIREMENTS
@@ -52,7 +52,7 @@ support or report bugs: L<http://sourceforge.net/projects/maatkit/>.
Please include the complete command-line used to reproduce the problem you are
seeing, the version of all MySQL servers involved, the complete output of the
tool when run with L<"--version">, and if possible, debugging output produced by
running with the C<MKDEBUG=1> environment variable.
running with the C<PTDEBUG=1> environment variable.
=head1 COPYRIGHT, LICENSE AND WARRANTY

View File

@@ -18,9 +18,9 @@ New negatable bar.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=cut

View File

@@ -138,10 +138,10 @@ Print more information.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=head1 VERSION

View File

@@ -83,7 +83,7 @@ half second. Since the update happens as soon as possible after the beginning
of the second on the master, this allows one half second of replication delay
before reporting that the slave lags the master by one second. If your clocks
are not completely accurate or there is some other reason you'd like to delay
the slave more or less, you can tweak this value. Try setting the C<MKDEBUG>
the slave more or less, you can tweak this value. Try setting the C<PTDEBUG>
environment variable to see the effect this has.
=item --verbose
@@ -120,10 +120,10 @@ This item is not part of the main option list and should not be read.
=head1 ENVIRONMENT
The environment variable C<MKDEBUG> enables verbose debugging output in all of the
The environment variable C<PTDEBUG> enables verbose debugging output in all of the
Maatkit tools:
MKDEBUG=1 mk-....
PTDEBUG=1 mk-....
=head1 SYSTEM REQUIREMENTS
@@ -142,7 +142,7 @@ support or report bugs: L<http://sourceforge.net/projects/maatkit/>.
Please include the complete command-line used to reproduce the problem you are
seeing, the version of all MySQL servers involved, the complete output of the
tool when run with L<"--version">, and if possible, debugging output produced by
running with the C<MKDEBUG=1> environment variable.
running with the C<PTDEBUG=1> environment variable.
=head1 COPYRIGHT, LICENSE AND WARRANTY

View File

@@ -28,7 +28,7 @@ package bulk_regular_insert;
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG};
use constant PTDEBUG => $ENV{PTDEBUG};
# ###########################################################################
# Customize these values for your tables.
@@ -96,7 +96,7 @@ sub before_bulk_insert {
$sql .= join(", ", @vals);
$sql .= " /* mk-archiver bulk_regular_insert plugin */"; # trace
MKDEBUG && _d("Bulk regular insert:", $sql);
PTDEBUG && _d("Bulk regular insert:", $sql);
$dbh->do($sql);
return;
@@ -112,7 +112,7 @@ sub custom_sth_bulk {
# called with 1 bind variables when 0 are needed [for Statement "SELECT 1"]
# at mk-archiver line 4100.
my $sql = "SELECT ?";
MKDEBUG && _d("Custom sth bulk:", $sql);
PTDEBUG && _d("Custom sth bulk:", $sql);
my $sth = $dbh->prepare($sql);
return $sth;

View File

@@ -38,7 +38,7 @@ use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG} || 0;
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
use Data::Dumper;
$Data::Dumper::Indent = 1;
@@ -65,7 +65,7 @@ sub new {
my $db_tbl = $q->quote($args{db}, $args{tbl});
my $sql = "UPDATE $db_tbl SET `$compact_column`=? "
. "WHERE `$compact_column`=?";
MKDEBUG && _d('sth:', $sql);
PTDEBUG && _d('sth:', $sql);
if ( !$o->get('dry-run') ) {
$sth = $dbh->prepare($sql);
}
@@ -87,7 +87,7 @@ sub new {
sub before_begin {
my ( $self, %args ) = @_;
my $allcols = $args{allcols};
MKDEBUG && _d('allcols:', Dumper($allcols));
PTDEBUG && _d('allcols:', Dumper($allcols));
my $colpos = -1;
foreach my $col ( @$allcols ) {
$colpos++;
@@ -97,7 +97,7 @@ sub before_begin {
die "Column $compact_column not selected by mk-archiver: "
. join(', ', @$allcols);
}
MKDEBUG && _d('col pos:', $colpos);
PTDEBUG && _d('col pos:', $colpos);
$self->{col_pos} = $colpos;
return;
}
@@ -108,25 +108,25 @@ sub is_archivable {
my $row = $args{row};
my $val = $row->[$self->{col_pos}];
my $sth = $self->{sth};
MKDEBUG && _d('val:', $val);
PTDEBUG && _d('val:', $val);
if ( $next_val ){
if ( $val > $next_val ) {
MKDEBUG && _d('Updating', $val, 'to', $next_val);
PTDEBUG && _d('Updating', $val, 'to', $next_val);
$sth->execute($next_val, $val);
}
else {
MKDEBUG && _d('Val is OK');
PTDEBUG && _d('Val is OK');
}
}
else {
# This should happen once.
MKDEBUG && _d('First val:', $val);
PTDEBUG && _d('First val:', $val);
$self->{next_val} = $val;
}
$self->{next_val}++;
MKDEBUG && _d('Next val should be', $self->{next_val});
PTDEBUG && _d('Next val should be', $self->{next_val});
# No rows are archivable because we're exploiting mk-archiver
# just for its ability to nibble the table. To be safe, return 0
@@ -155,7 +155,7 @@ sub after_finish {
my $o = $self->{OptionParser};
my $sql = "ALTER TABLE $self->{db_tbl} AUTO_INCREMENT=$self->{next_val}";
if ( !$o->get('dry-run') ) {
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
$self->{dbh}->do($sql);
}
else {

View File

@@ -45,7 +45,7 @@ use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG};
use constant PTDEBUG => $ENV{PTDEBUG};
use Data::Dumper;
$Data::Dumper::Indent = 1;
@@ -79,7 +79,7 @@ sub new {
$other_table = $other_table_base . $id;
}
$other_table = $q->quote($other_db, $other_table);
MKDEBUG && _d('Other table:', $other_table);
PTDEBUG && _d('Other table:', $other_table);
my $self = {
dbh => $args{dbh},
@@ -100,7 +100,7 @@ sub new {
sub before_begin {
my ( $self, %args ) = @_;
my $allcols = $args{allcols};
MKDEBUG && _d('allcols:', Dumper($allcols));
PTDEBUG && _d('allcols:', Dumper($allcols));
my $colpos = -1;
foreach my $col ( @$allcols ) {
$colpos++;
@@ -110,7 +110,7 @@ sub before_begin {
die "Main table column $main_table_col not selected by mk-archiver: "
. join(', ', @$allcols);
}
MKDEBUG && _d('main col pos:', $colpos);
PTDEBUG && _d('main col pos:', $colpos);
$self->{main_col_pos} = $colpos;
return;
}
@@ -131,12 +131,12 @@ sub before_delete {
my $sql = "DELETE FROM $self->{other_tbl} "
. "WHERE $other_table_col=$val";
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
eval {
$dbh->do($sql);
};
if ( $EVAL_ERROR ) {
MKDEBUG && _d($EVAL_ERROR);
PTDEBUG && _d($EVAL_ERROR);
warn $EVAL_ERROR;
}
@@ -159,12 +159,12 @@ sub before_bulk_delete {
my $sql = "DELETE FROM $self->{other_tbl} "
. "WHERE $other_table_col IN ($delete_rows) ";
# . "LIMIT $self->{limit}";
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
eval {
$dbh->do($sql);
};
if ( $EVAL_ERROR ) {
MKDEBUG && _d($EVAL_ERROR);
PTDEBUG && _d($EVAL_ERROR);
warn $EVAL_ERROR;
}

View File

@@ -2,7 +2,7 @@ package gt_n;
use strict;
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG};
use constant PTDEBUG => $ENV{PTDEBUG};
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
@@ -18,7 +18,7 @@ sub new {
my ( $class, %args ) = @_;
my $sql = "SELECT COUNT(*) FROM $args{db}.$args{tbl} WHERE " . WHERE;
MKDEBUG && _d('Row count sql:', $sql);
PTDEBUG && _d('Row count sql:', $sql);
my $sth = $args{dbh}->prepare($sql);
my $self = {
@@ -35,30 +35,30 @@ sub get_row_count {
my $sth = $self->{row_count_sth};
$sth->execute();
my @row = $sth->fetchrow_array();
MKDEBUG && _d('Row count:', $row[0]);
PTDEBUG && _d('Row count:', $row[0]);
$sth->finish();
return $row[0];
}
sub before_begin {
my ( $self, %args ) = @_;
MKDEBUG && _d('before begin');
PTDEBUG && _d('before begin');
# We don't need to do anything here.
return;
}
sub is_archivable {
my ( $self, %args ) = @_;
MKDEBUG && _d('is archivable');
PTDEBUG && _d('is archivable');
if ( $self->{done} ) {
MKDEBUG && _d("Already done, skipping row count");
PTDEBUG && _d("Already done, skipping row count");
return 0;
}
my $n_rows = $self->get_row_count();
if ( $n_rows <= MAX_ROWS ) {
MKDEBUG && _d('Done archiving, row count <', MAX_ROWS,
PTDEBUG && _d('Done archiving, row count <', MAX_ROWS,
'; first non-archived row:', Dumper($args{row}));
$self->{done} = 1;
return 0;
@@ -75,7 +75,7 @@ sub before_delete {
sub after_finish {
my ( $self ) = @_;
MKDEBUG && _d('after finish');
PTDEBUG && _d('after finish');
# Just to show in debug output how many rows are left at the end.
my $n_rows = $self->get_row_count();
return;

View File

@@ -47,7 +47,7 @@ package res_fk;
use strict;
use English qw(-no_match_vars);
use constant MKDEBUG => $ENV{MKDEBUG};
use constant PTDEBUG => $ENV{PTDEBUG};
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
@@ -63,26 +63,26 @@ sub new {
my $sql = "INSERT INTO $dst_db.`user` "
. "SELECT * FROM $src_db.`user` "
. 'WHERE comp_id=?';
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
my $archive_users_sth = $dbh->prepare($sql);
$sql = "DELETE FROM $src_db.`user` WHERE comp_id=?";
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
my $delete_users_sth = $dbh->prepare($sql);
# Prepare statements for prod table.
$sql = "INSERT INTO $dst_db.`prod` "
. "SELECT * FROM $src_db.`prod` "
. 'WHERE comp_id=?';
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
my $archive_prods_sth = $dbh->prepare($sql);
$sql = "SELECT DISTINCT `id` FROM $src_db.`prod` WHERE comp_id=?";
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
my $get_prods_sth = $dbh->prepare($sql);
$sql = "DELETE FROM $src_db.`prod` WHERE comp_id=?";
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
my $delete_prods_sth = $dbh->prepare($sql);
my $self = {
@@ -129,13 +129,13 @@ sub is_archivable {
# tables with INSERT SELECT ($archive_*_sth).
sub before_delete {
my ( $self, %args ) = @_;
MKDEBUG && _d('before delete');
PTDEBUG && _d('before delete');
my $dbh = $self->{dbh};
my $src_db = $self->{src_db};
my $dst_db = $self->{dst_db};
my $comp_id = $args{row}->[0]; # id is first column
my $sql;
MKDEBUG && _d('row:', Dumper($args{row}));
PTDEBUG && _d('row:', Dumper($args{row}));
# Archive rows from prod then user, in that order because
# user referenes prod.
@@ -149,11 +149,11 @@ sub before_delete {
$self->{get_prods_sth}->execute($comp_id);
my $prod_ids = $self->{get_prods_sth}->fetchall_arrayref();
my $all_prod_ids = join(',', map { $_->[0]; } @$prod_ids);
MKDEBUG && _d('prod ids:', $all_prod_ids);
PTDEBUG && _d('prod ids:', $all_prod_ids);
my $sql = "INSERT INTO $dst_db.`prod_details` "
. "SELECT * FROM $src_db.`prod_details` "
. "WHERE prod_id IN ($all_prod_ids)";
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
$dbh->do($sql);
# Now we can delete the rows from user, prod_details then prod
@@ -161,7 +161,7 @@ sub before_delete {
$self->{delete_users_sth}->execute($comp_id);
$sql = "DELETE FROM $src_db.`prod_details` "
. "WHERE prod_id IN ($all_prod_ids)";
MKDEBUG && _d($sql);
PTDEBUG && _d($sql);
$dbh->do($sql);
$self->{delete_prods_sth}->execute($comp_id);

View File

@@ -49,7 +49,7 @@ $cmd = "$trunk/bin/pt-query-digest "
$ENV{PTDEBUG}=1;
`$cmd > /tmp/read_only.txt 2>&1 &`;
$ENV{MKDEBUG}=0;
$ENV{PTDEBUG}=0;
sleep 3;
$dbh1->do('select sleep(1)');

View File

@@ -5,7 +5,7 @@ if ( $event->{ts} ) {
($year, $month, $day, $hour)
= $event->{ts} =~ /^(\d\d)(\d\d)(\d\d)\s+(\d\d):/;
}
MKDEBUG && _d('ymdh:', $year, $month, $day, $hour);
PTDEBUG && _d('ymdh:', $year, $month, $day, $hour);
$event->{year} = $year || 0;
$event->{month} = $month || 0;
$event->{day} = $day || 0;
@@ -16,7 +16,7 @@ $event->{hour} = $hour || 24; # 0 is a valid hour
my $ok = 1;
foreach my $filter ( qw(YEAR MONTH HOUR DAY) ) {
if ( $ENV{$filter} && $event->{lc $filter} != $ENV{$filter} ) {
MKDEBUG && _d('Event does not match', $filter, '=', $ENV{$filter});
PTDEBUG && _d('Event does not match', $filter, '=', $ENV{$filter});
$ok = 0;
last;
}