MySQL记录慢日志administrator command: Binlog Dump GTID
慢日志记录了一条慢SQL:administrator command: Binlog Dump GTID
Query_time 有400多万秒
# Time: 2024-03-14T19:23:16.964646+08:00 # User@Host: greatdb[greatdb] @ [1.1.1.1] Id: 4635 # Schema: Last_errno: 1105 Killed: 0 # Query_time: 4288999.932890 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0 Rows_affected: 0 Bytes_sent: 169427783 SET timestamp=1706126397; # administrator command: Binlog Dump GTID;
Binlog Dump GTID 是一个后台线程执行的命令,主从复制时,主库上会起一个binlog dump线程,这个线程负责当主库上新的日志event时把日志dump出来通知从库来取,慢日志中记录下这一条记录是主从同步断开报错时,binlog dump线程子开始同步开始累计工作时长。
在主库上使用show processlist时会有一条记录, COMMAND 为 Binlog Dump GTID。
GreatDB Cluster[(none)]> select * from information_schema.processlist where user='greatdb'; +---------+---------+----------------------+------+------------------+--------+-----------------------------------------------------------------+-------------------------------------------------------------------+-----------+-----------+---------------+ | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | TIME_MS | ROWS_SENT | ROWS_EXAMINED | +---------+---------+----------------------+------+------------------+--------+-----------------------------------------------------------------+-------------------------------------------------------------------+-----------+-----------+---------------+ | 8043226 | greatdb | 127.0.0.1:15690 | NULL | Query | 0 | executing | select * from information_schema.processlist where user='greatdb' | 1 | 0 | 0 | | 7157149 | greatdb | 1.1.1.1:64954 | NULL | Binlog Dump GTID | 425292 | Source has sent all binlog to replica; waiting for more updates | NULL | 425292782 | 0 | 0 | +---------+---------+----------------------+------+------------------+--------+-----------------------------------------------------------------+-------------------------------------------------------------------+-----------+-----------+---------------+ 2 rows in set (0.00 sec)