Mysql 复制落后 Update_rows_log_event::ha_update_row(-1)

Mysql replication falling behind Update_rows_log_event::ha_update_row(-1)

我设法(在此处的一些帮助下)设置了从 MASTER 服务器 运行 mysql 5.6 (centos 6) 到从服务器 运行 Mariadb 10.1.22 ( Centos 7).

我现在的问题是,我有另一台服务器具有确切的 mariadb 版本和规格,但它的复制没有赶上,反而在增加。

启动时落后 48000 秒,几分钟后迅速下降到 46000 秒。之后,它正在稳步增加。 ATM写回差不多48K秒

Show full processlist; 显示 sql 线程最多花费 8 秒 运行 Update_rows_log_event::ha_update_row(-1) 背对背,我无法从所有 google 搜索中找到这是什么意思。

MariaDB [(none)]> show full processlist;
+-----+------------------+---------------------------------------+--------------+---------+------+------------------------------------------+-----------------------+----------+
| Id  | User             | Host                                  | db           | Command | Time | State                                    | Info                  | Progress |
+-----+------------------+---------------------------------------+--------------+---------+------+------------------------------------------+-----------------------+----------+
|   3 | system user      |                                       | NULL         | Connect | 3640 | Queueing master event to the relay log   | NULL                  |    0.000 |
|   2 | system user      |                                       | NULL         | Connect |    5 | Update_rows_log_event::ha_update_row(-1) | NULL                  |    0.000 |

我还发现一个简单的 UPDATE table SET timestamp = NOW() WHERE static_ip = 'a-valid-ip' AND process_id = '13217' 最多需要 6 秒,而 table 有 static_ip 和 process_id 列作为 PK,命令需要 0.078 秒直接执行。

/etc/my.cnf 的内容

[mysqld]
max_allowed_packet =  1G
max_connections = 600
thread_cache_size = 16
query_cache_size = 64M
tmp_table_size= 512M
max_heap_table_size= 512M
wait_timeout=60

#Innodb Settings
innodb_file_per_table=1
innodb_buffer_pool_size = 25G
innodb_log_file_size = 2048M
innodb_flush_log_at_trx_commit = 0
innodb_file_format = Barracuda
innodb_flush_neighbors = 0

#Log

log-error =/var/log/error.log
tmpdir = /dev/shm


#Replication SLAVE

server-id=6
slave-skip-errors=1062

my.cnf 与 运行 正常的服务器相同,除了 slave-id。

任何suggestions/help正在发生的事情?

谢谢。

在 mariadb 的帮助下,ha_update_rows 不相关,速度慢的原因是机器上的双磁盘故障。

[root@ser3 ~]# dd if=/dev/zero of=/tmp/output conv=fdatasync bs=384k count=1k;
1024+0 records in
1024+0 records out
402653184 bytes (403 MB) copied, 43.1096 s, 9.3 MB/s

这是固态硬盘。