MySQL 8.0 新特性之克隆插件(The Clone Plugin)

由于个人能力有限,文中可能存在错误,并且很多细节没有深入分析,欢迎批评指正。(部分数据、图片引用已作备注,如有侵权,可私信或评论告知删除)。

MySQL 8.0 新特性之克隆插件(The Clone Plugin)

1.前言

MySQL 8.0.17 版本引入克隆插件功能,支持本地和远程两种克隆方式,简化数据备份以及向复制拓扑中新增的节点的过程。
在这里插入图片描述
注:本地克隆图示。
在这里插入图片描述
注:远程克隆图示。

2.功能原理

2.1.核心原理

在克隆插件设计过程中,主体包含三个部分,分别是 Snapshot、Clone handle 、Task ,其中最为核心的部分便是 Snapshot(快照)。以下是官方博客说明:

For a clone operation, InnoDB would create a “Clone Handle” identified by a
locator returned to the clone plugin. The “Clone Handle” would be attached to a
“Snapshot”. The The diagram below shows multiple states of the “Snapshot” during
cloning.
[INIT] —> [FILE COPY] —> [PAGE COPY] —> [REDO COPY] -> [Done]
The idea is to use page delta for the larger part of the copy operation (file
copy) and use redo for the second part to get to a consistent snapshot.
We would also implement two innodb system wide features “Page Tracking” & “Redo
Archiving” to be used by clone operation. The tracking would start from the
current log sys lsn i.e. the lsn for the last finished mtr. Note that the
changes before this lsn may not be flushed to redo or disk yet and caller
should have appropriate considerations as explained below.

功能设计核心部分:Snapshot,主要包含 5 个阶段: [INIT] —> [FILE COPY] —> [PAGE COPY] —> [REDO COPY] -> [Done] 。
在这里插入图片描述

注:上述图片引用淘宝数据库内核月报《MySQL 引擎特性 clone_plugin》。

Snapshot 主要包含如下 5 个阶段:
INIT

  • 初始化克隆对象,为后续阶段做准备。

FILE COPY

  • 类似于 PXB 工具中的 ibd 拷贝
  • 拷贝数据文件
  • 启动 Page Tracking 特性机制
  • 记录并收集 CLONE START LSN 和 CLONE FILE END LSN 之间内存中改动(脏页)

PAGE COPY

  • 特有的克隆功能阶段
  • 停止 Page Tracking
  • 对上一阶段收集的脏页按 Tablespace ID 和 page ID 进行排序
  • 拷贝 CLONE START LSN 到 CLONE FILE END LSN 之间的脏页
  • 启动 Redo Archiving 特性机制,将 CLONE FILE END LSN 后产生的 redo 归档拷贝到文件中
  • 等待脏页拷贝完成后获取一致性位置点信息(CLONE LSN)

REDO COPY

  • 停止 Redo Archiving
  • 从归档文件中拷贝 CLONE FILE END LSN 和 CLONE LSN 之间的 Redo 日志

Done

  • 调用 snapshot_end()销毁克隆对象

实际,每一步的分界点都以 LSN 来区分:

  • 拷贝所有的文件(clone start lsn -> clone file end lsn)
  • 增量 1 拷贝 clone start lsn 到 clone file end lsn 之间搜集的脏页
  • 增量 2 拷贝 clone file end lsn 到clone lsn 归档的 redo

2.2.与 PXB 备份过程对比

PXB 备份过程

  • 重做日志文件拷贝;
  • InnoDB 文件拷贝;
  • 保存二进制日志点位(通过加FTWRL全局锁)
  • 拷贝其他非 InnoDB 文件。
    在这里插入图片描述

克隆备份过程
在这里插入图片描述

注:上述图片引用微信公众号 InsideMySQL ,文章 《全网最完整的 MySQL Clone Plugin 实现原理解析》,作者:破产码农(姜承尧)。

从上述图示对比中,可以看到:

  • PXB 的备份过程中,REDO COPY 是持续整个备份周期的;
  • 克隆插件的备份过程中,仅需要拷贝上一阶段(PAGE COPY)期间归档的 REDO 文件,时间相对更短。

克隆插件有哪些显著的特点:

  • 支持 PAGE COPY (脏页拷贝):显著减少了所需归档的 Redo 日志量,相应的也会提升恢复速度;
  • 引入 Page Tracking 机制,追踪记录记录 LSN 的变化,用于后续 REDO 日志的备份;
  • 引入 Redo Archiving 机制,备份归档 REDO LOG,避免重做日志文件写入太快,覆盖写入无法备份的场景。

2.3.与 PXB 备份性能对比

注:以下数据来自 Percona 官方博客《The MySQL Clone Wars: Plugin vs. Percona XtraBackup》。

测试准备

使用 sysbench 创建了200个表,每个表的大小为124Mb,总大小为24Gb。源和副本虚拟机都运行4个核心,8Gb RAM和60Gb存储(在同一个数据存储上创建了这些磁盘)。

在测试过程中,只在机器上进行备份操作,排除其他因素干扰。

测试克隆和 PXB 操作的不同组合:

  • 对于XtraBackup,测试1到4个线程,开启和关闭压缩。在压缩的情况下,为压缩和解压缩分配相同数量的线程。
  • 对于克隆插件,测试自动(让服务器决定执行克隆的线程数)以及1到4个线程。
  • 使用三种不同的网络限制执行了所有测试:500mbps、1000mbps和4000mbps。

测试方法

  • 克隆:
    在使用克隆插件所需的参数中,以下参数在接收服务器中进行了相应设置:

    • clone_max_concurrency=<最大线程数> :定义了当启用自动调整时,远程克隆操作使用的最大线程数。否则,这就是远程克隆使用的确切线程数。
    • clone_autotune_concurrency: 如果启用,克隆操作将使用最多 clone_max_concurrency个线程。默认值是16。
    • clone_enable_compression: 如果启用,远程克隆操作将使用压缩。
  • Percona XtraBackup
    为了流式传输备份,使用 xbstream 格式,并使用 netcat 将数据发送到远程服务器。应用以下参数:

    • parallel=<线程数> :Xtrabackup和xbstream参数,定义了备份和恢复操作使用的线程数。
    • rebuild-threads: 重建(准备)操作使用的线程数。
    • decompress_threads 和 compress_threads Xtrabackup和xbstream参数:定义了压缩操作使用的线程数。

    这里也可以使用其他参数,如 innodb-read-io-threads, innodb-write-io-threads 或 innoDB-io-capacity,但这些参数仅会影响 InnoDB 后台线程的行为。在备份和恢复操作期间,它们没有任何影响。

测试结果

克隆(未压缩)

  • Auto ,即由克隆插件自行调整并发线程数的数量始终是最快的。
  • 当带宽增加后,执行耗时几乎减半。

在这里插入图片描述
克隆(压缩)

  • 相比于未压缩场景,整体备份耗时均有增加:
  • 增加带宽并没有提升克隆性能,执行时间基本没有变化;
  • Auto 配置下,耗时依旧是最短的,等同于并发 4 个线程。
    在这里插入图片描述

PXB(未压缩)

  • 在不使用压缩的情况下,当使用超过2个线程时,克隆插件更快。对于较少的线程,PXB 更快;
  • 当增加带宽时,PXB 增加线程数可降低耗时,但可能也会达到了 I/O 限制。
    在这里插入图片描述

PXB(压缩)

  • PXB 在使用压缩时,与不使用压缩的选项相比,完成所需的时间都更短;
  • 带宽此时不是限制因素。
    在这里插入图片描述

数据汇总:
在这里插入图片描述

结论

  • 在使用压缩时,克隆插件是较慢的选择,而 PXB 在所有带宽下都给出了很好的结果。
  • 在不使用压缩的情况下,当使用超过2个线程时,克隆插件更快。对于较少的线程,XtraBackup更快。

3.使用限制

在使用克隆插件时,需注意如下限制:

  • 版本兼容性:不支持大版本克隆,比如从 MySQL 8.0 克隆至 MySQL 8.3 。MySQL 8.0.37 之前,需保证小版本一致,MySQL 8.0.37 开始,支持小版本克隆,比如从 MySQL 8.0.37 克隆至 MySQL 8.0.42 。
  • DDL 操作限制:MySQL 8.0.27 之前,克隆期间会阻塞 DDL ,DML 执行不受影响,MySQL 8.0.27 开始,Donor 节点上允许 DDL 操作,由 clone_block_ddl 参数控制(详见 3.相关参数)。
  • 单一实例克隆:一次只能克隆一个 MySQL 实例,不支持在单个克隆操作中克隆多个 MySQL 实例。
  • 端口限制:在远程克隆CLONE INSTANCE语句中指定 Donor 节点端口号时,不支持指定为 mysqlx_port 配置的 X Protocol 端口。(该端口为 X Plugin 协议端口,默认值为 33060。MySQL 5.7.12 引入该插件,支持文档数据存储)
  • 实例配置限制:不支持克隆 Donor 节点的配置参数,Recipient 节点保留其配置,包括持久化的系统变量设置。如果需要搭建复制拓扑,建议提前准备好 Recipient 节点的配置文件,注意修改 server_id 及其他相关参数配置。
  • 二进制日志克隆限制:不支持克隆 Donor 节点上的二进制日志(binlog)。
  • 存储引擎限制:仅支持克隆 InnoDB 表的数据,对于其他存储引擎的表,只会克隆其表结构。
  • 连接限制:不支持通过 MySQL Router 连接到 Donor 节点;
  • 绝对路径限制:Donor 节点中如果有表创建时通过 DATA DIRECTORY [=] '*data_dir*' 子句设置绝对路径,在进行本地克隆时,会提示文件已存在。在进行远程克隆时,绝对路径必须存在且有可写权限。

