~percona-toolkit-dev/percona-toolkit/fix-dl-ts-bug-1195034-2.1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
=pod

=head1 NAME

percona-toolkit - Advanced command-line tools used by Percona for MySQL support and consulting

=head1 DESCRIPTION

Percona Toolkit is a collection of advanced command-line tools used by
Percona (L<http://www.percona.com/>) support staff to perform a variety of
MySQL and system tasks that are too difficult or complex to perform manually.

These tools are ideal alternatives to private or "one-off" scripts because
they are professionally developed, formally tested, and fully documented.
They are also fully self-contained, so installation is quick and easy and
no libraries are installed. 

Percona Toolkit is derived from Maatkit and Aspersa, two of the best-known
toolkits for MySQL server administration.  It is developed and supported by
Percona.  For more information and other free, open-source software
developed by Percona, visit L<http://www.percona.com/software/>.

=head1 TOOLS

This release of Percona Toolkit includes the following tools:

=over

=item pt-align

Align output from other tools to columns.

=item pt-archiver

Archive rows from a MySQL table into another table or a file.

=item pt-config-diff

Diff MySQL configuration files and server variables.

=item pt-deadlock-logger

Extract and log MySQL deadlock information.

=item pt-diskstats

An interactive I/O monitoring tool for GNU/Linux.

=item pt-duplicate-key-checker

Find duplicate indexes and foreign keys on MySQL tables.

=item pt-fifo-split

Split files and pipe lines to a fifo without really splitting.

=item pt-find

Find MySQL tables and execute actions, like GNU find.

=item pt-fingerprint

Convert queries into fingerprints.

=item pt-fk-error-logger

Extract and log MySQL foreign key errors.

=item pt-heartbeat

Monitor MySQL replication delay.

=item pt-index-usage

Read queries from a log and analyze how they use indexes.

=item pt-ioprofile

Watch process IO and print a table of file and I/O activity.

=item pt-kill

Kill MySQL queries that match certain criteria.

=item pt-log-player

Replay MySQL query logs.

=item pt-mext

Look at many samples of MySQL C<SHOW GLOBAL STATUS> side-by-side.

=item pt-mysql-summary

Summarize MySQL information nicely.

=item pt-online-schema-change

ALTER tables without locking them.

=item pt-pmp

Aggregate GDB stack traces for a selected program.

=item pt-query-advisor

Analyze queries and advise on possible problems.

=item pt-query-digest

Analyze query execution logs and generate a query report, filter, replay, or transform queries for MySQL, PostgreSQL, memcached, and more.

=item pt-show-grants

Canonicalize and print MySQL grants so you can effectively replicate, compare and version-control them.

=item pt-sift

Browses files created by pt-stalk.

=item pt-slave-delay

Make a MySQL slave server lag behind its master.

=item pt-slave-find

Find and print replication hierarchy tree of MySQL slaves.

=item pt-slave-restart

Watch and restart MySQL replication after errors.

=item pt-stalk

Gather forensic data about MySQL when a problem occurs.

=item pt-summary

Summarize system information nicely.

=item pt-table-checksum

Verify MySQL replication integrity.

=item pt-table-sync

Synchronize MySQL table data efficiently.

=item pt-table-usage

Analyze how queries use tables.

=item pt-tcp-model

Transform tcpdump into metrics that permit performance and scalability modeling.

=item pt-trend

(DEPRECATED) Compute statistics over a set of time-series data points.

=item pt-upgrade

Execute queries on multiple servers and check for differences.

=item pt-variable-advisor

Analyze MySQL variables and advise on possible problems.

=item pt-visual-explain

Format EXPLAIN output as a tree.

=back

For more free, open-source software developed Percona, visit
L<http://www.percona.com/software/>.

=head1 CONFIGURATION FILES

Percona Toolkit tools can read options from configuration files.  The
configuration file syntax is simple and direct, and bears some resemblances
to the MySQL command-line client tools.  The configuration files all follow
the same conventions.

Internally, what actually happens is that the lines are read from the file and
then added as command-line options and arguments to the tool, so just
think of the configuration files as a way to write your command lines.

=head2 SYNTAX

The syntax of the configuration files is as follows:

=over

=item *

Whitespace followed by a hash sign (#) signifies that the rest of the line is a
comment.  This is deleted.  For example:

=item *

Whitespace is stripped from the beginning and end of all lines.

=item *

Empty lines are ignored.

=item *

Each line is permitted to be in either of the following formats:

  option
  option=value

Do not prefix the option with C<-->.  Do not quote the values, even if
it has spaces; value are literal.  Whitespace around the equals sign is
deleted during processing.

=item *

Only long options are recognized.

=item *

A line containing only two hyphens signals the end of option parsing.  Any
further lines are interpreted as additional arguments (not options) to the
program.

=back

=head2 EXAMPLE

This config file for pt-stalk,

  # Config for pt-stalk
  variable=Threads_connected
  cycles=2  # trigger if problem seen twice in a row
  --
  --user daniel

is equivalent to this command line:

  pt-stalk --variable Threads_connected --cycles 2 -- --user daniel

Options after C<--> are passed literally to mysql and mysqladmin.

=head2 READ ORDER

The tools read several configuration files in order:

=over

=item 1.

The global Percona Toolkit configuration file,
F</etc/percona-toolkit/percona-toolkit.conf>.  All tools read this file,
so you should only add options to it that you want to apply to all tools.

=item 2.

The global tool-specific configuration file, F</etc/percona-toolkit/TOOL.conf>,
where C<TOOL> is a tool name like C<pt-query-digest>.  This file is named
after the specific tool you're using, so you can add options that apply
only to that tool.

=item 3.

The user's own Percona Toolkit configuration file,
F<$HOME/.percona-toolkit.conf>.  All tools read this file, so you should only
add options to it that you want to apply to all tools.

=item 4.

The user's tool-specific configuration file, F<$HOME/.TOOL.conf>,
where C<TOOL> is a tool name like C<pt-query-digest>.  This file is named
after the specific tool you're using, so you can add options that apply
only to that tool.

=back

=head2 SPECIFYING

There is a special C<--config> option, which lets you specify which
configuration files Percona Toolkit should read.  You specify a
comma-separated list of files.  However, its behavior is not like other
command-line options.  It must be given B<first> on the command line,
before any other options.  If you try to specify it anywhere else, it will
cause an error.  Also, you cannot specify C<--config=/path/to/file>;
you must specify the option and the path to the file separated by whitespace
I<without an equal sign> between them, like:

  --config /path/to/file

If you don't want any configuration files at all, specify C<--config ''> to
provide an empty list of files.

=head1 DSN (DATA SOURCE NAME) SPECIFICATIONS

Percona Toolkit tools use DSNs to specify how to create a DBD connection to
a MySQL server.  A DSN is a comma-separated string of C<key=value> parts, like:

  h=host1,P=3306,u=bob

The standard key parts are shown below, but some tools add additional key
parts.  See each tool's documentation for details.

Some tools do not use DSNs but still connect to MySQL using options like
C<--host>, C<--user>, and C<--password>.  Such tools uses these options to
create a DSN automatically, behind the scenes.

Other tools uses both DSNs and options like the ones above.  The options
provide defaults for all DSNs that do not specify the option's corresponding
key part.  For example, if DSN C<h=host1> and option C<--port=12345> are
specified, then the tool automatically adds C<P=12345> to DSN.

=head2 ESCAPING VALUES

DSNs are usually specified on the command line, so shell quoting and escaping
must be taken into account.  Special characters, like asterisk (C<*>), need
to be quoted and/or escaped properly to be passed as literal characters in
DSN values.

Since DSN parts are separated by commas, literal commas in DSN values must
be escaped with a single backslash (C<\>).  And since a backslash is
the escape character for most shells, two backslashes are required to pass
a literal backslash.  For example, if the username is literally C<my,name>,
it must be specified as C<my\\,name> on most shells.  This applies to DSNs
and DSN-related options like C<--user>.

=head2 KEY PARTS

Many of the tools add more parts to DSNs for special purposes, and sometimes
override parts to make them do something slightly different.  However, all the
tools support at least the following:

=over

=item A

Specifies the default character set for the connection.

Enables character set settings in Perl and MySQL.  If the value is C<utf8>, sets
Perl's binmode on STDOUT to utf8, passes the C<mysql_enable_utf8> option to
DBD::mysql, and runs C<SET NAMES UTF8> after connecting to MySQL.  Any other
value sets binmode on STDOUT without the utf8 layer, and runs C<SET NAMES> after
connecting to MySQL.

Unfortunately, there is no way from within Perl itself to specify the client
library's character set.  C<SET NAMES> only affects the server; if the client
library's settings don't match, there could be problems.  You can use the
defaults file to specify the client library's character set, however.  See the
description of the F part below.

=item D

Specifies the connection's default database.

=item F

Specifies a defaults file the mysql client library (the C client library used by
DBD::mysql, I<not Percona Toolkit itself>) should read.  The tools all read the
[client] section within the defaults file.  If you omit this, the standard
defaults files will be read in the usual order.  "Standard" varies from system
to system, because the filenames to read are compiled into the client library.
On Debian systems, for example, it's usually /etc/mysql/my.cnf then ~/.my.cnf.
If you place the following into ~/.my.cnf, tools will Do The Right Thing:

  [client]
  user=your_user_name
  pass=secret

Omitting the F part is usually the right thing to do.  As long as you have
configured your ~/.my.cnf correctly, that will result in tools connecting
automatically without needing a username or password.

You can also specify a default character set in the defaults file.  Unlike the
L<"A"> part described above, this will actually instruct the client library
(DBD::mysql) to change the character set it uses internally, which cannot be
accomplished any other way as far as I know, except for C<utf8>.

=item h

Hostname or IP address for the connection.

=item p

Password to use when connecting.


=item P

Port number to use for the connection.  Note that the usual special-case
behaviors apply: if you specify C<localhost> as your hostname on Unix systems,
the connection actually uses a socket file, not a TCP/IP connection, and thus
ignores the port.

=item S

Socket file to use for the connection (on Unix systems).

=item u

User for login if not current user.

=back

=head2 BAREWORD

Many of the tools will let you specify a DSN as a single word, without any
C<key=value> syntax.  This is called a 'bareword'.  How this is handled is
tool-specific, but it is usually interpreted as the L<"h"> part.  The tool's
C<--help> output will tell you the behavior for that tool.

=head2 PROPAGATION

Many tools will let you propagate values from one DSN to the next, so you don't
have to specify all the parts for each DSN.  For example, if you want to specify
a username and password for each DSN, you can connect to three hosts as follows:

 h=host1,u=fred,p=wilma host2 host3

This is tool-specific.

=head1 ENVIRONMENT

The environment variable C<PTDEBUG> enables verbose debugging output to STDERR.
To enable debugging and capture all output to a file, run the tool like:

   PTDEBUG=1 pt-table-checksum ... > FILE 2>&1

Be careful: debugging output is voluminous and can generate several megabytes
of output.

=head1 SYSTEM REQUIREMENTS

Most tools require:

=over

=item * Perl v5.8 or newer

=item * Bash v3 or newer

=item * Core Perl modules like Time::HiRes

=back

Tools that connect to MySQL require:

=over

=item * Perl modules DBI and DBD::mysql

=item * MySQL 5.0 or newer

=back

Percona Toolkit is only tested on UNIX systems, primarily Debian and
Red Hat derivatives; other operating systems are not supported.

Tools that connect to MySQL may work with MySQL v4.1, but this is not
test or supported.

=head1 BUGS

Please report bugs at L<https://bugs.launchpad.net/percona-toolkit>.
Include the following information in your bug report:

=over

=item * Complete command-line used to run the tool

=item * Tool C<--version>

=item * MySQL version of all servers involved

=item * Output from the tool including STDERR

=item * Input files (log/dump/config files, etc.)

=back

If possible, include debugging output by running the tool with C<PTDEBUG>;
see L<"ENVIRONMENT">.

=head1 AUTHORS

=over

=item Baron Schwartz

Baron created Maatkit, from which Percona Toolkit was forked.  Many of
the tools and modules were originally written by Baron.

=item Daniel Nichter

Daniel began helping Baron with Maatkit and, later, Percona Toolkit in
June, 2008.  He is the project's lead developer, employed by Percona.

=item Brian Fraser

Brian started with Percona in December, 2011.  He works on Percona Toolkit
full-time, employed by Percona.

=item Others

Many people have contributed code over the years.  See each tool's
"AUTHORS" section for details.

=back

=head1 COPYRIGHT, LICENSE, AND WARRANTY

Percona Toolkit is copyright 2011-2013 Percona Ireland Ltd and others.
See each program's documentation for complete copyright notices.

THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, version 2; OR the Perl Artistic License.  On UNIX and similar
systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA  02111-1307  USA.

=head1 VERSION

Percona Toolkit v2.1.8 released 2012-12-21

=cut