From 272473348c38d26a082eeb90d14aafce253a17c8 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Fri, 17 Aug 2012 12:35:12 -0600 Subject: [PATCH] Remove _d from Percona::Toolkit because I can't get it to export correctly. Put Percona::Toolkit in most tools. --- bin/pt-archiver | 38 +++++++++++++++++++++- bin/pt-config-diff | 37 ++++++++++++++++++++- bin/pt-deadlock-logger | 35 +++++++++++++++++++- bin/pt-duplicate-key-checker | 41 ++++++++++++++++++++++-- bin/pt-find | 34 +++++++++++++++++++- bin/pt-fk-error-logger | 36 ++++++++++++++++++++- bin/pt-heartbeat | 38 +++++++++++++++++++++- bin/pt-index-usage | 52 ++++++++++++++++++++++++++++-- bin/pt-kill | 44 ++++++++++++++++++++++++- bin/pt-online-schema-change | 49 +++++++++++++++++++++++++++- bin/pt-query-advisor | 45 +++++++++++++++++++++++++- bin/pt-query-digest | 62 +++++++++++++++++++++++++++++++++++- bin/pt-slave-delay | 35 +++++++++++++++++++- bin/pt-slave-restart | 36 ++++++++++++++++++++- bin/pt-table-checksum | 54 ++++++++++++++++++++++++++++++- bin/pt-table-sync | 51 ++++++++++++++++++++++++++++- bin/pt-upgrade | 57 ++++++++++++++++++++++++++++++++- bin/pt-variable-advisor | 40 ++++++++++++++++++++++- lib/Percona/Toolkit.pm | 20 ------------ util/tool-header | 2 +- 20 files changed, 765 insertions(+), 41 deletions(-) diff --git a/bin/pt-archiver b/bin/pt-archiver index 70355b73..8ccd060d 100755 --- a/bin/pt-archiver +++ b/bin/pt-archiver @@ -6,7 +6,42 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Mo + TableParser + DSNParser + VersionParser + Quoter + TableNibbler + Daemon + MasterSlave + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -3815,6 +3850,7 @@ use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Quotekeys = 0; +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; # Global variables; as few as possible. diff --git a/bin/pt-config-diff b/bin/pt-config-diff index 51a0e13b..0108604f 100755 --- a/bin/pt-config-diff +++ b/bin/pt-config-diff @@ -6,7 +6,41 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + DSNParser + Cxn + Daemon + TextResultSetParser + MySQLConfig + MySQLConfigComparer + ReportFormatter + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -2917,6 +2951,7 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; $Data::Dumper::Quotekeys = 0; +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; sub main { diff --git a/bin/pt-deadlock-logger b/bin/pt-deadlock-logger index 3e385cd4..4c113cdd 100755 --- a/bin/pt-deadlock-logger +++ b/bin/pt-deadlock-logger @@ -6,7 +6,39 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Mo + VersionParser + Quoter + DSNParser + Daemon + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -2373,6 +2405,7 @@ use List::Util qw(max); use Socket qw(inet_aton); use sigtrap qw(handler finish untrapped normal-signals); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; my $o; diff --git a/bin/pt-duplicate-key-checker b/bin/pt-duplicate-key-checker index 3e0b9130..fce01ecc 100755 --- a/bin/pt-duplicate-key-checker +++ b/bin/pt-duplicate-key-checker @@ -6,7 +6,42 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + Quoter + TableParser + DSNParser + OptionParser + KeySize + DuplicateKeyFinder + Daemon + Schema + SchemaIterator + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # Quoter package @@ -3324,10 +3359,12 @@ package pt_duplicate_key_checker; use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); -use constant PTDEBUG => $ENV{PTDEBUG} || 0; use List::Util qw(max); +use Percona::Toolkit; +use constant PTDEBUG => $ENV{PTDEBUG} || 0; + $OUTPUT_AUTOFLUSH = 1; my $max_width = 74; diff --git a/bin/pt-find b/bin/pt-find index 6e35cbfe..8f2ff2b8 100755 --- a/bin/pt-find +++ b/bin/pt-find @@ -6,7 +6,38 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + DSNParser + OptionParser + Quoter + TableParser + Daemon + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # DSNParser package @@ -2170,6 +2201,7 @@ use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; $OUTPUT_AUTOFLUSH = 1; diff --git a/bin/pt-fk-error-logger b/bin/pt-fk-error-logger index 38763d54..5dd450e4 100755 --- a/bin/pt-fk-error-logger +++ b/bin/pt-fk-error-logger @@ -6,7 +6,38 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Quoter + DSNParser + Daemon + Transformers + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -2073,9 +2104,12 @@ sub _d { # ########################################################################### package pt_fk_error_logger; +use strict; +use warnings FATAL => 'all'; use English qw(-no_match_vars); use sigtrap qw(handler finish untrapped normal-signals); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; Transformers->import(qw(parse_timestamp)); diff --git a/bin/pt-heartbeat b/bin/pt-heartbeat index edc02a36..7518ff69 100755 --- a/bin/pt-heartbeat +++ b/bin/pt-heartbeat @@ -6,7 +6,40 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + MasterSlave + OptionParser + DSNParser + Daemon + Quoter + TableParser + Transformers + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # MasterSlave package @@ -3248,11 +3281,14 @@ sub _d { # ########################################################################### package pt_heartbeat; +use strict; +use warnings FATAL => 'all'; use English qw(-no_match_vars); use List::Util qw(min max sum); use Time::HiRes qw(gettimeofday time sleep usleep); use IO::File; +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; Transformers->import(qw(ts unix_timestamp)); diff --git a/bin/pt-index-usage b/bin/pt-index-usage index 188a8539..bc5950a9 100755 --- a/bin/pt-index-usage +++ b/bin/pt-index-usage @@ -6,7 +6,48 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + DSNParser + Quoter + OptionParser + PodParser + QueryParser + QueryRewriter + SlowLogParser + TableParser + Transformers + Schema + SchemaIterator + FileIterator + ExplainAnalyzer + IndexUsage + Progress + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # DSNParser package @@ -4823,11 +4864,14 @@ sub _d { # ########################################################################### package pt_index_usage; +use strict; +use warnings FATAL => 'all'; use English qw(-no_match_vars); use Data::Dumper; $Data::Dumper::Indent = 1; $OUTPUT_AUTOFLUSH = 1; +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; Transformers->import(qw(make_checksum)); @@ -4835,7 +4879,6 @@ Transformers->import(qw(make_checksum)); # Global variables. Only really essential variables should be here. my $oktorun = 1; -if ( !caller ) { exit main(@ARGV); } # Run the program. sub main { @ARGV = @_; # set global ARGV for this package @@ -5428,6 +5471,11 @@ sub _d { print STDERR "# $package:$line $PID ", join(' ', @_), "\n"; } +# ############################################################################ +# Run the program. +# ############################################################################ +if ( !caller ) { exit main(@ARGV); } + 1; # Because this is a module as well as a script. # ############################################################################# diff --git a/bin/pt-kill b/bin/pt-kill index 06df0bcb..c08d539a 100755 --- a/bin/pt-kill +++ b/bin/pt-kill @@ -6,7 +6,46 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Mo + DSNParser + Daemon + Transformers + TableParser + Processlist + TextResultSetParser + MasterSlave + Quoter + QueryRewriter + Retry + Cxn + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -4822,6 +4861,8 @@ sub _d { # ########################################################################### package pt_kill; +use strict; +use warnings FATAL => 'all'; use English qw(-no_match_vars); use POSIX qw(setsid); use List::Util qw(max); @@ -4833,6 +4874,7 @@ $Data::Dumper::Quotekeys = 0; Transformers->import(qw(ts)); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; $OUTPUT_AUTOFLUSH = 1; diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index bc5066a4..482cbeb2 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -6,7 +6,52 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Mo + VersionParser + DSNParser + Daemon + Quoter + TableNibbler + TableParser + Progress + Retry + Cxn + MasterSlave + ReplicaLagWaiter + MySQLStatusWaiter + WeightedAvgRate + NibbleIterator + Transformers + CleanupTask + IndexLength + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -5833,6 +5878,8 @@ package pt_online_schema_change; use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); + +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; use Time::HiRes qw(time sleep); diff --git a/bin/pt-query-advisor b/bin/pt-query-advisor index 2170103e..eab05e2f 100755 --- a/bin/pt-query-advisor +++ b/bin/pt-query-advisor @@ -6,7 +6,49 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + DSNParser + OptionParser + Quoter + SlowLogParser + GeneralLogParser + QueryParser + QueryRewriter + Transformers + Daemon + Advisor + AdvisorRules + QueryAdvisorRules + PodParser + SQLParser + TableParser + ReportFormatter + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # DSNParser package @@ -6014,6 +6056,7 @@ $Data::Dumper::Quotekeys = 0; Transformers->import(qw(make_checksum)); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; # Some rules report their match pos. This sets how many diff --git a/bin/pt-query-digest b/bin/pt-query-digest index 05ac90bd..b12d5c43 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -6,7 +6,66 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + DSNParser + Quoter + OptionParser + Transformers + QueryRewriter + Processlist + TcpdumpParser + MySQLProtocolParser + SysLogParser + PgLogParser + SlowLogParser + SlowLogWriter + EventAggregator + ReportFormatter + QueryReportFormatter + EventTimeline + QueryParser + TableParser + QueryReview + Daemon + MemcachedProtocolParser + MemcachedEvent + BinaryLogParser + GeneralLogParser + ProtocolParser + HTTPProtocolParser + ExecutionThrottler + MasterSlave + Progress + FileIterator + ExplainAnalyzer + Runtime + Pipeline + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # DSNParser package @@ -11848,6 +11907,7 @@ $OUTPUT_AUTOFLUSH = 1; Transformers->import(qw(shorten micro_t percentage_of ts make_checksum any_unix_timestamp parse_timestamp unix_timestamp crc32)); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; use sigtrap 'handler', \&sig_int, 'normal-signals'; diff --git a/bin/pt-slave-delay b/bin/pt-slave-delay index 3414e7d9..d7458065 100755 --- a/bin/pt-slave-delay +++ b/bin/pt-slave-delay @@ -6,7 +6,39 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Mo + DSNParser + Daemon + Transformers + Retry + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -2488,6 +2520,7 @@ use sigtrap qw(handler finish untrapped normal-signals); Transformers->import(qw(ts)); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; my $now; diff --git a/bin/pt-slave-restart b/bin/pt-slave-restart index f20ccb6f..eb6aa5bc 100755 --- a/bin/pt-slave-restart +++ b/bin/pt-slave-restart @@ -6,7 +6,40 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + Quoter + OptionParser + Mo + VersionParser + DSNParser + MasterSlave + Daemon + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # Quoter package @@ -3109,6 +3142,7 @@ use List::Util qw(min max); use Time::HiRes qw(sleep); use sigtrap qw(handler finish untrapped normal-signals); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; $OUTPUT_AUTOFLUSH = 1; diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 69eb8991..50b66604 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -6,7 +6,57 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + VersionCheck + HTTP::Micro + Pingback + DSNParser + OptionParser + Mo + Cxn + Quoter + VersionParser + TableParser + TableNibbler + MasterSlave + RowChecksum + NibbleIterator + OobNibbleIterator + Daemon + SchemaIterator + Retry + Transformers + Progress + ReplicaLagWaiter + MySQLStatusWaiter + WeightedAvgRate + IndexLength + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # VersionCheck package @@ -7623,6 +7673,8 @@ package pt_table_checksum; use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); + +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; use POSIX qw(signal_h); diff --git a/bin/pt-table-sync b/bin/pt-table-sync index c059d248..3d540449 100755 --- a/bin/pt-table-sync +++ b/bin/pt-table-sync @@ -6,7 +6,55 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Mo + Quoter + DSNParser + VersionParser + TableSyncStream + TableParser + RowDiff + MySQLDump + ChangeHandler + TableChunker + TableChecksum + TableSyncChunk + TableSyncNibble + TableSyncGroupBy + TableSyncer + TableNibbler + MasterSlave + Daemon + SchemaIterator + Transformers + Retry + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -8244,6 +8292,7 @@ use Data::Dumper; Transformers->import(qw(time_to_secs any_unix_timestamp)); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; $OUTPUT_AUTOFLUSH = 1; diff --git a/bin/pt-upgrade b/bin/pt-upgrade index e44e8360..d812f06c 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -6,7 +6,61 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + DSNParser + TableParser + Quoter + OptionParser + Transformers + SlowLogParser + EventAggregator + QueryParser + QueryRewriter + Daemon + ChangeHandler + RowDiff + TableChunker + TableNibbler + TableChecksum + TableSyncer + TableSyncChunk + TableSyncNibble + TableSyncGroupBy + Outfile + MockSyncStream + MockSth + ReportFormatter + UpgradeReportFormatter + CompareResults + CompareQueryTimes + CompareWarnings + Retry + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # DSNParser package @@ -10295,6 +10349,7 @@ $Data::Dumper::Quotekeys = 0; Transformers->import(qw(make_checksum)); +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; use sigtrap 'handler', \&sig_int, 'normal-signals'; diff --git a/bin/pt-variable-advisor b/bin/pt-variable-advisor index 5f1f00ad..3ca818fb 100755 --- a/bin/pt-variable-advisor +++ b/bin/pt-variable-advisor @@ -6,7 +6,43 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + Percona::Toolkit + OptionParser + Mo + DSNParser + VersionParser + Daemon + PodParser + TextResultSetParser + Advisor + AdvisorRules + VariableAdvisorRules + )); +} + +# ########################################################################### +# Percona::Toolkit package +# This package is a copy without comments from the original. The original +# with comments and its test file can be found in the Bazaar repository at, +# lib/Percona/Toolkit.pm +# t/lib/Percona/Toolkit.t +# See https://launchpad.net/percona-toolkit for more information. +# ########################################################################### +{ +package Percona::Toolkit; +our $VERSION = '2.1.3'; +1; +} +# ########################################################################### +# End Percona::Toolkit package +# ########################################################################### # ########################################################################### # OptionParser package @@ -3393,6 +3429,8 @@ package pt_variable_advisor; use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); + +use Percona::Toolkit; use constant PTDEBUG => $ENV{PTDEBUG} || 0; sub main { diff --git a/lib/Percona/Toolkit.pm b/lib/Percona/Toolkit.pm index d48e8319..0bff9695 100644 --- a/lib/Percona/Toolkit.pm +++ b/lib/Percona/Toolkit.pm @@ -19,27 +19,7 @@ # ########################################################################### { package Percona::Toolkit; - our $VERSION = '2.1.3'; - -use strict; -use warnings FATAL => 'all'; -use English qw(-no_match_vars); -use constant PTDEBUG => $ENV{PTDEBUG} || 0; - -require Exporter; -our @ISA = qw(Exporter); -our %EXPORT_TAGS = (); -our @EXPORT = (qw(_d)); - -sub _d { - my ($package, undef, $line) = caller 0; - @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; } - map { defined $_ ? $_ : 'undef' } - @_; - print STDERR "# $package:$line $PID ", join(' ', @_), "\n"; -} - 1; } # ########################################################################### diff --git a/util/tool-header b/util/tool-header index abd596ed..e2a25696 100755 --- a/util/tool-header +++ b/util/tool-header @@ -63,7 +63,7 @@ if ! grep -m 1 -q '^use ' $tool_file; then die "This only works for Perl tools" fi -echo "#!/usr/bin/env perl +echo "#!/usr/bin/env perl # This program is part of Percona Toolkit: http://www.percona.com/software/ # See \"COPYRIGHT, LICENSE, AND WARRANTY\" at the end of this file for legal