另外,其他需要注意的点包括:

  • 磁盘空间:Recipient 节点需保证足够的磁盘空间来进行克隆。
  • Innodb 参数:数据存储相关参数 innodb_page_sizeinnodb_data_file_pathinnodb_undo_directory 等需保持一致。
  • 字符集参数:字符集相关参数 character_set_servercollation_server 等需保持一致。
  • Server 参数:远程克隆配置 max_allowed_packet 参数至少大于 2MB。
  • 操作系统:远程克隆时,Donor 和 Recipient 节点主机操作系统必须一致,可通过 version_compile_osversion_compile_machine 查看。

4.相关参数

  • clone_autotune_concurrency
    控制是否自动调节克隆过程中并发线程数的数量,默认为 ON 。此时,最大线程数由参数 clone_max_concurrency 控制。若设置为 OFF ,并发线程数将是固定的,等于 clone_max_concurrency ,后者的默认值为 16 。
  • clone_block_ddl
    控制是否对 Donor 节点加备份锁,默认为 OFF,不加锁。如果加锁,则会阻塞 DDL。该参数是 MySQL 8.0.27 引入的。
  • clone_buffer_size
    控制克隆缓冲区的大小,默认 4M 。缓冲区越大,备份速度越快,相应的,对磁盘 IO 的压力也越大。
  • clone_ddl_timeout
    克隆操作需要获取备份锁。在执行 CLONE 命令时,如果有 DDL 正在执行,则 CLONE 命令会被阻塞,等待获取备份锁(Waiting for backup lock)。等待的最大时长由 Recipient 节点上的 clone_ddl_timeout 决定,该参数默认为 300s。如果在这个时间内还没获取到备份锁,CLONE 命令会失败,且提示 ERROR 3862 (HY000): Clone Donor Error: 1205 : Lock wait timeout exceeded; try restarting transaction.。需要注意的是,在执行 DDL 时,如果有 CLONE 命令在执行,DDL 同样也会因为备份锁而阻塞,只不过,DDL 操作的等待时长由 lock_wait_timeout 参数决定,该参数默认为 31536000s,即 365 天。
  • clone_delay_after_data_drop
    远程克隆时在 Recipient 节点上 drop 完用户表空间,等待多久才执行数据拷贝操作。引入该参数的初衷是某些文件系统(如 VxFS)是异步释放空间的。如果 drop 完用户表空间,就马上执行数据拷贝操作,有可能会因为空间不足而导致克隆失败。该参数是 MySQL 8.0.29 引入的,默认为 0,即不等待。
  • clone_Donor_timeout_after_network_failure
    远程克隆期间如果出现了网络错误,克隆操作不会马上终止,而是会等待一段时间。如果在这个时间内,网络恢复了,操作会继续进行。在 MySQL 8.0.24 之前,等待时间是固定的 5 min。从 MySQL 8.0.24 开始,可通过 clone_Donor_timeout_after_network_failure 设置这个时间,默认是 5 min,可设置范围为 0~30 min。
  • clone_enable_compression
    远程克隆传输数据时,是否开启压缩。默认为 OFF 。开启压缩能节省网络带宽,但相应的,会增加 CPU 开销。
  • clone_max_concurrency
    控制远程克隆操作的最大并发线程数,默认值为 16。增加线程数可以提高克隆性能,但同时也会占用客户端连接数,这可能会影响现有客户端连接的性能。这个设置仅适用于 Recipient 节点。
  • clone_max_data_bandwidth
    远程克隆可允许的最大数据拷贝速率,单位 MB/s ,默认为 0,即不限制。如果 Donor 节点的磁盘 IO 存在瓶颈,可通过该参数来限速。
    注意,这里限制的只是单个线程的拷贝速率。如果是多个线程并行拷贝,实际最大拷贝速率 = clone_max_data_bandwidth * 线程数。
  • clone_max_network_bandwidth
    远程克隆可允许的最大网络传输速率,单位 MiB/s ,默认为 0,即不限制。如果网络带宽存在瓶颈,可通过该参数来限速。
  • clone_ssl_ca
    远程克隆加密连接配置,在 Recipient 节点上配置,默认为空。
  • clone_ssl_cert
    远程克隆加密连接配置,在 Recipient 节点上配置,默认为空。
  • clone_ssl_key
    远程克隆加密连接配置,在 Recipient 节点上配置,默认为空。
  • clone_valid_Donor_list
    在 Recipient 节点上设置 Donor 节点白名单,Recipient 只能克隆白名单中指定的节点。在执行克隆操作之前,必须设置该参数。

5.安装插件

# 安装 clone plugin
[mysql@clonetest1 ~]$ ll /opt/mysql/lib/plugin/ | grep clone
-rwxr-xr-x 1 mysql mysql   3036960 Sep 15  2023 mysql_clone.so

mysql> INSTALL PLUGIN CLONE SONAME "mysql_clone.so";
Query OK, 0 rows affected (0.02 sec)

mysql> select * from information_schema.plugins where PLUGIN_NAME='clone'\G
*************************** 1. row ***************************
           PLUGIN_NAME: clone
        PLUGIN_VERSION: 1.0
         PLUGIN_STATUS: ACTIVE
           PLUGIN_TYPE: CLONE
   PLUGIN_TYPE_VERSION: 1.0
        PLUGIN_LIBRARY: mysql_clone.so
PLUGIN_LIBRARY_VERSION: 1.11
         PLUGIN_AUTHOR: Oracle Corporation
    PLUGIN_DESCRIPTION: CLONE PLUGIN
        PLUGIN_LICENSE: GPL
           LOAD_OPTION: ON
1 row in set (0.00 sec)

# 创建 clone 用户,授权 BACKUP_ADMIN,CLONE_ADMIN,SHUTDOWN 权限
mysql> create user clone_user identified by 'clone_test';
Query OK, 0 rows affected (0.01 sec)

mysql> grant BACKUP_ADMIN,CLONE_ADMIN,SHUTDOWN on *.* to clone_user;
Query OK, 0 rows affected (0.01 sec)

6.本地克隆

6.1.语法解析

CLONE LOCAL DATA DIRECTORY [=] 'clone_dir';
  • LOCAL:本地克隆模式。
  • DATA DIRECTORY [=] ‘clone_dir’:用于指定克隆源文件到目标目录的路径。

需要注意的是:

  • clone_dir 必须是绝对路径,且 MySQL 需对其有写权限,否侧会出现报错 errno: 13 - Permission denied,可通过 chown -R mysql:mysql [clone_dir] 命令修改目录权限。
  • 假设这里克隆目录为 /data/mysql/data_clone ,最后一级目录 data_clone 如已存在,会提示 ERROR 1007 (HY000): ... database exists

6.2.测试用例

mysql> system ls -l /data/mysql/
total 8
drwxr-xr-x 2 mysql mysql 4096 Mar 18 22:25 binlog
drwxr-xr-x 9 mysql mysql 4096 Mar 18 22:25 data

# 本地执行克隆
mysql> CLONE LOCAL DATA DIRECTORY = '/data/mysql/data_clone';
Query OK, 0 rows affected (4.60 sec)

mysql> system ls -l /data/mysql/
total 8
drwxr-xr-x 2 mysql mysql 4096 Mar 18 22:25 binlog
drwxr-xr-x 9 mysql mysql 4096 Mar 18 22:25 data
drwxr-x---  6 mysql mysql 4096 Mar 20 11:13 data_clone

mysql> system ls -l /data/mysql/data_clone/
total 1106972
drwxr-x--- 2 mysql mysql      4096 Mar 20 11:13 #clone
-rw-r----- 1 mysql mysql     11720 Mar 20 11:13 ib_buffer_pool
-rw-r----- 1 mysql mysql 536870912 Mar 20 11:13 ibdata1
-rw-r----- 1 mysql mysql 536870912 Mar 20 11:13 ibdata2
drwxr-x--- 2 mysql mysql      4096 Mar 20 11:13 #innodb_redo
drwxr-x--- 2 mysql mysql      4096 Mar 20 11:13 mysql
-rw-r----- 1 mysql mysql  26214400 Mar 20 11:13 mysql.ibd
drwxr-x--- 2 mysql mysql      4096 Mar 20 11:13 sys
-rw-r----- 1 mysql mysql  16777216 Mar 20 11:13 undo_001
-rw-r----- 1 mysql mysql  16777216 Mar 20 11:13 undo_002

# 创建新实例日志目录,以及修改配置文件中的端口,路径等
[mysql@clonetest1 ~]$ mkdir /data/mysql/binlog_clone
[mysql@clonetest1 ~]$ ll /data/mysql/
total 16
drwxr-xr-x  2 mysql mysql 4096 Mar 11 16:42 binlog
drwxrwxr-x  2 mysql mysql 4096 Mar 20 11:26 binlog_clone
drwxr-xr-x 10 mysql mysql 4096 Mar 20 11:12 data
drwxr-x---  6 mysql mysql 4096 Mar 20 11:13 data_clone
[mysql@clonetest1 ~]$ cp /opt/mysql/etc/my.cnf /opt/mysql/etc/myclone.cnf
[mysql@clonetest1 ~]$ ll /opt/mysql/etc/
total 24
-rw-rw-r-- 1 mysql mysql 8489 Mar 20 11:25 myclone.cnf
-rw-rw-r-- 1 mysql mysql 8459 Mar 11 17:50 my.cnf
[mysql@clonetest1 ~]$ vim /opt/mysql/etc/myclone.cnf

