xtrabackup 备份从库报错,原因是uper_read_only =ON

发布时间 2023-06-15 16:39:01作者: igoodful

########################

MySQL版本:8.0.26

xtrabackup 备份从库报错,官方bug:https://bugs.mysql.com/bug.php?id=104573

问题描述:

xtrabackup报错

Undo tablespace number 1 was being truncated when mysqld quit.
Cannot recover a truncated undo tablespace in read-only mode
xtrabackup: error: xb_load_tablespaces() failed with error code 57

 

问题排查:

查看备份节点数据目录,发现在其目录下均存在undo_1_trunc.log文件。两个集群从库情况基本一致,均存在undo_1_trunc.log文件。
undo_1_trunc.log文件为undo表空间truncate 时创建的临时文件,用作记录truncate操作的日志文件,truncate操作完成后自动删除,但undo_1_trunc.log文件一直存在,说明truncate操作一直在进行中,且文件日期比较早,说明truncate操作夯住的时间比较长。
查阅官方bug信息https://bugs.mysql.com/bug.php?id=104573 ,发现有类似的从库undo表空间长时间处于清理状态,该问题是由参数 super_read_only =ON 触发的。

 

问题解决:

  1. 重启有undo_*_trunc.log的从节点mysqld,重启后undo_*_trunc.log文件消失。
  2. 修改参数减少undo的truncate操作。 set persist innodb_purge_rseg_truncate_frequency=128; set persist innodb_max_undo_log_siz=4294967296;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

#########################