Xtrabackup 8.0.11 备份MySQL 8.0.20异常

1.异常背景

尝试使用Xtrabackup来备份当前最新版的MySQL 8.0.20,一条命令下去直接报错,还触发了一个已知BUG,记录一下错误背景

2.环境信息

## Xtrabackup 8.0.11
[root@10-186-61-109 ~]# xtrabackup --version
xtrabackup version 8.0.11 based on MySQL server 8.0.18 Linux (x86_64) (revision id: 486c270)

## MySQL Enterprise 8.0.20
root@localhost[(none)]> \s
--------------
mysql  Ver 8.0.20-commercial for Linux on x86_64 (MySQL Enterprise Server - Commercial)
Connection id:		16
Current database:
Current user:		root@localhost
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		8.0.20-commercial MySQL Enterprise Server - Commercial
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4
UNIX socket:		/data/mysql/3306/data/mysqld.sock
Binary data as:		Hexadecimal
Uptime:			1 hour 25 min 17 sec

Threads: 2  Questions: 86  Slow queries: 3  Opens: 156  Flush tables: 3  Open tables: 75  Queries per second avg: 0.016

3.备份报错

[root@10-186-61-109 ~]# xtrabackup --socket=/data/mysql/3306/data/mysqld.sock --password --backup --target-dir=/data/mysql/3306/backup/
xtrabackup: recognized client arguments: --socket=/data/mysql/3306/data/mysqld.sock --password --backup=1 --target-dir=/data/mysql/3306/backup/
Enter password:
xtrabackup version 8.0.11 based on MySQL server 8.0.18 Linux (x86_64) (revision id: 486c270)
200525 14:38:23  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;mysql_socket=/data/mysql/3306/data/mysqld.sock' (using password: NO).
200525 14:38:23  version_check Connected to MySQL server
200525 14:38:23  version_check Executing a version check against the server...
200525 14:38:23  version_check Done.
200525 14:38:23 Connecting to MySQL server host: localhost, user: not set, password: set, port: not set, socket: /data/mysql/3306/data/mysqld.sock
Using server version 8.0.20-commercial
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /data/mysql/3306/data/
xtrabackup: open files limit requested 0, set to 1024
xtrabackup: using the following InnoDB configuration:
xtrabackup:   innodb_data_home_dir = .
xtrabackup:   innodb_data_file_path = ibdata1:1024M:autoextend
xtrabackup:   innodb_log_group_home_dir = /data/mysql/3306/redolog
xtrabackup:   innodb_log_files_in_group = 3
xtrabackup:   innodb_log_file_size = 2147483648
Number of pools: 1
200525 14:38:23 Connecting to MySQL server host: localhost, user: not set, password: set, port: not set, socket: /data/mysql/3306/data/mysqld.sock
## 错误关键点: Unknown redo log format (4)
Unknown redo log format (4). Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/ upgrading-downgrading.html.
xtrabackup: Error: recv_find_max_checkpoint() failed.

4. 排错思路

  1. Google搜索recv_find_max_checkpoint关键字说明直接搜到相关BUG链接

  2. MySQL官方对Redo log的版本变更原因

  3. 摘取的MySQL8.0.20的Release Note信息

InnoDB: Redo log records for modifications to undo tablespaces increased in size in MySQL 8.0 due to a change in undo tablespace ID values, which required additional bytes. The change in redo log record size caused a performance regression in workloads with heavy write I/O. To address this issue, the redo log format was modified to reduce redo log record size for modifications to undo tablespaces. (Bug #29536710)

5. 知识点归纳

  • 当前最新版的Xtrabackup8.0.11还不支持备份MySQL8.0.20,后续会修复但支持的时间未知
    - Xtrabackup已发布8.0.12版本,支持备份MySQL8.0.20(xtrabackup version 8.0.12 based on MySQL server 8.0.20 Linux (x86_64) (revision id: 01cce6d))
    - https://www.percona.com/blog/2020/04/28/percona-xtrabackup-8-x-and-mysql-8-0-20/
  • MySQL修改redo log格式版本的原因是在MySQL 8.0中,由于undo表空间ID值的变化,undo表空间修改的重做日志记录的大小增加了,导致需要额外的字节存储,redo log记录大小的变化导致写I/O较多的工作负载的性能下降(官方记录是10%),为了解决这个问题,对redo log日志格式进行了修改(优化)
Bug#29536710: MYSQL 8.0 IS 10% SLOWER THAN 5.7 AT WRITE-IO BOUND CASE

(once descripted as WL#13419 : InnoDB: extend 32-bit value compaction also for high value of unsigned in transaction log)

Using undefined bit pattern of the current format,
high unsigned value also can be packed to
smaller bytes as higher its value is. (2 ~ 5 bytes)

1) increment LOG_HEADER_FORMAT to 4
The older parser detect as new format not to treat.

2) change the following 32-bit values packing
0xFF000000 ~ 0xFFFFFFFF : 0b11110000 + 4bytes
to
0xFF000000 ~ 0xFFFDFFFF : 0b11111110 + 3bytes
0xFFFE0000 ~ 0xFFFFFBFF : 0b1111110n + 2bytes
0xFFFFFC00 ~ 0xFFFFFFFF : 0b111110nn + 1byte

Approved by Pawel Olchawa <pawel.olchawa@oracle.com>
RB: 22349
posted @ 2020-05-25 15:45  ZhenXing_Yu  阅读(1384)  评论(0编辑  收藏  举报