# 使用克隆文件启动 MySQL 服务
[mysql@clonetest1 ~]$ /opt/mysql/bin/mysqld_safe --defaults-file=/opt/mysql/etc/myclone.cnf &

[mysql@clonetest1 ~]$ ps -ef | grep -v grep | grep mysqld
mysql     8638     1  0 Mar11 ?        00:00:00 /bin/sh /opt/mysql/bin/mysqld_safe --defaults-file=/opt/mysql/etc/my.cnf
mysql     9928  8638  0 Mar11 ?        00:45:20 /opt/mysql/bin/mysqld --defaults-file=/opt/mysql/etc/my.cnf --basedir=/opt/mysql --datadir=/data/mysql/data --plugin-dir=/opt/mysql/lib/plugin --log-error=clonetest1.err --open-files-limit=65535 --pid-file=/data/mysql/data/mysql.pid --socket=/data/mysql/data/mysql.sock --port=3306
mysql    17891 15331  0 11:30 pts/1    00:00:00 /bin/sh /opt/mysql/bin/mysqld_safe --defaults-file=/opt/mysql/etc/myclone.cnf
mysql    19277 17891  8 11:30 pts/1    00:00:05 /opt/mysql/bin/mysqld --defaults-file=/opt/mysql/etc/myclone.cnf --basedir=/opt/mysql --datadir=/data/mysql/data_clone --plugin-dir=/opt/mysql/lib/plugin --log-error=clonetest1.err --open-files-limit=65535 --pid-file=/data/mysql/data_clone/mysql.pid --socket=/data/mysql/data_clone/mysql.sock --port=3307

[mysql@clonetest1 ~]$ mysql -uroot -p --socket=/data/mysql/data_clone/mysql.sock -P3307
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 64
Server version: 8.0.34-26 Percona Server (GPL), Release 26, Revision 0fe62c85

Copyright (c) 2009-2023 Percona LLC and/or its affiliates
Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| luft               |
| mysql              |
| performance_schema |
| sbtest             |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

7.远程克隆

7.1.语法解析

CLONE INSTANCE FROM 'user'@'host':port
IDENTIFIED BY 'password'
[DATA DIRECTORY [=] 'clone_dir']
[REQUIRE [NO] SSL];
  • user:Donor 节点的用户名。
  • password:对应 user 的密码。
  • host:Donor 节点的主机名或 IP,不支持 IPv6 地址格式,可采用域名代替,支持 IPv4 地址格式。
  • port:Donor 节点的端口。
  • DATA DIRECTORY [=] ‘clone_dir’:用于指定克隆源文件到目标目录的路径。可选选项,如不指定 clone_dir ,则会清空 Recipient 实例的 datadir 目录。如指定 clone_dir ,同样需要注意文件路径写入权限,以及路径下不能存在同名的最后一级目录。。
  • REQUIRE [NO] SSL:用于指定传输数据时是否使用加密协议。

7.2.测试用例

# Recipient 节点
mysql> system ls -l /data/mysql/
total 16
drwxr-xr-x  2 mysql mysql 4096 Mar 20 14:02 binlog
drwxrwxr-x  2 mysql mysql 4096 Mar 20 11:30 binlog_clone
drwxr-xr-x 10 mysql mysql 4096 Mar 20 14:02 data
drwxr-x--- 10 mysql mysql 4096 Mar 20 14:03 data_clone

# 在 Recipient 上设置 Donor 白名单,Recipient 只能克隆白名单中指定的实例
mysql> show variables like 'clone_valid_Donor_list';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| clone_valid_Donor_list |       |
+------------------------+-------+
1 row in set (0.02 sec)

mysql> set global clone_valid_Donor_list='10.100.101.1:3306';
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'clone_valid_Donor_list';
+------------------------+-------------------+
| Variable_name          | Value             |
+------------------------+-------------------+
| clone_valid_Donor_list | 10.100.101.1:3306 |
+------------------------+-------------------+
1 row in set (0.01 sec)

# 执行远程克隆
mysql> CLONE INSTANCE FROM 'clone_user'@'10.100.101.1':3306 IDENTIFIED BY 'clone_test' DATA DIRECTORY = '/data/mysql/data_clone_remote';
Query OK, 0 rows affected (1 min 33.53 sec)

mysql> system ls -l /data/mysql/
total 20
drwxr-xr-x  2 mysql mysql 4096 Mar 20 14:02 binlog
drwxrwxr-x  2 mysql mysql 4096 Mar 20 11:30 binlog_clone
drwxr-xr-x 10 mysql mysql 4096 Mar 20 14:02 data
drwxr-x--- 10 mysql mysql 4096 Mar 20 14:03 data_clone
drwxr-x---  8 mysql mysql 4096 Mar 20 14:23 data_clone_remote

