########################
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 觸發的。
問題解決:
- 重啓有undo_*_trunc.log的從節點mysqld,重啓後undo_*_trunc.log文件消失。
- 修改參數減少undo的truncate操作。 set persist innodb_purge_rseg_truncate_frequency=128; set persist innodb_max_undo_log_siz=4294967296;
#########################