Bug #69927 Document all protocol commands
Submitted: 5 Aug 2013 18:05
Reporter: Todd Farmer (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.6.13 OS:Any
Assigned to: Paul Dubois CPU Architecture:Any

[5 Aug 2013 18:05] Todd Farmer
Description:
The protocol documentation lists 19 commands here:

http://dev.mysql.com/doc/internals/en/text-protocol.html

There are 32 corresponding PERFORMANCE_SCHEMA event counters:

mysql> SELECT event_name, count_star, sum_errors
    -> FROM events_statements_summary_global_by_event_name
    -> WHERE event_name LIKE 'statement/com/%';
+--------------------------------+------------+------------+
| event_name                     | count_star | sum_errors |
+--------------------------------+------------+------------+
| statement/com/Sleep            |         19 |         19 |
| statement/com/Quit             |        609 |          0 |
| statement/com/Init DB          |          2 |          0 |
| statement/com/Query            |          0 |          0 |
| statement/com/Field List       |         13 |         13 |
| statement/com/Create DB        |          1 |          1 |
| statement/com/Drop DB          |          1 |          1 |
| statement/com/Refresh          |         13 |          0 |
| statement/com/Shutdown         |          0 |          0 |
| statement/com/Statistics       |         13 |          0 |
| statement/com/Processlist      |         16 |          0 |
| statement/com/Connect          |         13 |         13 |
| statement/com/Kill             |          1 |          0 |
| statement/com/Debug            |         14 |          0 |
| statement/com/Ping             |       1934 |          0 |
| statement/com/Time             |         13 |         13 |
| statement/com/Delayed insert   |         13 |         13 |
| statement/com/Change user      |         12 |         12 |
| statement/com/Binlog Dump      |         12 |         12 |
| statement/com/Table Dump       |         12 |         12 |
| statement/com/Connect Out      |         12 |         12 |
| statement/com/Register Slave   |         12 |         12 |
| statement/com/Prepare          |          0 |          0 |
| statement/com/Execute          |         11 |         11 |
| statement/com/Long Data        |          9 |          0 |
| statement/com/Close stmt       |          1 |          0 |
| statement/com/Reset stmt       |          2 |          2 |
| statement/com/Set option       |          2 |          0 |
| statement/com/Fetch            |          2 |          2 |
| statement/com/Daemon           |          3 |          3 |
| statement/com/Binlog Dump GTID |          2 |          2 |
| statement/com/Error            |        448 |        448 |
| statement/com/                 |          0 |          0 |
+--------------------------------+------------+------------+
33 rows in set (0.00 sec)

Please document those missing.

How to repeat:
See above.

Suggested fix:
Based on testing, the P_S counters appear to be incremented as follows:

0x12 - statement/com/Binlog Dump
0x13 - statement/com/Table Dump
0x14 - statement/com/Connect Out
0x15 - statement/com/Register Slave
0x16 - statement/com/Prepare
0x17 - statement/com/Execute
0x18 - statement/com/Long Data
0x19 - statement/com/Close stmt
0x1a - statement/com/Reset stmt
0x1b - statement/com/Set option
0x1c - statement/com/Fetch
0x1f - statement/com/Binlog Dump GTID

statement/com/Error seems to be incremented for protocol command values greater than 0x1e, except the following:

* 0x75
* 0xa8
* 0xda

I can't immediately explain the behavior of those three values.
[25 Nov 2013 18:07] Paul Dubois
Todd, it looks like the other commands are documented in the following sections, such as:
http://dev.mysql.com/doc/internals/en/prepared-statements.html

Probably we could use a pointer in
http://dev.mysql.com/doc/internals/en/text-protocol.html
that additional commands are found in the following sections.