Redesign pt-mysql-summary

Registered by Baron Schwartz

1. Use mktemp, and separate the collection and reporting

Use mktemp to create a temporary directory. Write all samples of output into this directory, and separate the collect and report steps of the tool. The collect stage should simply fill the directory with files, and the report stage should just look at the directory and format a report from it. Make these into separate functions so they can be executed separately. Write tests for the report portion of it. Remove the temporary directory at the end of execution, unless the --tempdir option is given, in which case, the tool should fill the directory with collected data, report, and then save the temporary directory.

2. Report mysqld's OS-level tuning parameters

Find the oom_adj and niceness values of mysqld, and report these.

3. Make the tool use long-form command-line options

The tool should accept the standard options:

   --sleep how long to sleep for generating "mext" output (default 10s)
   --tempdir (no default)

4. New things to report


a) semisync replication is enabled and in use (

b) mysqld binary has symbol (i.e. was not stripped); this helps debuggers (requested by Peter)

c) InnoDB compression is used (requested by Peter)

d) Prepared_stmt_count (requested by Peter), used to detect systems which "leak" prepared statements, i.e. which have very high Prepared_stmt_count:

mysql> show global status like "%stmt%";
| Variable_name | Value |
| Com_stmt_close | 5989956 |
| Com_stmt_execute | 5989968 |
| Com_stmt_fetch | 0 |
| Com_stmt_prepare | 5990057 |
| Com_stmt_reprepare | 0 |
| Com_stmt_reset | 4011311 |
| Com_stmt_send_long_data | 0 |
| Prepared_stmt_count | 0 |


5. Don't use hardcoded filenames

Rewrite the functions to take a filename as an argument, instead of assuming the input will be in $TMPDIR/foo. This will make it much easier to test.

6. Factor out commonly useful functions into Bash modules.

I think we have a lot of code that should be factored out into modules for reuse. The code that formats the status-variable differences, for example, can probably be reused for pt-mext somehow.

Blueprint information

Baron Schwartz
Baron Schwartz
Needs approval
Brian Fraser
Series goal:
Accepted for 2.1
Milestone target:
milestone icon 2.1.1
Started by
Brian Fraser
Completed by
Daniel Nichter



1. Done. Also, currently it's pretty much set up to have --prefix option ala pt-stalk. Is that worth adding?
  Yes, this is a good idea. - Baron

2. Done.

3. Done, but also added a new option, --dump-schemas, since that allows to test the mysqldump portion more easily, and more cleanly separate the collection and gathering. Not sure if that's worth keeping.
  Yes, keep it. - Baron

a) Done.
b) Done, but not sure where to report this, so right now it's at nearly the top of the program.
c) Done.
d) Done.

5. Done.

6. Mostly done. Wrinkles being ironed out in pt-summary.


Work Items

This blueprint contains Public information 
Everyone can see this information.


No subscribers.