Bug #83024 Internals manual does not explain COM_SLEEP in details
Description:
Take a look at https://dev.mysql.com/doc/internals/en/com-sleep.html. This page is useless, it does not explain when server uses this command.
In reality it is used in different places:
openxs@ao756:~/git/mysql-server$ grep -rn COM_SLEEP *
include/mysql/plugin_audit.h.pp:130: COM_SLEEP,
include/mysql.h.pp:35: COM_SLEEP,
include/my_command.h:30: COM_SLEEP,
libmysqld/lib_sql.cc:752: thd->set_command(COM_SLEEP);
sql/sql_connect.cc:825: thd->set_command(COM_SLEEP);
sql/protocol_classic.cc:1391: /* Initialize with COM_SLEEP packet */
sql/protocol_classic.cc:1392: raw_packet[0]= (uchar) COM_SLEEP;
sql/sql_show.cc:2085: else if (tmp->get_command() == COM_SLEEP)
sql/sql_parse.cc:261: server_command_flags[COM_SLEEP]= CF_ALLOW_PROTOCOL_PLUGIN;
sql/sql_parse.cc:1857: case COM_SLEEP:
sql/sql_parse.cc:1900: thd->set_command(COM_SLEEP);
sql/sql_audit.cc:746: command == COM_SLEEP || /* Deprecated commands from here. */
sql/srv_session.cc:920: thd.set_command(COM_SLEEP);
openxs@ao756:~/git/mysql-server$
(this is from current 8.0 code)
It would be nice to explain when exactly it is used and why one may find entries like these:
SET timestamp=1473712798;
# administrator command: Sleep;
# Time: 160912 20:39:59
# User@Host: user[host] @ [192.168.1.51]
# Thread_id: 36310042 Schema: somedb QC_hit: No
# Query_time: 17.201526 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
in the slow log.
How to repeat:
Try to explain what does this entry mean in the slow query log:
SET timestamp=1473712798;
# administrator command: Sleep;
# Time: 160912 20:39:59
# User@Host: user[host] @ [192.168.1.51]
# Thread_id: 36310042 Schema: somedb QC_hit: No
# Query_time: 17.201526 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
Why Sleep took time, was it a problem, why this was logged as slow query etc
Suggested fix:
Document all cases of COM-SLEEP use in the server code in internal manual.
Explain in the manual for slow query log what entries like this:
SET timestamp=1473712798;
# administrator command: Sleep;
# Time: 160912 20:39:59
# User@Host: user[host] @ [192.168.1.51]
# Thread_id: 36310042 Schema: somedb QC_hit: No
# Query_time: 17.201526 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
mean.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.