When restoring db from a snapshot I frequently see processes that can take 8+ minutes to complete in the state "waiting for handler commit". I read somewhere that this is when events are being written to the binary log but I have binary log disabled with disable_log_bin
.
I'm interested in trying to improve performance here but I first need to understand what is happening. Since the processes don't point to any specific query I am a bit in the dark. How can I find out what is actually happening when I see "waiting for handler commit"?
Here is an example of what I see when I run show processlist
:
+----+------------------+-----------+------+---------+------+----------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------------------+-----------+------+---------+------+----------------------------+------------------+
| 5 | event_scheduler | localhost | NULL | Daemon | 1272 | Waiting on empty queue | NULL |
| 9 | debian-sys-maint | localhost | NULL | Sleep | 39 | | NULL |
| 14 | root | localhost | NULL | Sleep | 1030 | | NULL |
| 16 | root | localhost | dev | Query | 53 | waiting for handler commit | COMMIT |
| 17 | root | localhost | dev | Sleep | 1030 | | NULL |
| 18 | root | localhost | dev | Sleep | 1030 | | NULL |
| 19 | root | localhost | dev | Sleep | 1030 | | NULL |
| 20 | root | localhost | dev | Sleep | 1030 | | NULL |
| 23 | root | localhost | dev | Query | 511 | waiting for handler commit | COMMIT |
| 25 | root | localhost | dev | Query | 467 | waiting for handler commit | COMMIT |
| 26 | root | localhost | dev | Query | 520 | waiting for handler commit | COMMIT |
| 27 | root | localhost | dev | Query | 520 | waiting for handler commit | COMMIT |
| 98 | root | localhost | NULL | Query | 0 | init | SHOW PROCESSLIST |
+----+------------------+-----------+------+---------+------+----------------------------+------------------+
replica_parallel_workers
had no effect.