mysql> system ls -l /data/mysql/data_clone_remote/
total 1116116
drwxr-x--- 2 mysql mysql      4096 Mar 20 14:23 #clone
drwxr-x--- 2 mysql mysql     20480 Mar 20 14:21 dbms
-rw-r----- 1 mysql mysql   1997533 Mar 20 14:21 ib_buffer_pool
-rw-r----- 1 mysql mysql 536870912 Mar 20 14:21 ibdata1
-rw-r----- 1 mysql mysql 536870912 Mar 20 14:22 ibdata2
drwxr-x--- 2 mysql mysql      4096 Mar 20 14:23 #innodb_redo
drwxr-x--- 2 mysql mysql      4096 Mar 20 14:21 mysql
-rw-r----- 1 mysql mysql  33554432 Mar 20 14:23 mysql.ibd
drwxr-x--- 2 mysql mysql      4096 Mar 20 14:21 sys
drwxr-x--- 2 mysql mysql      4096 Mar 20 14:21 test
-rw-r----- 1 mysql mysql  16777216 Mar 20 14:23 undo_001
-rw-r----- 1 mysql mysql  16777216 Mar 20 14:23 undo_002
# 查看 #clone 目录下的文件
[root@dbmspreapp279 data]# ll \#clone/
total 8
-rw-r----- 1 mysql mysql 348 Jul 12 09:11 #view_progress
-rw-r----- 1 mysql mysql 153 Jul 12 09:12 #view_status
# 记录克隆过程中的一些元数据信息,实际也就是克隆过程中每个阶段的时间戳、数据量等情况。
[root@dbmspreapp279 #clone]# cat \#view_progress
1
2 1 1720746679490872 1720746680076309 0 0 0
2 2 1720746680076577 1720746690596238 1150085210 1150085210 1150162908
2 2 1720746690596424 1720746690620323 0 0 197
2 2 1720746690620477 1720746690652257 4096 4096 4591
2 2 1720746690652400 1720746690737165 0 0 0
2 0 1720746690737165 1720746693039143 0 0 0
2 0 1720746693039143 1720746694073921 0 0 0
# 记录 Donor、BINLOG_FILE、BINLOG_POSITION、GTID 等信息
[root@dbmspreapp279 #clone]# cat \#view_status
2 1
1720746679351458 1720746694073921
10.237.181.73:3306
0
/data/mysql/binlog/mysql-bin.000013
214347477
f8c1ada6-e777-11ee-8337-fa163e7dd4c6:1-4196864

克隆数据后,将创建以下目录和文件以供内部使用:

  • #clone:包含克隆操作使用的内部克隆文件,在 Recipient 节点创建,可能如下文件:

    • #view_progress:持久保存performance_schema.clone_progress的数据。
    • #view_status:持久保存performance_schema.clone_status的数据。
    • #status_in_progress:当克隆正在进行时存在的临时文件。
    • #status_error:表示克隆未完成的临时文件。
    • #status_recovery:持有恢复状态信息的临时文件。
    • #new_files:克隆过程中创建的所有文件的列表。
    • #replace_files:在恢复过程中需要替换的所有文件的列表。
  • #ib_archive:包含在克隆操作期间在 Donor 节点上归档的内部日志文件。

  • *.#clone files:在远程克隆操作期间,当从 Recipient 的数据目录中删除旧数据并克隆新数据时,创建的临时数据文件。

8.克隆监控

8.1.Performance Schema Clone Tables

这里用到两张表,分别是 performance_schema.clone_statusperformance_schema.clone_progress,前者记录克隆任务状态,后者记录克隆任务进展,需要注意的是,在远程克隆时,只有在 Recipient 节点上查看。

8.1.1.clone_status
mysql> select * from performance_schema.clone_status\G
*************************** 1. row ***************************
             ID: 1
            PID: 39
          STATE: Completed
     BEGIN_TIME: 2024-03-20 14:30:49.455
       END_TIME: 2024-03-20 14:32:22.985
         SOURCE: 10.100.101.1:3306
    DESTINATION: /data/mysql/data_clone_remote/
       ERROR_NO: 0
  ERROR_MESSAGE: 
    BINLOG_FILE: 
BINLOG_POSITION: 0
  GTID_EXECUTED: 
1 row in set (0.04 sec)

其中各字段含义如下:

  • ID:任务 ID。
  • PID:对应 show processlist 中的 ID,如果要终止克隆任务,可以执行 KILL QUERY processlist_id
  • STATE:克隆操作的状态,包括 Not Started(尚未开始)In Progress(进行中)Completed(成功)Failed(失败)。
  • BEGIN_TIME:克隆任务开始时间。
  • END_TIME:克隆任务结束时间。
  • SOURCE:Donor 节点的地址。
  • DESTINATION:克隆目录。
  • ERROR_MESSAGE:如果任务失败,该字段会显示报错内容。
  • BINLOG_FILE & BINLOG_POSITION & GTID_EXECUTED:克隆操作对应的一致性位点信息,可利用这些信息搭建从库。

在前面远程克隆的测试用例中,由于是指定克隆到其他目录,这个过程中不涉及 MySQL 服务 restart 、recovery 动作,克隆过程中 copy 的 redo log 尚未被应用,因此,在 clone_status 表中不会记录 BINLOG_FILE、BINLOG_POSITION、GTID_EXECUTED 信息。

# 这里,不添加 DATA DIRECTORY [=] 'clone_dir' 子句,执行克隆时,自动进行 restart、recovery 动作。
mysql> CLONE INSTANCE FROM 'clone_user'@'10.100.101.1':3306 IDENTIFIED BY 'clone_test';
Query OK, 0 rows affected (9.81 sec)

# 基于日志及GTID等信息,可搭建复制
mysql> select * from performance_schema.clone_status\G
*************************** 1. row ***************************
             ID: 1
            PID: 0
          STATE: Completed
     BEGIN_TIME: 2024-03-21 10:52:20.183
       END_TIME: 2024-03-21 10:52:33.204
         SOURCE: 10.100.101.1:3306
    DESTINATION: LOCAL INSTANCE
       ERROR_NO: 0
  ERROR_MESSAGE: 
    BINLOG_FILE: mysql-bin.000010
BINLOG_POSITION: 441
  GTID_EXECUTED: e312d0d9-df68-11ee-8513-fa163e7dd4c6:1-16
1 row in set (0.01 sec)

计算克隆任务持续时间:

mysql> SELECT STATE, CAST(BEGIN_TIME AS DATETIME) as "START TIME", CASE WHEN END_TIME IS NULL THEN LPAD(sys.format_time(POWER(10,12) * (UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(BEGIN_TIME))), 10, ' ') ELSE LPAD(sys.format_time(POWER(10,12) * (UNIX_TIMESTAMP(END_TIME) - UNIX_TIMESTAMP(BEGIN_TIME))), 10, ' ') END as DURATION FROM performance_schema.clone_status;
+-------------+---------------------+------------+
| STATE       | START TIME          | DURATION   |
+-------------+---------------------+------------+
| In Progress | 2024-03-20 14:30:49 |     6.53 s |
+-------------+---------------------+------------+
1 row in set (0.07 sec)
8.1.2.clone_progress
mysql> select * from performance_schema.clone_progress;
+------+-----------+-------------+----------------------------+----------------------------+---------+-------------+-------------+-------------+------------+---------------+
| ID   | STAGE     | STATE       | BEGIN_TIME                 | END_TIME                   | THREADS | ESTIMATE    | DATA        | NETWORK     | DATA_SPEED | NETWORK_SPEED |
+------+-----------+-------------+----------------------------+----------------------------+---------+-------------+-------------+-------------+------------+---------------+
|    1 | DROP DATA | Completed   | 2024-03-20 14:30:49.509009 | 2024-03-20 14:30:49.512688 |       1 |           0 |           0 |           0 |          0 |             0 |
|    1 | FILE COPY | Completed   | 2024-03-20 14:30:49.512818 | 2024-03-20 14:32:22.291848 |       4 | 20664646365 | 20664646365 | 20665794019 |          0 |             0 |
|    1 | PAGE COPY | Completed   | 2024-03-20 14:32:22.292517 | 2024-03-20 14:32:22.524297 |       4 |           0 |           0 |         393 |          0 |             0 |
|    1 | REDO COPY | Completed   | 2024-03-20 14:32:22.524562 | 2024-03-20 14:32:22.753255 |       4 |        2560 |        2560 |        3195 |          0 |             0 |
|    1 | FILE SYNC | Completed   | 2024-03-20 14:32:22.753472 | 2024-03-20 14:32:22.984634 |       4 |           0 |           0 |           0 |          0 |             0 |
|    1 | RESTART   | Not Started | NULL                       | NULL                       |       0 |           0 |           0 |           0 |          0 |             0 |
|    1 | RECOVERY  | Not Started | NULL                       | NULL                       |       0 |           0 |           0 |           0 |          0 |             0 |
+------+-----------+-------------+----------------------------+----------------------------+---------+-------------+-------------+-------------+------------+---------------+
7 rows in set (0.01 sec)

其中各字段含义如下:

  • ID:对应的任务 ID。

  • STAGE:一个克隆任务有 7 个阶段,分别是 DROP DATA、FILE COPY、PAGE COPY、REDO COPY、FILE SYNC、RESTART、RECOVERY 当前阶段结束后才会开始进入下一阶段。在前面远程克隆的测试用例中,因为已指定克隆到其他目录,所以并不涉及服务重启及恢复,RESTART 、RECOVERY 均显示状态为 Not Started。

  • STATE:当前阶段状态。

  • BEGIN_TIME:当前任务的开始时间。

  • END_TIME:当前任务的结束时间。

  • THREADS:当前阶段使用的并发线程数。

  • ESTIMATE:预估数据量。

  • DATA:已拷贝的数据量。

  • NETWORK:通过网络传输的数据量。

  • DATA_SPEED:当前任务拷贝的速率。

  • NETWORK_SPEED:当前任务网络传输的速率。

计算克隆任务完成进度:

mysql> SELECT STAGE, STATE, CAST(BEGIN_TIME AS TIME) as "START TIME", CASE WHEN END_TIME IS NULL THEN LPAD(sys.format_time(POWER(10,12) * (UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(BEGIN_TIME))), 10, ' ') ELSE LPAD(sys.format_time(POWER(10,12) * (UNIX_TIMESTAMP(END_TIME) - UNIX_TIMESTAMP(BEGIN_TIME))), 10, ' ') END as DURATION, LPAD(CONCAT(FORMAT(ROUND(ESTIMATE/1024/1024,0), 0), " MB"), 16, ' ') as "Estimate", CASE WHEN BEGIN_TIME IS NULL THEN LPAD('0%', 7, ' ') WHEN ESTIMATE > 0 THEN  LPAD(CONCAT(CAST(ROUND(DATA*100/ESTIMATE, 0) AS SIGNED), "%"), 7, ' ') WHEN END_TIME IS NULL THEN LPAD('0%', 7, ' ') ELSE LPAD('100%', 7, ' ') END as "Done(%)" FROM performance_schema.clone_progress;
+-----------+-------------+------------+------------+------------------+---------+
| STAGE     | STATE       | START TIME | DURATION   | Estimate         | Done(%) |
+-----------+-------------+------------+------------+------------------+---------+
| DROP DATA | Completed   | 19:47:58   |    4.01 ms |             0 MB |    100% |
| FILE COPY | Completed   | 19:47:58   |     1.53 m |        19,707 MB |    100% |
| PAGE COPY | Completed   | 19:49:29   |  229.29 ms |             0 MB |    100% |
| REDO COPY | Completed   | 19:49:29   |   227.6 ms |             0 MB |    100% |
| FILE SYNC | Completed   | 19:49:30   |  181.65 ms |             0 MB |    100% |
| RESTART   | Not Started | NULL       | NULL       |             0 MB |      0% |
| RECOVERY  | Not Started | NULL       | NULL       |             0 MB |      0% |
+-----------+-------------+------------+------------+------------------+---------+
7 rows in set (0.00 sec)

8.2.Performance Schema Stage Events

启用 stage/innodb/clone% 监控,记录克隆期间中的 InnoDB 重要文件拷贝进度信息,包括:

  • stage/innodb/clone (file copy)
  • stage/innodb/clone (page copy)
  • stage/innodb/clone (redo copy)

操作如下:

# Enable the stage/innodb/clone% instruments:

mysql> UPDATE performance_schema.setup_instruments SET ENABLED = 'YES' WHERE NAME LIKE 'stage/innodb/clone%';

mysql> select * from performance_schema.setup_instruments where NAME LIKE 'stage/innodb/clone%'\G
*************************** 1. row ***************************
         NAME: stage/innodb/clone (file copy)
      ENABLED: YES
        TIMED: YES
   PROPERTIES: progress
        FLAGS: NULL
   VOLATILITY: 0
DOCUMENTATION: NULL
*************************** 2. row ***************************
         NAME: stage/innodb/clone (redo copy)
      ENABLED: YES
        TIMED: YES
   PROPERTIES: progress
        FLAGS: NULL
   VOLATILITY: 0
DOCUMENTATION: NULL
*************************** 3. row ***************************
         NAME: stage/innodb/clone (page copy)
      ENABLED: YES
        TIMED: YES
   PROPERTIES: progress
        FLAGS: NULL
   VOLATILITY: 0
DOCUMENTATION: NULL
3 rows in set (0.00 sec)

# Enable the stage event consumer tables:

mysql> UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%stages%';

mysql> select * from performance_schema.setup_consumers WHERE NAME LIKE '%stages%'\G
*************************** 1. row ***************************
   NAME: events_stages_current
ENABLED: YES
*************************** 2. row ***************************
   NAME: events_stages_history
ENABLED: YES
*************************** 3. row ***************************
   NAME: events_stages_history_long
ENABLED: YES
3 rows in set (0.00 sec)

启用监控后,可从 events_stages_currentevents_stages_historyevents_stages_history_long 表中获取克隆任务信息,重点关注如下几项:

  • EVENT_NAME:克隆执行阶段。
  • WORK_COMPLETED:已完成拷贝的数据量。
  • WORK_ESTIMATED:预估数据量。
8.2.1.events_stages_current
mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE 'stage/innodb/clone%';
+--------------------------------+----------------+----------------+
| EVENT_NAME                     | WORK_COMPLETED | WORK_ESTIMATED |
+--------------------------------+----------------+----------------+
| stage/innodb/clone (file copy) |          12222 |          19708 |
+--------------------------------+----------------+----------------+
1 row in set (0.00 sec)

mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE 'stage/innodb/clone%';
+--------------------------------+----------------+----------------+
| EVENT_NAME                     | WORK_COMPLETED | WORK_ESTIMATED |
+--------------------------------+----------------+----------------+
| stage/innodb/clone (file copy) |          12414 |          19708 |
+--------------------------------+----------------+----------------+
1 row in set (0.00 sec)

...

8.2.2.events_stages_history 和 events_stages_history_long
# 执行克隆操作后,查看最近一次克隆操作记录
mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM performance_schema.events_stages_history WHERE EVENT_NAME LIKE 'stage/innodb/clone%';
+--------------------------------+----------------+----------------+
| EVENT_NAME                     | WORK_COMPLETED | WORK_ESTIMATED |
+--------------------------------+----------------+----------------+
| stage/innodb/clone (file copy) |           1082 |           1082 |
| stage/innodb/clone (page copy) |              0 |              0 |
| stage/innodb/clone (redo copy) |              1 |              1 |
+--------------------------------+----------------+----------------+
3 rows in set (0.00 sec)

# 查看历史克隆操作记录
mysql> SELECT EVENT_NAME,WORK_COMPLETED,WORK_ESTIMATED from performance_schema.events_stages_history_long WHERE EVENT_NAME LIKE 'stage/innodb/clone%';
+--------------------------------+----------------+----------------+
| EVENT_NAME                     | WORK_COMPLETED | WORK_ESTIMATED |
+--------------------------------+----------------+----------------+
| stage/innodb/clone (file copy) |          19708 |          19708 |
| stage/innodb/clone (page copy) |              0 |              0 |
| stage/innodb/clone (redo copy) |              1 |              1 |
| stage/innodb/clone (file copy) |          19708 |          19708 |
| stage/innodb/clone (page copy) |              0 |              0 |
| stage/innodb/clone (redo copy) |              1 |              1 |
| stage/innodb/clone (file copy) |          19708 |          19708 |
| stage/innodb/clone (page copy) |              0 |              0 |
| stage/innodb/clone (redo copy) |              1 |              1 |
| stage/innodb/clone (file copy) |          19708 |          19708 |
| stage/innodb/clone (page copy) |              0 |              0 |
| stage/innodb/clone (redo copy) |              1 |              1 |
| stage/innodb/clone (file copy) |           1082 |           1082 |
| stage/innodb/clone (page copy) |              0 |              0 |
| stage/innodb/clone (redo copy) |              1 |              1 |
+--------------------------------+----------------+----------------+
15 rows in set (0.01 sec)

9.搭建复制

基于克隆的信息,可以进行相关复制搭建,比如:

  • MGR 集群增加节点
    mysql> CHANGE MASTER TO MASTER_USER= <>, MASTER_PASSWORD=<>
       ...
       FOR CHANNEL 'group_replication_recovery';
    mysql> START GROUP_REPLICATION;
    
  • 搭建基于 Binlog Position 的复制
    mysql> SELECT BINLOG_FILE, BINLOG_POSITION
       FROM performance_schema.clone_status;
    BINLOG_FILE BINLOG_POSITION
    binlog.xxxxxx   xxx
    mysql> CHANGE MASTER TO MASTER_HOST=<host-donr>, MASTER_PORT=<port-donor>,
    MASTER_USER='<>',
    MASTER_PASSWORD='<>',
    MASTER_LOG_FILE = 'binlog.xxxxxx',
    MASTER_LOG_POS = xxx;
    mysql> START SLAVE;
    
  • 搭建基于 GTID 的复制( Donor 、Recipient 节点上均需开启 GTID )
    mysql> CHANGE MASTER TO MASTER_HOST=<host-donr>, MASTER_PORT=<port-donor>,
       MASTER_USER='<>',
       MASTER_PASSWORD='<>',
       MASTER_AUTO_POSITION = 1;
    mysql> START SLAVE;
    

10.报错汇总

报错1:ERROR 1006 (HY000): Can’t create database ‘/xx/xx/xx/’ (errno: 13 - Permission denied)

指定克隆目标目录(clone_dir)时,需保证 MySQL 需对其有写权限,否则会报错,可修改 clone_dir 目录权限:

chown -R mysql:mysql [clone_dir]

报错2:ERROR 1007 (HY000): Can’t create database ‘/xx/xx/xx’; database exists

指定克隆目标目录(clone_dir)时,对应路径下不能存在同名的目录文件,否则会报错。

报错3:ERROR 3869 (HY000): Clone system configuration: [ip]:[port] is not found in clone_valid_Donor_list

在进行远程克隆前,必须在 Recipient 节点上设置 Donor 白名单,否则会报错,可设置白名单参数 clone_valid_Donor_list,如果有多个实例使用逗号分隔。

mysql> show variables like 'clone_valid_Donor_list';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| clone_valid_Donor_list |       |
+------------------------+-------+
1 row in set (0.02 sec)

mysql> set global clone_valid_Donor_list='10.100.101.1:3306';
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'clone_valid_Donor_list';
+------------------------+-------------------+
| Variable_name          | Value             |
+------------------------+-------------------+
| clone_valid_Donor_list | 10.100.101.1:3306 |
+------------------------+-------------------+
1 row in set (0.01 sec)

报错4:ERROR 3634 (HY000): Too many concurrent clone operations. Maximum allowed - 1.

一次只能克隆一个 MySQL 实例,不支持在单个克隆操作中克隆多个 MySQL 实例。

待办事项

  • 更多场景下克隆插件性能测试及与 PXB 工具对比分析。
  • 克隆插件备份文件压缩方案(比如 Zstd、Pzstd 、Gzip 以及其他压缩算法等)。

附:克隆日志

以下克隆日志记录在 MySQL 错误日志中。

# ------------ 建立克隆连接
2024-07-11T18:50:12.009163+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Task Connect.'
2024-07-11T18:50:12.031448+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Source ACK Connect.'
# ------------ 检查数据库版本
2024-07-11T18:50:12.031520+08:00 28 [Note] [MY-013457] [InnoDB] Clone Apply Begin Master Version Check
2024-07-11T18:50:12.040420+08:00 28 [Note] [MY-013457] [InnoDB] Clone Apply Version End Master Task ID: 0 Passed, code: 0: 
2024-07-11T18:50:12.114619+08:00 28 [Note] [MY-013457] [InnoDB] Clone Apply Begin Master Task

# ------------ 执行 DROP DATA 
2024-07-11T18:50:12.114914+08:00 28 [Warning] [MY-013460] [InnoDB] Clone removing all user data for provisioning: Started
2024-07-11T18:50:12.114969+08:00 28 [Note] [MY-011977] [InnoDB] Clone Drop all user data
2024-07-11T18:50:12.321760+08:00 28 [Note] [MY-011977] [InnoDB] Clone: Fix Object count: 237 task: 0
2024-07-11T18:50:12.674241+08:00 28 [Note] [MY-011977] [InnoDB] Clone Drop User schemas
2024-07-11T18:50:12.674478+08:00 28 [Note] [MY-011977] [InnoDB] Clone: Fix Object count: 7 task: 0
2024-07-11T18:50:12.697027+08:00 28 [Note] [MY-011977] [InnoDB] Clone Drop User tablespaces
2024-07-11T18:50:12.697581+08:00 28 [Note] [MY-011977] [InnoDB] Clone: Fix Object count: 6 task: 0
2024-07-11T18:50:12.697751+08:00 5 [Note] [MY-010596] [Repl] Error reading relay log event for channel '': replica SQL thread was killed
2024-07-11T18:50:12.700302+08:00 5 [Note] [MY-010587] [Repl] Replica SQL thread for channel '' exiting, replication stopped in log 'mysql-bin.000013' at position 214346682
2024-07-11T18:50:12.701469+08:00 6 [Note] [MY-011026] [Repl] Replica I/O thread killed while reading event for channel ''.
2024-07-11T18:50:12.701506+08:00 6 [Note] [MY-010570] [Repl] Replica I/O thread exiting for channel '', read up to log 'mysql-bin.000013', position 214346682
2024-07-11T18:50:12.750969+08:00 28 [Note] [MY-011977] [InnoDB] Clone Drop: finished successfully 
2024-07-11T18:50:12.751019+08:00 28 [Warning] [MY-013460] [InnoDB] Clone removing all user data for provisioning: Finished
# ------------ DROP DATA 完成

# ------------ 初始化克隆对象
2024-07-11T18:50:12.761260+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Command COM_INIT.'
2024-07-11T18:50:12.764870+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State Change : Number of tasks = 1

# ------------ 执行 FILE COPY 
2024-07-11T18:50:12.764910+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State FILE COPY: 
## ------------ 检查空间
2024-07-11T18:50:12.765045+08:00 28 [Note] [MY-011978] [InnoDB] Clone estimated size: 3.07 GiB Available space: 80.12 GiB
2024-07-11T18:50:17.795177+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Tune Threads from: 1 to: 2 prev: 1 target: 2.'
2024-07-11T18:50:17.829622+08:00 0 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Task Connect.'
2024-07-11T18:50:17.830867+08:00 0 [Note] [MY-013457] [InnoDB] Clone Apply Begin Task ID: 1
2024-07-11T18:50:17.830930+08:00 0 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Command COM_ATTACH.'
2024-07-11T18:50:22.849462+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Tune stop, Data: 111 MiB/sec, Target: 138 MiB/sec..'
2024-07-11T18:50:23.016512+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Total Data: 1096 MiB @ 106 MiB/sec, Network: 1096 MiB @ 106 MiB/sec.'
2024-07-11T18:50:23.177102+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State Change : Number of tasks = 2

# ------------ 执行 PAGE COPY 
2024-07-11T18:50:23.177204+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State PAGE COPY: 
2024-07-11T18:50:23.208658+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Total Data: 1096 MiB @ 104 MiB/sec, Network: 1096 MiB @ 104 MiB/sec.'
2024-07-11T18:50:23.409637+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State Change : Number of tasks = 2

# ------------ 执行 REDO COPY 
2024-07-11T18:50:23.409724+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State REDO COPY: 
2024-07-11T18:50:23.425450+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Total Data: 1096 MiB @ 102 MiB/sec, Network: 1096 MiB @ 102 MiB/sec.'
2024-07-11T18:50:23.637645+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State Change : Number of tasks = 2
2024-07-11T18:50:23.637705+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State FLUSH DATA: 
2024-07-11T18:50:23.642901+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State FLUSH REDO: 
2024-07-11T18:50:23.699285+08:00 28 [Note] [MY-013458] [InnoDB] Clone Apply State DONE
# ------------ Snapshot 生成完成

2024-07-11T18:50:23.699419+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Command COM_EXECUTE.'
2024-07-11T18:50:23.699919+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Source ACK COM_EXIT.'
2024-07-11T18:50:23.704058+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Source ACK Disconnect : abort: false.'
2024-07-11T18:50:23.714832+08:00 0 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Command COM_EXECUTE.'
2024-07-11T18:50:23.715377+08:00 0 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Task COM_EXIT.'
2024-07-11T18:50:23.719524+08:00 0 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Task Disconnect : abort: false.'
2024-07-11T18:50:23.719587+08:00 0 [Note] [MY-013457] [InnoDB] Clone Apply End Task ID: 1 Passed, code: 0: 
2024-07-11T18:50:23.720020+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Task COM_EXIT.'
2024-07-11T18:50:23.724435+08:00 28 [Note] [MY-013272] [Clone] Plugin Clone reported: 'Client: Task Disconnect : abort: false.'
2024-07-11T18:50:23.724652+08:00 28 [Note] [MY-013457] [InnoDB] Clone Apply End Master Task ID: 0 Passed, code: 0: 

# ------------ 准备 Restart
2024-07-11T18:50:23.726467+08:00 0 [Note] [MY-010067] [Server] Giving 2 client threads a chance to die gracefully
2024-07-11T18:50:23.726518+08:00 0 [Note] [MY-010117] [Server] Shutting down replica threads
2024-07-11T18:50:23.729101+08:00 0 [Note] [MY-010054] [Server] Event Scheduler: Killing the scheduler thread, thread id 20
2024-07-11T18:50:23.729144+08:00 0 [Note] [MY-010050] [Server] Event Scheduler: Waiting for the scheduler thread to reply
2024-07-11T18:50:23.729261+08:00 0 [Note] [MY-010048] [Server] Event Scheduler: Stopped
2024-07-11T18:50:23.729282+08:00 0 [Note] [MY-010118] [Server] Forcefully disconnecting 0 remaining clients
2024-07-11T18:50:23.729299+08:00 0 [Note] [MY-010043] [Server] Event Scheduler: Purging the queue. 0 events
2024-07-11T18:50:23.731800+08:00 0 [Note] [MY-012330] [InnoDB] FTS optimize thread exiting.
2024-07-11T18:50:24.303687+08:00 0 [Note] [MY-010120] [Server] Binlog end
2024-07-11T18:50:24.304852+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'rpl_semi_sync_slave'
2024-07-11T18:50:24.304909+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'rpl_semi_sync_master'
2024-07-11T18:50:24.304957+08:00 0 [Note] [MY-011175] [Repl] unregister_replicator OK.
2024-07-11T18:50:24.304982+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'clone'
2024-07-11T18:50:24.305011+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'mysqlx'
2024-07-11T18:50:24.305587+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'mysqlx_cache_cleaner'
2024-07-11T18:50:24.305622+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'ngram'
2024-07-11T18:50:24.305637+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'BLACKHOLE'
2024-07-11T18:50:24.305652+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'ARCHIVE'
2024-07-11T18:50:24.305665+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'TempTable'
2024-07-11T18:50:24.305677+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'MRG_MYISAM'
2024-07-11T18:50:24.305720+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'MyISAM'
2024-07-11T18:50:24.305761+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_SESSION_TEMP_TABLESPACES'
2024-07-11T18:50:24.305776+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_CACHED_INDEXES'
2024-07-11T18:50:24.305793+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_VIRTUAL'
2024-07-11T18:50:24.305806+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_COLUMNS'
2024-07-11T18:50:24.305818+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_TABLESPACES'
2024-07-11T18:50:24.305830+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_INDEXES'
2024-07-11T18:50:24.305842+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_TABLESTATS'
2024-07-11T18:50:24.305855+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_TABLES'
2024-07-11T18:50:24.305867+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2024-07-11T18:50:24.305884+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2024-07-11T18:50:24.305897+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_FT_CONFIG'
2024-07-11T18:50:24.305910+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2024-07-11T18:50:24.305922+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_FT_DELETED'
2024-07-11T18:50:24.305934+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2024-07-11T18:50:24.305965+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_METRICS'
2024-07-11T18:50:24.305978+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2024-07-11T18:50:24.305990+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2024-07-11T18:50:24.306002+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2024-07-11T18:50:24.306014+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_BUFFER_PAGE'
2024-07-11T18:50:24.306027+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2024-07-11T18:50:24.306052+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2024-07-11T18:50:24.306065+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_CMPMEM_RESET'
2024-07-11T18:50:24.306077+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_CMPMEM'
2024-07-11T18:50:24.306089+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_CMP_RESET'
2024-07-11T18:50:24.306101+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_CMP'
2024-07-11T18:50:24.306113+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'INNODB_TRX'
2024-07-11T18:50:24.306138+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'InnoDB'
2024-07-11T18:50:24.306193+08:00 0 [Note] [MY-013072] [InnoDB] Starting shutdown...
2024-07-11T18:50:24.306329+08:00 0 [Note] [MY-011944] [InnoDB] Dumping buffer pool(s) to /data/mysql/data/ib_buffer_pool
2024-07-11T18:50:24.307011+08:00 0 [Note] [MY-011944] [InnoDB] Buffer pool(s) dump completed at 240711 18:50:24
2024-07-11T18:50:24.325671+08:00 0 [Note] [MY-013084] [InnoDB] Log background threads are being closed...
2024-07-11T18:50:25.070774+08:00 0 [Note] [MY-013854] [InnoDB] Bytes written to disk by DBLWR (ON): 19136512
2024-07-11T18:50:25.072333+08:00 0 [Note] [MY-012980] [InnoDB] Shutdown completed; log sequence number 8732240733
2024-07-11T18:50:25.072448+08:00 0 [Note] [MY-012255] [InnoDB] Removed temporary tablespace data file: "ibtmp1"
2024-07-11T18:50:25.072507+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'MEMORY'
2024-07-11T18:50:25.072531+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'CSV'
2024-07-11T18:50:25.072572+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'PERFORMANCE_SCHEMA'
2024-07-11T18:50:25.072627+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'daemon_keyring_proxy_plugin'
2024-07-11T18:50:25.072660+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'sha2_cache_cleaner'
2024-07-11T18:50:25.072677+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'caching_sha2_password'
2024-07-11T18:50:25.072696+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'sha256_password'
2024-07-11T18:50:25.072711+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'mysql_native_password'
2024-07-11T18:50:25.074544+08:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'binlog'
2024-07-11T18:50:25.078462+08:00 0 [System] [MY-010910] [Server] /opt/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.34-26)  Percona Server (GPL), Release 26, Revision 0fe62c85.
## ------------ 停库完成

## ------------ 开始启库 + 恢复
2024-07-11T10:50:25.291176Z mysqld_safe Number of processes running now: 0
2024-07-11T10:50:25.296842Z mysqld_safe mysqld restarted
2024-07-11T18:50:25.324488+08:00 0 [Warning] [MY-010140] [Server] Could not increase number of max_open_files to more than 51200 (request: 65535)
2024-07-11T18:50:25.685375+08:00 0 [Warning] [MY-011070] [Server] 'binlog_format' is deprecated and will be removed in a future release.
2024-07-11T18:50:25.685546+08:00 0 [Warning] [MY-011069] [Server] The syntax '--master-info-repository' is deprecated and will be removed in a future release.
2024-07-11T18:50:25.685564+08:00 0 [Warning] [MY-011069] [Server] The syntax '--relay-log-info-repository' is deprecated and will be removed in a future release.
2024-07-11T18:50:25.685600+08:00 0 [Warning] [MY-011069] [Server] The syntax '--slave-rows-search-algorithms' is deprecated and will be removed in a future release.
2024-07-11T18:50:25.685625+08:00 0 [Warning] [MY-011069] [Server] The syntax '--replica-parallel-type' is deprecated and will be removed in a future release.
2024-07-11T18:50:25.685705+08:00 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2024-07-11T18:50:25.685769+08:00 0 [Note] [MY-010098] [Server] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2024-07-11T18:50:25.685786+08:00 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-log-path: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2024-07-11T18:50:25.686158+08:00 0 [Note] [MY-013932] [Server] BuildID[sha1]=341ee4de8331a0fea5dff56477b3902b40fbc001
2024-07-11T18:50:25.686177+08:00 0 [Note] [MY-010949] [Server] Basedir set to /opt/Percona-Server-8.0.34-26-Linux.x86_64.glibc2.17/.
2024-07-11T18:50:25.686190+08:00 0 [System] [MY-010116] [Server] /opt/mysql/bin/mysqld (mysqld 8.0.34-26) starting as process 25059
2024-07-11T18:50:25.711920+08:00 0 [Note] [MY-012366] [InnoDB] Using Linux native AIO
2024-07-11T18:50:25.712353+08:00 0 [Note] [MY-010747] [Server] Plugin 'FEDERATED' is disabled.
2024-07-11T18:50:25.712508+08:00 0 [Note] [MY-010747] [Server] Plugin 'ndbcluster' is disabled.
2024-07-11T18:50:25.712547+08:00 0 [Note] [MY-010747] [Server] Plugin 'ndbinfo' is disabled.
2024-07-11T18:50:25.712568+08:00 0 [Note] [MY-010747] [Server] Plugin 'ndb_transid_mysql_connection_map' is disabled.
2024-07-11T18:50:25.715839+08:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-07-11T18:50:25.716013+08:00 1 [Note] [MY-013546] [InnoDB] Atomic write enabled
2024-07-11T18:50:25.716097+08:00 1 [Note] [MY-012932] [InnoDB] PUNCH HOLE support available
2024-07-11T18:50:25.716155+08:00 1 [Note] [MY-012944] [InnoDB] Uses event mutexes
2024-07-11T18:50:25.716181+08:00 1 [Note] [MY-012945] [InnoDB] GCC builtin __atomic_thread_fence() is used for memory barrier
2024-07-11T18:50:25.716217+08:00 1 [Note] [MY-012948] [InnoDB] Compressed tables use zlib 1.2.13
2024-07-11T18:50:25.723479+08:00 1 [Note] [MY-012951] [InnoDB] Using hardware accelerated crc32 and polynomial multiplication.
2024-07-11T18:50:25.724461+08:00 1 [Note] [MY-012203] [InnoDB] Directories to scan './'
2024-07-11T18:50:25.724604+08:00 1 [Note] [MY-011976] [InnoDB] Clone Old File Roll Forward: Skipped cloned file ./#innodb_redo state: 101
2024-07-11T18:50:25.724704+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file /data/mysql/data/ib_buffer_pool state: 101
2024-07-11T18:50:25.724740+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file /data/mysql/data/ib_buffer_pool state: 101
2024-07-11T18:50:25.724778+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file ibdata1 state: 101
2024-07-11T18:50:25.724809+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file ibdata1 state: 101
2024-07-11T18:50:25.724846+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file ibdata2 state: 101
2024-07-11T18:50:25.724874+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file ibdata2 state: 101
2024-07-11T18:50:25.724917+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file sys/sys_config.ibd state: 101
2024-07-11T18:50:25.724959+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file sys/sys_config.ibd state: 101
2024-07-11T18:50:25.725003+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file mysql.ibd state: 101
2024-07-11T18:50:25.725032+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file mysql.ibd state: 101
2024-07-11T18:50:25.725075+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file ./undo_002 state: 101
2024-07-11T18:50:25.725106+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file ./undo_002 state: 101
2024-07-11T18:50:25.725152+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file ./undo_001 state: 101
2024-07-11T18:50:25.725182+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file ./undo_001 state: 101
2024-07-11T18:50:25.725222+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Save data file ./#innodb_redo state: 101
2024-07-11T18:50:25.725255+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Rename clone to data file ./#innodb_redo state: 101
2024-07-11T18:50:25.725411+08:00 1 [Note] [MY-012204] [InnoDB] Scanning './'
2024-07-11T18:50:25.737979+08:00 1 [Note] [MY-012208] [InnoDB] Completed space ID check of 53 files.
2024-07-11T18:50:25.740238+08:00 1 [Note] [MY-012955] [InnoDB] Initializing buffer pool, total size = 4.000000G, instances = 8, chunk size =128.000000M 
2024-07-11T18:50:25.983183+08:00 1 [Note] [MY-012957] [InnoDB] Completed initialization of buffer pool
2024-07-11T18:50:26.020219+08:00 0 [Note] [MY-011952] [InnoDB] If the mysqld execution user is authorized, page cleaner and LRU manager thread priority can be changed. See the man page of setpriority().
2024-07-11T18:50:26.022026+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_0.dblwr' for doublewrite
2024-07-11T18:50:26.022663+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_1.dblwr' for doublewrite
2024-07-11T18:50:26.046721+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_2.dblwr' for doublewrite
2024-07-11T18:50:26.047247+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_3.dblwr' for doublewrite
2024-07-11T18:50:26.050317+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_4.dblwr' for doublewrite
2024-07-11T18:50:26.050656+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_5.dblwr' for doublewrite
2024-07-11T18:50:26.053788+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_6.dblwr' for doublewrite
2024-07-11T18:50:26.054163+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_7.dblwr' for doublewrite
2024-07-11T18:50:26.057328+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_8.dblwr' for doublewrite
2024-07-11T18:50:26.057699+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_9.dblwr' for doublewrite
2024-07-11T18:50:26.060685+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_10.dblwr' for doublewrite
2024-07-11T18:50:26.061067+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_11.dblwr' for doublewrite
2024-07-11T18:50:26.064219+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_12.dblwr' for doublewrite
2024-07-11T18:50:26.064623+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_13.dblwr' for doublewrite
2024-07-11T18:50:26.067714+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_14.dblwr' for doublewrite
2024-07-11T18:50:26.068210+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_15.dblwr' for doublewrite
2024-07-11T18:50:26.072546+08:00 1 [Note] [MY-013566] [InnoDB] Double write buffer files: 16
2024-07-11T18:50:26.072585+08:00 1 [Note] [MY-013565] [InnoDB] Double write buffer pages per instance: 8
2024-07-11T18:50:26.072631+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_0.dblwr' for doublewrite
2024-07-11T18:50:26.072680+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_1.dblwr' for doublewrite
2024-07-11T18:50:26.072723+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_2.dblwr' for doublewrite
2024-07-11T18:50:26.072765+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_3.dblwr' for doublewrite
2024-07-11T18:50:26.072809+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_4.dblwr' for doublewrite
2024-07-11T18:50:26.072851+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_5.dblwr' for doublewrite
2024-07-11T18:50:26.072894+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_6.dblwr' for doublewrite
2024-07-11T18:50:26.072951+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_7.dblwr' for doublewrite
2024-07-11T18:50:26.073002+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_8.dblwr' for doublewrite
2024-07-11T18:50:26.073050+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_9.dblwr' for doublewrite
2024-07-11T18:50:26.073094+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_10.dblwr' for doublewrite
2024-07-11T18:50:26.073148+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_11.dblwr' for doublewrite
2024-07-11T18:50:26.073193+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_12.dblwr' for doublewrite
2024-07-11T18:50:26.073236+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_13.dblwr' for doublewrite
2024-07-11T18:50:26.073278+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_14.dblwr' for doublewrite
2024-07-11T18:50:26.073320+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_15.dblwr' for doublewrite
2024-07-11T18:50:26.140787+08:00 1 [Note] [MY-012556] [InnoDB] Opening cloned database
2024-07-11T18:50:26.142069+08:00 1 [Note] [MY-013883] [InnoDB] The latest found checkpoint is at lsn = 6899811493 in redo log file ./#innodb_redo/#ib_redo0.
2024-07-11T18:50:26.142164+08:00 1 [Note] [MY-012560] [InnoDB] The log sequence number 22002059 in the system tablespace does not match the log sequence number 6899811493 in the redo log files!
2024-07-11T18:50:26.142193+08:00 1 [Note] [MY-012551] [InnoDB] Database was not shutdown normally!
2024-07-11T18:50:26.142210+08:00 1 [Note] [MY-012552] [InnoDB] Starting crash recovery.
2024-07-11T18:50:26.142616+08:00 1 [Note] [MY-013086] [InnoDB] Starting to parse redo log at lsn = 6899811365, whereas checkpoint_lsn = 6899811493 and start_lsn = 6899811328
2024-07-11T18:50:26.142657+08:00 1 [Note] [MY-012550] [InnoDB] Doing recovery: scanned up to log sequence number 6899812851
2024-07-11T18:50:26.163383+08:00 1 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2024-07-11T18:50:26.164375+08:00 1 [Note] [MY-012532] [InnoDB] Applying a batch of 6 redo log records ...
2024-07-11T18:50:26.166000+08:00 1 [Note] [MY-012533] [InnoDB] 100%
2024-07-11T18:50:26.667551+08:00 1 [Note] [MY-012535] [InnoDB] Apply batch completed!
2024-07-11T18:50:26.668635+08:00 1 [Note] [MY-013084] [InnoDB] Log background threads are being closed...
2024-07-11T18:50:26.669744+08:00 1 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2024-07-11T18:50:26.671101+08:00 1 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_001'.
2024-07-11T18:50:26.671398+08:00 1 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_002'.
2024-07-11T18:50:26.672626+08:00 1 [Note] [MY-012910] [InnoDB] Opened 2 existing undo tablespaces.
2024-07-11T18:50:26.672719+08:00 1 [Note] [MY-011980] [InnoDB] GTID recovery trx_no: 22476496
2024-07-11T18:50:26.699065+08:00 1 [Note] [MY-013776] [InnoDB] Parallel initialization of rseg complete
2024-07-11T18:50:26.699168+08:00 1 [Note] [MY-013777] [InnoDB] Time taken to initialize rseg using 4 thread: 26453 ms.
2024-07-11T18:50:26.699323+08:00 1 [Note] [MY-012923] [InnoDB] Creating shared tablespace for temporary tables
2024-07-11T18:50:26.699414+08:00 1 [Note] [MY-012265] [InnoDB] Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2024-07-11T18:50:26.711630+08:00 1 [Note] [MY-012266] [InnoDB] File './ibtmp1' size is now 12 MB.
2024-07-11T18:50:26.711878+08:00 1 [Note] [MY-013627] [InnoDB] Scanning temp tablespace dir:'./#innodb_temp/'
2024-07-11T18:50:26.723126+08:00 1 [Note] [MY-013018] [InnoDB] Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active.
2024-07-11T18:50:26.723603+08:00 1 [Note] [MY-011976] [InnoDB] Clone Old File Roll Forward: Skipped cloned file ./#innodb_redo state: 11
2024-07-11T18:50:26.723774+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file /data/mysql/data/ib_buffer_pool state: 11
2024-07-11T18:50:26.835606+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file ibdata1 state: 11
2024-07-11T18:50:26.836567+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file ibdata2 state: 11
2024-07-11T18:50:26.836705+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file sys/sys_config.ibd state: 11
2024-07-11T18:50:26.837073+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file mysql.ibd state: 11
2024-07-11T18:50:26.837179+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file ./undo_002 state: 11
2024-07-11T18:50:26.837256+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file ./undo_001 state: 11
2024-07-11T18:50:26.859421+08:00 1 [Note] [MY-011976] [InnoDB] Clone File Roll Forward: Remove saved data file ./#innodb_redo state: 11
2024-07-11T18:50:26.859658+08:00 1 [Note] [MY-012976] [InnoDB] Percona XtraDB (http://www.percona.com) 8.0.34-26 started; log sequence number 6899812877
2024-07-11T18:50:26.860311+08:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-07-11T18:50:26.875103+08:00 1 [Note] [MY-011089] [Server] Data dictionary restarting version '80023'.
2024-07-11T18:50:27.031590+08:00 1 [Note] [MY-012357] [InnoDB] Reading DD tablespace files
2024-07-11T18:50:27.048770+08:00 1 [Note] [MY-012356] [InnoDB] Scanned 55 tablespaces. Validated 55.
2024-07-11T18:50:27.048901+08:00 1 [Note] [MY-011977] [InnoDB] Clone Fixup: check and create schema directory
2024-07-11T18:50:27.049401+08:00 1 [Note] [MY-011977] [InnoDB] Clone: Fix Object count: 7 task: 0
2024-07-11T18:50:27.049619+08:00 1 [Note] [MY-011977] [InnoDB] Clone Fixup: create empty MyIsam and CSV tables
2024-07-11T18:50:27.225710+08:00 1 [Note] [MY-011977] [InnoDB] Clone: Fix Object count: 1 task: 2
2024-07-11T18:50:27.225744+08:00 0 [Note] [MY-011977] [InnoDB] Clone: Fix Object count: 118 task: 1
2024-07-11T18:50:27.225718+08:00 0 [Note] [MY-011977] [InnoDB] Clone: Fix Object count: 118 task: 0
2024-07-11T18:50:27.230688+08:00 1 [Note] [MY-011977] [InnoDB] Clone Fixup: replication configuration tables
2024-07-11T18:50:27.230801+08:00 1 [Note] [MY-011977] [InnoDB] Clone Fixup: finished successfully
2024-07-11T18:50:27.249750+08:00 1 [Note] [MY-010006] [Server] Using data dictionary with version '80023'.
2024-07-11T18:50:27.270062+08:00 0 [Note] [MY-011332] [Server] Plugin mysqlx reported: 'IPv6 is available'
2024-07-11T18:50:27.279026+08:00 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. bind-address: '::' port: 33060'
2024-07-11T18:50:27.279120+08:00 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. socket: '/tmp/mysqlx.sock''
2024-07-11T18:50:27.287381+08:00 0 [Warning] [MY-010918] [Repl] 'rpl_semi_sync_master' is deprecated and will be removed in a future release. Please use rpl_semi_sync_source instead.
2024-07-11T18:50:27.287498+08:00 0 [Warning] [MY-010918] [Repl] 'rpl_semi_sync_slave' is deprecated and will be removed in a future release. Please use rpl_semi_sync_replica instead.
2024-07-11T18:50:27.288038+08:00 0 [Note] [MY-010990] [Server] Resource group feature shall not be available. Incompatible thread handling option.
2024-07-11T18:50:27.317272+08:00 0 [Note] [MY-010856] [Server] Failed to open the crashed binlog file when source server is recovering it.
2024-07-11T18:50:27.336054+08:00 0 [Note] [MY-013911] [Server] Crash recovery finished in binlog engine. No attempts to commit, rollback or prepare any transactions.
2024-07-11T18:50:27.336142+08:00 0 [Note] [MY-013911] [Server] Crash recovery finished in InnoDB engine. No attempts to commit, rollback or prepare any transactions.
2024-07-11T18:50:27.342726+08:00 0 [Note] [MY-012487] [InnoDB] DDL log recovery : begin
2024-07-11T18:50:27.343162+08:00 0 [Note] [MY-012488] [InnoDB] DDL log recovery : end
2024-07-11T18:50:27.343445+08:00 0 [Note] [MY-011946] [InnoDB] Loading buffer pool(s) from /data/mysql/data/ib_buffer_pool
2024-07-11T18:50:27.360325+08:00 0 [Note] [MY-010182] [Server] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2024-07-11T18:50:27.360383+08:00 0 [Note] [MY-010304] [Server] Skipping generation of SSL certificates as certificate files are present in data directory.
2024-07-11T18:50:27.362016+08:00 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-07-11T18:50:27.362086+08:00 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-07-11T18:50:27.362159+08:00 0 [Note] [MY-010308] [Server] Skipping generation of RSA key pair through --sha256_password_auto_generate_rsa_keys as key files are present in data directory.
2024-07-11T18:50:27.362184+08:00 0 [Note] [MY-010308] [Server] Skipping generation of RSA key pair through --caching_sha2_password_auto_generate_rsa_keys as key files are present in data directory.
2024-07-11T18:50:27.362459+08:00 0 [Note] [MY-010252] [Server] Server hostname (bind-address): '*'; port: 3306
2024-07-11T18:50:27.362510+08:00 0 [Note] [MY-010253] [Server] IPv6 is available.
2024-07-11T18:50:27.362529+08:00 0 [Note] [MY-010264] [Server]   - '::' resolves to '::';
2024-07-11T18:50:27.362549+08:00 0 [Note] [MY-010251] [Server] Server socket created on IP: '::'.
2024-07-11T18:50:27.406170+08:00 0 [Note] [MY-011946] [InnoDB] Buffer pool(s) load completed at 240711 18:50:27
2024-07-11T18:50:27.411920+08:00 0 [Note] [MY-011025] [Repl] Failed to start replica threads for channel ''.
2024-07-11T18:50:27.414731+08:00 5 [Note] [MY-010051] [Server] Event Scheduler: scheduler thread started with id 5
2024-07-11T18:50:27.414786+08:00 0 [Note] [MY-011240] [Server] Plugin mysqlx reported: 'Using SSL configuration from MySQL Server'
2024-07-11T18:50:27.415632+08:00 0 [Note] [MY-011243] [Server] Plugin mysqlx reported: 'Using OpenSSL for TLS connections'
2024-07-11T18:50:27.415865+08:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2024-07-11T18:50:27.415876+08:00 0 [System] [MY-010931] [Server] /opt/mysql/bin/mysqld: ready for connections. Version: '8.0.34-26'  socket: '/data/mysql/data/mysql.sock'  port: 3306  Percona Server (GPL), Release 26, Revision 0fe62c85.

附:参考资料

[1]《MySQL 8.0 Reference Manual:7.6.7 The Clone Plugin
[2]《MySQL 8.0 Reference Manual:7.6.7.12 Clone System Variable Reference
[3]《MySQL 8.0 Reference Manual:20.5.4.2 Cloning for Distributed Recovery
[4]《WL#9209: InnoDB: Clone local replica
[5]《数据库内核月报:MySQL · 引擎特性 · clone_plugin

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值