mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-08-29 09:30:51 +00:00
Merge pull request #988 from percona/PT-2052_Tools_should_default_to_unbuffered_stdout_stderr
Pt 2052 tools should default to unbuffered stdout stderr
This commit is contained in:
11
bin/pt-align
11
bin/pt-align
@@ -528,6 +528,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -1266,6 +1270,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
=over
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --help
|
||||
|
||||
Show help and exit.
|
||||
|
@@ -1257,6 +1257,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -7769,6 +7773,13 @@ The danger is that a crash might cause lost data.
|
||||
The performance increase I have seen from using L<"--buffer"> is around 5 to 15
|
||||
percent. Your mileage may vary.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --bulk-delete
|
||||
|
||||
Delete each chunk with a single statement (implies L<"--commit-each">).
|
||||
|
@@ -1255,6 +1255,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -5738,6 +5742,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -605,6 +605,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -5336,6 +5340,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -601,6 +601,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -5474,6 +5478,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
=over
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --columns-regex
|
||||
|
||||
type: string; default: .
|
||||
|
@@ -1660,6 +1660,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -5451,6 +5455,13 @@ as a FULLTEXT index is not really a duplicate, for example.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -529,6 +529,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -1567,6 +1571,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
=over
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --config
|
||||
|
||||
type: Array
|
||||
|
11
bin/pt-find
11
bin/pt-find
@@ -1048,6 +1048,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -4562,6 +4566,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --case-insensitive
|
||||
|
||||
Specifies that all regular expression searches are case-insensitive.
|
||||
|
@@ -530,6 +530,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -2137,6 +2141,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
=over
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --config
|
||||
|
||||
type: Array
|
||||
|
@@ -600,6 +600,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -4459,6 +4463,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -1558,6 +1558,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -7102,6 +7106,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -1214,6 +1214,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -7200,6 +7204,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
11
bin/pt-kill
11
bin/pt-kill
@@ -610,6 +610,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -8005,6 +8009,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -667,6 +667,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -12923,6 +12927,13 @@ This is useful when you change large tables with keys that include a binary
|
||||
data type or that have non-standard character sets.
|
||||
See L<"--history"> and L<"--resume">.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --channel
|
||||
|
||||
type: string
|
||||
|
@@ -1882,6 +1882,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -15699,6 +15703,13 @@ values for attributes. If the attribute's value is bigger than this, the
|
||||
last-seen value for that class of query is used instead.
|
||||
Disabled by default.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -538,6 +538,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -4404,6 +4408,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -760,6 +760,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -5910,6 +5914,13 @@ pt-replica-restart will not let you stop the replica manually if you want to!
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -531,6 +531,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -2402,6 +2406,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -604,6 +604,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
|
@@ -2364,6 +2364,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -13306,6 +13310,13 @@ group: Connection
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --channel
|
||||
|
||||
type: string
|
||||
|
@@ -618,6 +618,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -12492,6 +12496,13 @@ For most non-trivial data sizes, you want to leave this option enabled.
|
||||
|
||||
This option is disabled when L<"--bidirectional"> is used.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --channel
|
||||
|
||||
type: string
|
||||
|
@@ -1650,6 +1650,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -8259,6 +8263,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -1879,6 +1879,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -11091,6 +11095,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -607,6 +607,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -6100,6 +6104,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -1217,6 +1217,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
@@ -3946,6 +3950,13 @@ L<"SYNOPSIS"> and usage information for details.
|
||||
|
||||
Prompt for a password when connecting to MySQL.
|
||||
|
||||
=item --[no]buffer-stdout
|
||||
|
||||
default: yes
|
||||
|
||||
Enables STDOUT buffering. Disable this option if you want to see live progress
|
||||
when using output post-processing tools such as C<tee> or C<kubectl logs>.
|
||||
|
||||
=item --charset
|
||||
|
||||
short form: -A; type: string
|
||||
|
@@ -668,6 +668,10 @@ sub get_opts {
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists $self->{opts}->{'buffer-stdout'} && $self->{opts}->{'buffer-stdout'}->{got} ) {
|
||||
STDOUT->autoflush(1 - $self->{opts}->{'buffer-stdout'}->{value});
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
$self->save_error("Unrecognized command-line options @ARGV");
|
||||
}
|
||||
|
112
t/pt-table-checksum/pt-2052.t
Normal file
112
t/pt-table-checksum/pt-2052.t
Normal file
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
BEGIN {
|
||||
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||
};
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More;
|
||||
use Time::Local;
|
||||
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
require "$trunk/bin/pt-table-checksum";
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila --buffer-stdout 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
|
||||
|
||||
my @lines = split(/\n/, $output);
|
||||
my @times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
|
||||
|
||||
is(
|
||||
scalar(@times),
|
||||
2,
|
||||
"Expected number of timestamp values"
|
||||
) or diag($output);
|
||||
|
||||
my ($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
|
||||
my $time_ts = timelocal($sec, $min, $hour, $day, $month);
|
||||
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
|
||||
my $time_tool = timelocal($sec, $min, $hour, $day, $month);
|
||||
|
||||
cmp_ok(
|
||||
$time_ts - $time_tool, 'gt', 1,
|
||||
"Print delay is expected for the buffered output"
|
||||
) or diag($output);
|
||||
|
||||
$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
|
||||
|
||||
@lines = split(/\n/, $output);
|
||||
@times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
|
||||
|
||||
is(
|
||||
scalar(@times),
|
||||
2,
|
||||
"Expected number of timestamp values"
|
||||
) or diag($output);
|
||||
|
||||
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
|
||||
$time_ts = timelocal($sec, $min, $hour, $day, $month);
|
||||
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
|
||||
$time_tool = timelocal($sec, $min, $hour, $day, $month);
|
||||
|
||||
cmp_ok(
|
||||
$time_ts - $time_tool, 'gt', 1,
|
||||
"STDOUT is buffered by default"
|
||||
) or diag($output);
|
||||
|
||||
$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila --no-buffer-stdout 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
|
||||
|
||||
@lines = split(/\n/, $output);
|
||||
@times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
|
||||
|
||||
is(
|
||||
scalar(@times),
|
||||
2,
|
||||
"Expected number of timestamp values"
|
||||
) or diag($output);
|
||||
|
||||
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
|
||||
$time_ts = timelocal($sec, $min, $hour, $day, $month);
|
||||
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
|
||||
$time_tool = timelocal($sec, $min, $hour, $day, $month);
|
||||
|
||||
cmp_ok(
|
||||
$time_ts - $time_tool, 'le', 1,
|
||||
"Print delay is not expected when buffering is disabled"
|
||||
) or diag($output);
|
||||
|
||||
$output = `$trunk/bin/pt-table-checksum h=127.1,P=12345,u=msandbox,p=msandbox --set-vars innodb_lock_wait_timeout=3 --chunk-size=50 -d sakila --nobuffer-stdout 2>&1 | tee | ts '%m-%dT%H:%M:%S'`;
|
||||
|
||||
@lines = split(/\n/, $output);
|
||||
@times = ( $lines[3] =~ m/\d\d-\d\dT\d\d:\d\d:\d\d/g );
|
||||
|
||||
is(
|
||||
scalar(@times),
|
||||
2,
|
||||
"Expected number of timestamp values"
|
||||
) or diag($output);
|
||||
|
||||
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[0]);
|
||||
$time_ts = timelocal($sec, $min, $hour, $day, $month);
|
||||
($month, $day, $hour, $min, $sec) = split(/[T:-]+/, $times[1]);
|
||||
$time_tool = timelocal($sec, $min, $hour, $day, $month);
|
||||
|
||||
cmp_ok(
|
||||
$time_ts - $time_tool, 'le', 1,
|
||||
"Test 2: Print delay is not expected when buffering is disabled"
|
||||
) or diag($output);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
Reference in New Issue
Block a user