---
title: 观察 OceanBase 数据库创建索引进度-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于 观察 OceanBase 数据库创建索引进度相关的常见问题和使用技巧，帮助您快速解决 观察 OceanBase 数据库创建索引进度的难题。
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# 观察 OceanBase 数据库创建索引进度

更新时间：2025-07-25 08:46

适用版本： V2.2.x、V3.1.x、V3.2.x 内容类型：How-to  

在 OceanBase 数据库中，创建索引是一个多阶段的过程。了解索引创建的不同阶段以及如何观察每个阶段的进度对于数据库管理和性能优化至关重要。本文介绍如何观察 OceanBase 数据库创建索引的进度。

## 索引创建的阶段

OceanBase 数据库创建索引的过程主要可以分为以下几个阶段：

1. 准备阶段：生成索引表的元数据信息，索引表设置为只写状态；等待之前未向索引表插入数据的事务结束，获取构建快照点。
 2. 构建阶段：基于获取的快照点扫描主表数据，并将数据写入索引表基线 SSTable 中，同时将增量事务产生的数据写入到 MemTable 中，并完成基线补全，即将快照点后的 DML 操作同步到索引中。
 3. 拷贝阶段：索引构建在单副本上完成后，会通过一致性算法将数据同步到索引表的多个副本中。
 4. 收尾阶段：进行数据校验，对于唯一索引还需要进行唯一性校验。完成后索引表设置成可读写状态，否则设置为不可用状态。

## 观察全局索引创建过程

全局索引主要依靠观察 __all_index_build_stat 信息表定位创建到哪个阶段。

![uiyo8-u89iuo6-78yu60p-897uio6](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/sql/20240123index01.png)

该表的 status 列值对应如下：

0 = invalid，创建本地索引时观察该值为 0 1 = 单副本构建 2 = 多副本拷贝 3 = 校验唯一性 4 = 校验和比对 5 = 设置索引生效 6 = 构建索引失败 7 = 构建索引完成

以下示例基于 OceanBase 数据库 V2.2.77 版本，MySQL 租户。

1. 准备阶段。

   a. 查看建表语句。

   ```shell
   mysql> show create table t1;
   +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Table | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
   +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | t1    | CREATE TABLE `t1` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `k` int(11) NOT NULL DEFAULT '0',
   `c` char(120) NOT NULL DEFAULT '',
   `pad` char(60) NOT NULL DEFAULT '',
   PRIMARY KEY (`id`, `k`)) AUTO_INCREMENT = 12000001 DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.0' REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
   partition by hash(k)
   (partition p0,
   partition p1,
   partition p2,
   partition p3,
   partition p4) |
   +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

   ```

   b. 执行建索引语句。

   ```shell
   mysql> create index idx_pad on t1(pad) global;

   ```

   c. 在等待事务结束时，查询 __all_index_build_stat 表 status 列为 1，快照点 snapshot 为 0。

   ```shell
   mysql> select * from __all_index_build_stat;

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+----------+------------------+
   | gmt_create                 | gmt_modified               | tenant_id | data_table_id    | index_table_id   | status | snapshot | schema_version   |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+----------+------------------+
   | 2022-04-05 19:19:25.503550 | 2022-04-05 19:19:25.503550 |      1014 | 1114904790615059 | 1114904790615064 |      1 |        0 | 1649157565414240 |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+----------+------------------+

   ```
 2. 构建阶段。

   a. 观察 __all_index_build_stat，status 为 1，已获取快照点 snapshot。

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+
   | gmt_create                 | gmt_modified               | tenant_id | data_table_id    | index_table_id   | status | snapshot         | schema_version   |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+
   | 2022-04-05 19:19:25.503550 | 2022-04-05 19:19:47.551521 |      1014 | 1114904790615059 | 1114904790615064 |      1 | 1649157587510214 | 1649157565414240 |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+

   ```

   b. 观察 __all_virtual_table_mgr，已完成 MemTable 创建（table_type=0）。

   ```shell
   mysql> select * from __all_virtual_table_mgr where index_id in (select index_table_id from __all_index_build_stat);

   ```

   输出结果如下：

   ```shell
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+------+-----------+-----+-----------+-----------+
   | svr_ip      | svr_port | tenant_id | table_type | table_id         | partition_id | index_id         | base_version     | multi_version_start | snapshot_version    | version | logical_data_version | size | is_active | ref | write_ref | trx_count |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+------+-----------+-----+-----------+-----------+
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |    0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |    0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |    0 |         1 |   2 |         0 |         0 |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+------+-----------+-----+-----------+-----------+

   ```

   c. 观察 __all_virtual_sys_task_status，每个分区都有一个 create index 任务。

   ```shell
   mysql> select * from __all_virtual_sys_task_status;

   ```

   输出结果如下：

   ```shell
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | start_time                 | task_type    | task_id                       | svr_ip      | svr_port | tenant_id | comment                                                                                                                                                                                    | is_cancel |
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | 2022-04-05 19:19:48.632648 | create index | YB420B973EA3-0005D1DBCF659889 | xx.xx.xx.xx |     2882 |      1014 | build index task, tenant_id=1014, task_id={ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:0, task_cnt:5} |         0 |
   | 2022-04-05 19:19:48.633941 | create index | YB420B973EA3-0005D1DBCF65988A | xx.xx.xx.xx |     2882 |      1014 | build index task, tenant_id=1014, task_id={ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:1, task_cnt:5} |         0 |
   | 2022-04-05 19:19:48.635211 | create index | YB420B973EA3-0005D1DBCF65988B | xx.xx.xx.xx |     2882 |      1014 | build index task, tenant_id=1014, task_id={ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:2, task_cnt:5} |         0 |
   | 2022-04-05 19:19:48.636490 | create index | YB420B973EA3-0005D1DBCF65988C | xx.xx.xx.xx |     2882 |      1014 | build index task, tenant_id=1014, task_id={ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:3, task_cnt:5} |         0 |
   | 2022-04-05 19:19:48.637767 | create index | YB420B973EA3-0005D1DBCF65988D | xx.xx.xx.xx |     2882 |      1014 | build index task, tenant_id=1014, task_id={ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:4, task_cnt:5} |         0 |
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+

   ```

   d. 观察 __all_virtual_rebalance_task_stat，每个分区都有一个 SQL_BACKGROUND_DIST_TASK 任务。

   ```shell
   mysql> select * from __all_virtual_rebalance_task_stat;

   ```

   输出结果如下：

   ```shell
   +-----------+------------------+--------------+-----------------+-----------+-------------+------------------+-----------+--------------+--------------------------+--------------+-----------+--------------+----------------+
   | tenant_id | table_id         | partition_id | partition_count | source    | data_source | destination      | offline   | is_replicate | task_type                | is_scheduled | is_manual | waiting_time | executing_time |
   +-----------+------------------+--------------+-----------------+-----------+-------------+------------------+-----------+--------------+--------------------------+--------------+-----------+--------------+----------------+
   |      1014 | 1114904790615059 |            0 |               0 | 0.0.0.0:0 | 0.0.0.0:0   | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | SQL_BACKGROUND_DIST_TASK | Yes          | No        |           56 |         326548 |
   |      1014 | 1114904790615059 |            1 |               0 | 0.0.0.0:0 | 0.0.0.0:0   | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | SQL_BACKGROUND_DIST_TASK | Yes          | No        |         1374 |         325151 |
   |      1014 | 1114904790615059 |            2 |               0 | 0.0.0.0:0 | 0.0.0.0:0   | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | SQL_BACKGROUND_DIST_TASK | Yes          | No        |         2550 |         323916 |
   |      1014 | 1114904790615059 |            3 |               0 | 0.0.0.0:0 | 0.0.0.0:0   | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | SQL_BACKGROUND_DIST_TASK | Yes          | No        |         3793 |         322623 |
   |      1014 | 1114904790615059 |            4 |               0 | 0.0.0.0:0 | 0.0.0.0:0   | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | SQL_BACKGROUND_DIST_TASK | Yes          | No        |         5025 |         321342 |
   +-----------+------------------+--------------+-----------------+-----------+-------------+------------------+-----------+--------------+--------------------------+--------------+-----------+--------------+----------------+

   ```

   e. 观察 __all_index_checksum，暂无 checksum 信息。

   ```shell
   mysql> select count(*) from __all_index_checksum where gmt_create>'2022-04-05 19:19:00' and tenant_id=1014;

   ```

   输出结果如下：

   ```shell
   +----------+
   | count(*) |
   +----------+
   |        0 |
   +----------+

   ```

   f. 观察 __all_virtual_sys_task_status，有一个 create index 任务。

   ```

   输出结果如下：

   ```shell
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | start_time                 | task_type    | task_id                       | svr_ip      | svr_port | tenant_id | comment                                                                                                                                                                                    | is_cancel |
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | 2022-04-05 19:19:50.958727 | create index | YB420B973EA3-0005D1DBCF65988E | xx.xx.xx.xx |     2882 |      1014 | build index task, tenant_id=1014, task_id={ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:3}, task_id:0, task_cnt:1} |         0 |
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+

   ```

   g. 观察 __all_virtual_rebalance_task_stat，有一个 SQL_BACKGROUND_DIST_TASK 任务。

   ```

   输出结果如下：

   ```shell
   +-----------+------------------+--------------+-----------------+-----------+-------------+------------------+-----------+--------------+--------------------------+--------------+-----------+--------------+----------------+
   | tenant_id | table_id         | partition_id | partition_count | source    | data_source | destination      | offline   | is_replicate | task_type                | is_scheduled | is_manual | waiting_time | executing_time |
   +-----------+------------------+--------------+-----------------+-----------+-------------+------------------+-----------+--------------+--------------------------+--------------+-----------+--------------+----------------+
   |      1014 | 1114904790615064 |            0 |               0 | 0.0.0.0:0 | 0.0.0.0:0   | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | SQL_BACKGROUND_DIST_TASK | Yes          | No        |           41 |        3646335 |
   +-----------+------------------+--------------+-----------------+-----------+-------------+------------------+-----------+--------------+--------------------------+--------------+-----------+--------------+----------------+

   ```

   h. 观察 __all_index_checksum，发现有 5 个分区的索引列（pad）、主键列（id、k）信息，5x3=15。

   ```

   输出结果如下：

   ```shell
   +----------+
   | count(*) |
   +----------+
   |       15 |
   +----------+

   ```

   i. 观察 __all_virtual_sys_task_status，暂无任务信息。

   ```shell
   mysql> select * from __all_virtual_sys_task_status;
   Empty set (0.01 sec)

   ```

   j. 观察 __all_virtual_rebalance_task_stat，暂无任务信息。

   ```shell
   mysql> select * from __all_virtual_rebalance_task_stat;
   Empty set (0.01 sec)

   ```

   k. 观察 __all_index_checksum，发现多出了全局索引表的 checksum 信息。

   ```

   输出结果如下：

   ```shell
   +----------+
   | count(*) |
   +----------+
   |       18 |
   +----------+

   ```

   l. 观察 __all_index_checksum 内容（以下内容为重建索引获取，会存在索引表 id 不一致情况）：

   ```shell
   mysql> select * from __all_index_checksum where gmt_create>'2022-04-05 20:10:00' and tenant_id=1014 order by column_id;

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+---------------------+-----------+------------------+--------------+-----------+---------+-------------------+-----------------+
   | gmt_create                 | gmt_modified               | execution_id        | tenant_id | table_id         | partition_id | column_id | task_id | checksum          | checksum_method |
   +----------------------------+----------------------------+---------------------+-----------+------------------+--------------+-----------+---------+-------------------+-----------------+
   | 2022-04-05 20:10:45.452655 | 2022-04-05 20:10:45.452655 | 4611686018427387911 |      1014 | 1114904790615059 |            0 |        16 |       0 |  4294189217994805 |               2 |
   | 2022-04-05 20:10:45.394463 | 2022-04-05 20:10:45.394463 | 4611686018427387911 |      1014 | 1114904790615059 |            1 |        16 |       1 |  4293460459368680 |               2 |
   | 2022-04-05 20:11:45.061528 | 2022-04-05 20:11:45.061528 | 4611686018427387911 |      1014 | 1114904790615068 |            0 |        16 |       0 | 21474837339484641 |               2 |
   | 2022-04-05 20:10:45.442407 | 2022-04-05 20:10:45.442407 | 4611686018427387911 |      1014 | 1114904790615059 |            2 |        16 |       2 |  4294471659607893 |               2 |
   | 2022-04-05 20:10:45.377162 | 2022-04-05 20:10:45.377162 | 4611686018427387911 |      1014 | 1114904790615059 |            4 |        16 |       4 |  4291068240165421 |               2 |
   | 2022-04-05 20:10:45.391626 | 2022-04-05 20:10:45.391626 | 4611686018427387911 |      1014 | 1114904790615059 |            3 |        16 |       3 |  4301647762347842 |               2 |
   | 2022-04-05 20:10:45.452655 | 2022-04-05 20:10:45.452655 | 4611686018427387911 |      1014 | 1114904790615059 |            0 |        17 |       0 |  4294529994534407 |               2 |
   | 2022-04-05 20:11:45.061528 | 2022-04-05 20:11:45.061528 | 4611686018427387911 |      1014 | 1114904790615068 |            0 |        17 |       0 | 21478992387389366 |               2 |
   | 2022-04-05 20:10:45.377162 | 2022-04-05 20:10:45.377162 | 4611686018427387911 |      1014 | 1114904790615059 |            4 |        17 |       4 |  4295367552394642 |               2 |
   | 2022-04-05 20:10:45.391626 | 2022-04-05 20:10:45.391626 | 4611686018427387911 |      1014 | 1114904790615059 |            3 |        17 |       3 |  4296764324236270 |               2 |
   | 2022-04-05 20:10:45.442407 | 2022-04-05 20:10:45.442407 | 4611686018427387911 |      1014 | 1114904790615059 |            2 |        17 |       2 |  4299921221083111 |               2 |
   | 2022-04-05 20:10:45.394463 | 2022-04-05 20:10:45.394463 | 4611686018427387911 |      1014 | 1114904790615059 |            1 |        17 |       1 |  4292409295140936 |               2 |
   | 2022-04-05 20:10:45.442407 | 2022-04-05 20:10:45.442407 | 4611686018427387911 |      1014 | 1114904790615059 |            2 |        19 |       2 |  4296268846119605 |               2 |
   | 2022-04-05 20:10:45.391626 | 2022-04-05 20:10:45.391626 | 4611686018427387911 |      1014 | 1114904790615059 |            3 |        19 |       3 |  4300722872371463 |               2 |
   | 2022-04-05 20:10:45.394463 | 2022-04-05 20:10:45.394463 | 4611686018427387911 |      1014 | 1114904790615059 |            1 |        19 |       1 |  4289982707443986 |               2 |
   | 2022-04-05 20:10:45.377162 | 2022-04-05 20:10:45.377162 | 4611686018427387911 |      1014 | 1114904790615059 |            4 |        19 |       4 |  4293685226392460 |               2 |
   | 2022-04-05 20:10:45.452655 | 2022-04-05 20:10:45.452655 | 4611686018427387911 |      1014 | 1114904790615059 |            0 |        19 |       0 |  4292840718037296 |               2 |
   | 2022-04-05 20:11:45.061528 | 2022-04-05 20:11:45.061528 | 4611686018427387911 |      1014 | 1114904790615068 |            0 |        19 |       0 | 21473500370364810 |               2 |
   +----------------------------+----------------------------+---------------------+-----------+------------------+--------------+-----------+---------+-------------------+-----------------+

   ```

   m. 求和 checksum。

   ```shell
   mysql> select 4294189217994805+4293460459368680+4294471659607893+4291068240165421+4301647762347842;

   ```

   输出结果如下：

   ```shell
   +--------------------------------------------------------------------------------------+
   | 4294189217994805+4293460459368680+4294471659607893+4291068240165421+4301647762347842 |
   +--------------------------------------------------------------------------------------+
   |                                                                    21474837339484641 |
   +--------------------------------------------------------------------------------------+

   ```
 3. 拷贝阶段。

   a. 观察 __all_index_build_stat，status 为 2，已进入多副本拷贝阶段。

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+
   | gmt_create                 | gmt_modified               | tenant_id | data_table_id    | index_table_id   | status | snapshot         | schema_version   |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+
   | 2022-04-05 19:19:25.503550 | 2022-04-05 19:20:53.331745 |      1014 | 1114904790615059 | 1114904790615064 |      2 | 1649157587510214 | 1649157565414240 |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+

   ```

   b. 观察 __all_virtual_table_mgr，发现正在拷贝基线 SSSTable（table_type=1）。

   ```

   输出结果如下：

   ```shell
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+-----------+-----------+-----+-----------+-----------+
   | svr_ip      | svr_port | tenant_id | table_type | table_id         | partition_id | index_id         | base_version     | multi_version_start | snapshot_version    | version | logical_data_version | size      | is_active | ref | write_ref | trx_count |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+-----------+-----------+-----+-----------+-----------+
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |         0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |         0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615064 |            0 | 1114904790615064 |                0 |    1649157587510214 |    1649157587510214 |     298 |                  298 | 293289439 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |         0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615064 |            0 | 1114904790615064 |                0 |    1649157587510214 |    1649157587510214 |     298 |                  298 | 293289439 |         0 |   3 |         0 |         0 |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+-----------+-----------+-----+-----------+-----------+

   ```

   c. 观察 __all_virtual_sys_task_status，发现 migration 任务。

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-------------------------------+-------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | start_time                 | task_type                  | task_id                       | svr_ip      | svr_port | tenant_id | comment                                                                                                                                                                                                                                                 | is_cancel |
   +----------------------------+----------------------------+-------------------------------+-------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | 2022-04-05 19:20:56.134953 | group partition migration  | YB420B277B81-0005C4F9E6B7E579 | xx.xx.xx.xx |     2882 |      1014 | group partition migration executor: group_task_id=YB420B277B81-0005C4F9E6B7E579 partition_count=1 partition_id=0 key={tid:1114904790615064, partition_id:0, part_cnt:0}, op_type=COPY_GLOBAL_INDEX_OP, src="xx.xx.xx.xx:xxxx", dest="xx.xx.xx.xx:xxxx", |         0 |
   | 2022-04-05 19:20:56.137597 | single partition migration | YB420B277B81-0005C4F9C3F84711 | xx.xx.xx.xx |     2882 |      1014 | single partition migration: group_task_id=YB420B277B81-0005C4F9E6B7E579 key={tid:1114904790615064, partition_id:0, part_cnt:0}, op_type=COPY_GLOBAL_INDEX_OP, src="xx.xx.xx.xx:xxxx", dest="xx.xx.xx.xx:xxxx",dest_memstore_percent=100                 |         0 |
   +----------------------------+----------------------------+-------------------------------+-------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+

   ```

   d. 观察 __all_virtual_rebalance_task_stat，发现 COPY_SSTABLE 任务。

   ```

   输出结果如下：

   ```shell
   +-----------+------------------+--------------+-----------------+------------------+------------------+------------------+-----------+--------------+--------------+--------------+-----------+--------------+----------------+
   | tenant_id | table_id         | partition_id | partition_count | source           | data_source      | destination      | offline   | is_replicate | task_type    | is_scheduled | is_manual | waiting_time | executing_time |
   +-----------+------------------+--------------+-----------------+------------------+------------------+------------------+-----------+--------------+--------------+--------------+-----------+--------------+----------------+
   |      1014 | 1114904790615064 |            0 |               0 | xx.xx.xx.xx:xxxx | xx.xx.xx.xx:xxxx | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | COPY_SSTABLE | Yes          | No        |           57 |         452611 |
   +-----------+------------------+--------------+-----------------+------------------+------------------+------------------+-----------+--------------+--------------+--------------+-----------+--------------+----------------+

   ```
 4. 收尾阶段。

   a. 观察 __all_index_build_stat，status 为 5，设置索引表生效。

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+
   | gmt_create                 | gmt_modified               | tenant_id | data_table_id    | index_table_id   | status | snapshot         | schema_version   |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+
   | 2022-04-05 19:19:25.503550 | 2022-04-05 19:20:58.114574 |      1014 | 1114904790615059 | 1114904790615064 |      5 | 1649157587510214 | 1649157565414240 |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+------------------+------------------+

   ```

   b. 观察 __all_virtual_table_mgr，发现基线 SSTable（table_type=1）已补齐。

   ```

   输出结果如下：

   ```shell
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+-----------+-----------+-----+-----------+-----------+
   | svr_ip      | svr_port | tenant_id | table_type | table_id         | partition_id | index_id         | base_version     | multi_version_start | snapshot_version    | version | logical_data_version | size      | is_active | ref | write_ref | trx_count |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+-----------+-----------+-----+-----------+-----------+
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |         0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |         0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615064 |            0 | 1114904790615064 |                0 |    1649157587510214 |    1649157587510214 |     298 |                  298 | 293289439 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          0 | 1114904790615064 |            0 | 1114904790615064 | 1649095210272570 |    1649095210272570 | 9223372036854775807 |       0 |                    0 |         0 |         1 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615064 |            0 | 1114904790615064 |                0 |    1649157587510214 |    1649157587510214 |     298 |                  298 | 293289439 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615064 |            0 | 1114904790615064 |                0 |    1649157587510214 |    1649157587510214 |     298 |                  298 | 293289439 |         0 |   2 |         0 |         0 |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+------------------+---------------------+---------------------+---------+----------------------+-----------+-----------+-----+-----------+-----------+

   ```

   补充：查询 select index_status from __all_virtual_table where table_id= 索引表 id，为 2 说明索引表构建成功。
 5. 观察历史任务表，可供参考。

   a. 观察 __all_rootservice_event_history：查看 start_sql_bkgd_task、finish_sql_bkgd_task 以及任务中的 tid（主表 or 索引表），可大致观察单副本构建进度。

   ```shell
   mysql> select * from __all_rootservice_event_history where gmt_create>'2022-04-05 19:19:00';

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------+----------------------+-----------+--------------------------------------------------------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+-------------------------------------------+-----------+-------------------------------------------+-------------------+------------------+------------+-------------+-------------+
   | gmt_create                 | module               | event                | name1     | value1                                                                         | name2         | value2                                                                                                                                                              | name3          | value3                                                                                                                                                              | name4          | value4                                    | name5     | value5                                    | name6             | value6           | extra_info | rs_svr_ip   | rs_svr_port |
   +----------------------------+----------------------+----------------------+-----------+--------------------------------------------------------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+-------------------------------------------+-----------+-------------------------------------------+-------------------+------------------+------------+-------------+-------------+
   | 2022-04-05 19:19:47.546665 | snapshot             | acquire_snapshot     | ret       | 0                                                                              | snapshot      | {snapshot_type:1, snapshot_ts:1649157587510214, schema_version:1649157565414240, tenant_id:1014, table_id:1114904790615059, comment:null}                           | rs_addr        | "xx.xx.xx.xx:xxxx"                                                                                                                                                  |                |                                           |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.549426 | snapshot             | acquire_snapshot     | ret       | 0                                                                              | snapshot      | {snapshot_type:1, snapshot_ts:1649157587510214, schema_version:1649157565414240, tenant_id:1014, table_id:1114904790615064, comment:null}                           | index_table_id | 1114904790615064                                                                                                                                                    | rs_addr        | "xx.xx.xx.xx:xxxx"                        |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.584546 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:0, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:0, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.585866 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:1, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:1, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.586730 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:0, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:0, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 916              |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.587137 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:2, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:2, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.588387 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:3, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:3, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.588633 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:1, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:1, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 1537             |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.589117 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:2, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:2, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 769              |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.589639 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:4, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:4, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.591192 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:3, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:3, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 1595             |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:47.592329 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:4, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:4, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 1488             |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:48.631890 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:0, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:0, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:48.633260 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:1, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:1, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:48.634501 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:2, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:2, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:48.635803 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:3, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:3, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:48.637090 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615059, partition_id:4, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:4, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:50.831480 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:3, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:3, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 2194432          |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:50.836931 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:0, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:0, task_cnt:5}                    | destination    | xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 2203721          |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:50.847703 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:1, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:1, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 2213246          |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:50.879175 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:4, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:4, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 2240848          |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:50.947911 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615059, partition_id:2, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:4}, task_id:2, task_cnt:5}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 2312151          |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:19:50.958004 | balancer             | start_sql_bkgd_task  | partition | {tid:1114904790615064, partition_id:0, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:3}, task_id:0, task_cnt:1}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | comment        | background executing sql distributed task |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:53.314887 | balancer             | finish_sql_bkgd_task | partition | {tid:1114904790615064, partition_id:0, part_cnt:0}                             | task_id       | {ob_job_id:{ob_execution_id:{server:"0.0.0.1:1", execution_id:4611686018427387907, hash:13208655902673732501}, job_id:3}, task_id:0, task_cnt:1}                    | destination    | "xx.xx.xx.xx:xxxx"                                                                                                                                                  | result         | 0                                         | comment   | background executing sql distributed task | elapsed           | 62355601         |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:53.333361 | global_index_builder | switch_state         | tenant_id | 1014                                                                           | data_table_id | 1114904790615059                                                                                                                                                    | index_table_id | 1114904790615064                                                                                                                                                    | pre_state      | 1                                         | new_state | 2                                         | snapshot_version  | 1649157587510214 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:55.339970 | balancer             | start_copy_sstable   | partition | {pkey:{tid:1114904790615064, partition_id:0, part_cnt:0}, data_size:295698432} | destination   | {zone:"zone2", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649157655339784, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649157565445376, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                      | index_table_id | -1                                        | comment   | copy global index sstable                 | switchover_epoch_ | 0                |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:56.129230 | balancer             | finish_copy_sstable  | partition | {pkey:{tid:1114904790615064, partition_id:0, part_cnt:0}, data_size:295698432} | source        | {server:"xx.xx.xx.xx:xxxx", timestamp:1649157565445376, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                      | destination    | {zone:"zone2", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649157655339784, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result         | 0                                         | comment   | copy global index sstable                 | elapsed           | 787324           |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:56.134256 | balancer             | start_copy_sstable   | partition | {pkey:{tid:1114904790615064, partition_id:0, part_cnt:0}, data_size:295698432} | destination   | {zone:"zone3", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649157656134096, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649157565445376, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                      | index_table_id | -1                                        | comment   | copy global index sstable                 | switchover_epoch_ | 0                |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:57.104507 | balancer             | finish_copy_sstable  | partition | {pkey:{tid:1114904790615064, partition_id:0, part_cnt:0}, data_size:295698432} | source        | {server:"xx.xx.xx.xx:2882", timestamp:1649157565445376, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                      | destination    | {zone:"zone3", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649157656134096, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result         | 0                                         | comment   | copy global index sstable                 | elapsed           | 969430           |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:58.116159 | global_index_builder | switch_state         | tenant_id | 1014                                                                           | data_table_id | 1114904790615059                                                                                                                                                    | index_table_id | 1114904790615064                                                                                                                                                    | pre_state      | 2                                         | new_state | 5                                         | snapshot_version  | 1649157587510214 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:59.165987 | global_index_builder | switch_state         | tenant_id | 1014                                                                           | data_table_id | 1114904790615059                                                                                                                                                    | index_table_id | 1114904790615064                                                                                                                                                    | pre_state      | 5                                         | new_state | 7                                         | snapshot_version  | 1649157587510214 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:59.167676 | snapshot             | release_snapshot     | ret       | 0                                                                              | snapshot      | {snapshot_type:1, snapshot_ts:1649157587510214, schema_version:1649157565414240, tenant_id:1014, table_id:1114904790615059, comment:null}                           | rs_addr        | "xx.xx.xx.xx:xxxx"                                                                                                                                                  |                |                                           |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 19:20:59.167852 | snapshot             | release_snapshot     | ret       | 0                                                                              | snapshot      | {snapshot_type:1, snapshot_ts:1649157587510214, schema_version:1649157565414240, tenant_id:1014, table_id:1114904790615064, comment:null}                           | rs_addr        | "1xx.xx.xx.xx:xxxx"                                                                                                                                                  |                |                                           |           |                                           |                   |                  |            | xx.xx.xx.xx |        2882 |
   +----------------------------+----------------------+----------------------+-----------+--------------------------------------------------------------------------------+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+-------------------------------------------+-----------+-------------------------------------------+-------------------+------------------+------------+-------------+-------------+

   ```

b. 观察 __all_server_event_history。

```shell
mysql> select * from __all_server_event_history where gmt_create>'2022-04-05 19:19:00';

```

输出结果如下：

```shell
+----------------------------+-------------+----------+---------+-------------------------+-----------+----------------------------------------------------+----------------+----------------------------------------------------+----------------+----------------------------------------------------------------------------------------------------------------------------------+-------+----------------------------------------------------------------------------------------------------------------------------------+-------+--------+-------+--------+------------+
| gmt_create                 | svr_ip      | svr_port | module  | event                   | name1     | value1                                             | name2          | value2                                             | name3          | value3                                                                                                                           | name4 | value4                                                                                                                           | name5 | value5 | name6 | value6 | extra_info |
+----------------------------+-------------+----------+---------+-------------------------+-----------+----------------------------------------------------+----------------+----------------------------------------------------+----------------+----------------------------------------------------------------------------------------------------------------------------------+-------+----------------------------------------------------------------------------------------------------------------------------------+-------+--------+-------+--------+------------+
| 2022-04-05 19:19:25.466321 | xx.xx.xx.xx |     2882 | ddl     | create_partition        | ret       | 0                                                  | partition      | {tid:1114904790615064, partition_id:0, part_cnt:0} | update_pt_cost | 6639                                                                                                                             | cost  | 13282                                                                                                                            | ret   | 0      |       |        |            |
| 2022-04-05 19:20:56.134474 | xx.xx.xx.xx |     2882 | storage | copy global index begin | partition | {tid:1114904790615064, partition_id:0, part_cnt:0} |                | NULL                                               |                |                                                                                                                                  |       |                                                                                                                                  |       |        |       |        |            |
| 2022-04-05 19:20:56.134957 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch      | ret       | 0                                                  | partition      | {tid:1114904790615064, partition_id:0, part_cnt:0} | src            | {server:"xx.xx.xx.xx:xxxx", timestamp:1649157565445376, flag:0, replica_type:0, region:"default_region", memstore_percent:100}   | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649157656134096, flag:0, replica_type:0, region:"default_region", memstore_percent:100}   |       |        |       |        |            |
| 2022-04-05 19:20:57.103292 | xx.xx.xx.xx |     2882 | storage | rebuild_replica success | partition | {tid:1114904790615064, partition_id:0, part_cnt:0} |                | NULL                                               |                |                                                                                                                                  |       |                                                                                                                                  |       |        |       |        |            |
| 2022-04-05 19:21:45.290608 | xx.xx.xx.xx |     2882 | storage | check_partition_table   | ret       | 0                                                  | dangling_count | 0                                                  | report_count   | 569                                                                                                                              |       |                                                                                                                                  |       |        |       |        |            |
| 2022-04-05 19:19:25.463570 | xx.xx.xx.xx |     2882 | ddl     | create_partition        | ret       | 0                                                  | partition      | {tid:1114904790615064, partition_id:0, part_cnt:0} | update_pt_cost | 5530                                                                                                                             | cost  | 10054                                                                                                                            | ret   | 0      |       |        |            |
| 2022-04-05 19:20:55.340742 | xx.xx.xx.xx |     2882 | storage | copy global index begin | partition | {tid:1114904790615064, partition_id:0, part_cnt:0} |                | NULL                                               |                |                                                                                                                                  |       |                                                                                                                                  |       |        |       |        |            |
| 2022-04-05 19:20:55.341253 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch      | ret       | 0                                                  | partition      | {tid:1114904790615064, partition_id:0, part_cnt:0} | src            | {server:"1xx.xx.xx.xx:xxxx", timestamp:1649157565445376, flag:0, replica_type:0, region:"default_region", memstore_percent:100}   | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649157655339784, flag:0, replica_type:0, region:"default_region", memstore_percent:100}   |       |        |       |        |            |
| 2022-04-05 19:20:56.127546 | xx.xx.xx.xx |     2882 | storage | rebuild_replica success | partition | {tid:1114904790615064, partition_id:0, part_cnt:0} |                | NULL                                               |                |                                                                                                                                  |       |                                                                                                                                  |       |        |       |        |            |
| 2022-04-05 19:19:25.464926 | xx.xx.xx.xx |     2882 | ddl     | create_partition        | ret       | 0                                                  | partition      | {tid:1114904790615064, partition_id:0, part_cnt:0} | update_pt_cost | 5212                                                                                                                             | cost  | 11415                                                                                                                            | ret   | 0      |       |        |            |
| 2022-04-05 19:20:59.184522 | xx.xx.xx.xx |     2882 | sql     | execute_cmd             | cmd_type  | 23                                                 | sql_text       | create index idx_pad on t1(pad) global             | return_code    | 0                                                                                                                                |       |                                                                                                                                  |       |        |       |        |            |
+----------------------------+-------------+----------+---------+-------------------------+-----------+----------------------------------------------------+----------------+----------------------------------------------------+----------------+----------------------------------------------------------------------------------------------------------------------------------+-------+----------------------------------------------------------------------------------------------------------------------------------+-------+--------+-------+--------+------------+

```

## 观察本地索引创建过程

本地索引创建过程不能依靠 __all_index_build_stat 信息表定位创建到哪个阶段。

1. 准备阶段。

   a. 模拟未提交事务。

   ```shell
   mysql> begin;replace into t1 select * from t1 limit 1;
   Query OK, 0 rows affected (0.01 sec)

   ```

   ```shell
   mysql> create index idx_pad on t1(pad) local;

   ```

   c. 观察信息表，__all_index_build_stat 的 status 为 0，__all_index_wait_transaction_status 为空。

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+----------+------------------+
   | gmt_create                 | gmt_modified               | tenant_id | data_table_id    | index_table_id   | status | snapshot | schema_version   |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+----------+------------------+
   | 2022-04-05 23:58:17.486334 | 2022-04-05 23:58:17.486334 |      1014 | 1114904790615059 | 1114904790615072 |      0 |        0 | 1649174297424768 |
   +----------------------------+----------------------------+-----------+------------------+------------------+--------+----------+------------------+

   ```

   d. 观察 __all_index_wait_transaction_status，存在 partition_id = -1 的记录，说明等待事务结束。

   ```shell
   mysql> select * from __all_index_wait_transaction_status where gmt_create>'2022-04-05 23:47:00' and tenant_id=1014;
   Empty set (0.01 sec)

   ```

   e. rollback 事务后，继续观察信息表，__all_index_wait_transaction_status 出现 partition_id 为 -1 的记录。

   ```shell
   mysql> select * from __all_index_wait_transaction_status where gmt_create>'2022-04-05 23:47:00' and tenant_id=1014;

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-----------+------------------+----------+--------------+-------------+----------+--------------+------------------+----------------+------------------+
   | gmt_create                 | gmt_modified               | tenant_id | index_table_id   | svr_type | partition_id | svr_ip      | svr_port | trans_status | snapshot_version | frozen_version | schema_version   |
   +----------------------------+----------------------------+-----------+------------------+----------+--------------+-------------+----------+--------------+------------------+----------------+------------------+
   | 2022-04-05 23:58:27.867381 | 2022-04-05 23:58:27.867381 |      1014 | 1114904790615072 |        1 |            0 | xx.xx.xx.xx |     2882 |            0 | 1649174307808106 |              0 | 1649174297444528 |
   | 2022-04-05 23:58:35.097475 | 2022-04-05 23:58:35.097475 |      1014 | 1114904790615072 |        1 |            1 | xx.xx.xx.xx |     2882 |            0 | 1649174315093183 |              0 | 1649174297444528 |
   | 2022-04-05 23:58:35.107291 | 2022-04-05 23:58:35.107291 |      1014 | 1114904790615072 |        1 |            2 | xx.xx.xx.xx |     2882 |            0 | 1649174315093183 |              0 | 1649174297444528 |
   | 2022-04-05 23:58:35.103601 | 2022-04-05 23:58:35.103601 |      1014 | 1114904790615072 |        1 |            3 | xx.xx.xx.xx |     2882 |            0 | 1649174315093183 |              0 | 1649174297444528 |
   | 2022-04-05 23:58:35.097778 | 2022-04-05 23:58:35.097778 |      1014 | 1114904790615072 |        1 |            4 | xx.xx.xx.xx |     2882 |            0 | 1649174315093183 |              0 | 1649174297444528 |
   | 2022-04-05 23:58:35.200669 | 2022-04-05 23:58:35.200669 |      1014 | 1114904790615072 |        2 |           -1 | xx.xx.xx.xx |     2882 |            0 | 1649174315095393 |            298 | 1649174297424768 |
   +----------------------------+----------------------------+-----------+------------------+----------+--------------+-------------+----------+--------------+------------------+----------------+------------------+

   a. 观察信息表 __all_index_build_stat 的 status 为 0。

   ```

   ```

   b. 观察 __all_index_schedule_task，有记录说明单副本构建任务开始调度了。

   ```shell
   mysql> select * from __all_index_schedule_task where gmt_create>'2022-04-05 23:47:00' and tenant_id=1014;

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-----------+------------------+--------------+-------------+----------+----------------+------------------+
   | gmt_create                 | gmt_modified               | tenant_id | index_table_id   | partition_id | svr_ip      | svr_port | frozen_version | snapshot_version |
   +----------------------------+----------------------------+-----------+------------------+--------------+-------------+----------+----------------+------------------+
   | 2022-04-05 23:58:35.226664 | 2022-04-05 23:58:35.226664 |      1014 | 1114904790615072 |            0 | xx.xx.xx.xx |     2882 |             -1 | 1649174315095393 |
   | 2022-04-05 23:58:35.228261 | 2022-04-05 23:58:35.228261 |      1014 | 1114904790615072 |            1 | xx.xx.xx.xx |     2882 |             -1 | 1649174315095393 |
   | 2022-04-05 23:58:35.207687 | 2022-04-05 23:58:35.207687 |      1014 | 1114904790615072 |            2 | xx.xx.xx.xx |     2882 |             -1 | 1649174315095393 |
   | 2022-04-05 23:58:35.209417 | 2022-04-05 23:58:35.209417 |      1014 | 1114904790615072 |            3 | xx.xx.xx.xx |     2882 |             -1 | 1649174315095393 |
   | 2022-04-05 23:58:35.209959 | 2022-04-05 23:58:35.209959 |      1014 | 1114904790615072 |            4 | xx.xx.xx.xx |     2882 |             -1 | 1649174315095393 |
   +----------------------------+----------------------------+-----------+------------------+--------------+-------------+----------+----------------+------------------+

   ```

   c. 观察 __all_virtual_table_mgr 为空。

   ```shell
   mysql> select * from __all_virtual_table_mgr where index_id in (select index_table_id from __all_index_schedule_task where gmt_create>'2022-04-05 23:47:00' and tenant_id = 1014);
   Empty set (0.35 sec)

   ```

   d. 观察 __all_virtual_long_ops_status，该表展示集群索引构建的进度，此处进度全部为 0。

   ```shell
   mysql> select * from __all_virtual_long_ops_status;

   ```

   输出结果如下：

   ```shell
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+-------------+--------------+----------------+------------------+------------+---------+
   | tenant_id | sid | op_name      | target                                          | svr_ip      | svr_port | start_time       | finish_time | elapsed_time | remaining_time | last_update_time | percentage | message |
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+-------------+--------------+----------------+------------------+------------+---------+
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=0 | xx.xx.xx.xx |     2882 | 1649174315237145 |           0 |     10960834 |              0 | 1649174324491774 |          0 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=1 | xx.xx.xx.xx |     2882 | 1649174315238229 |           0 |     10959777 |              0 | 1649174324039482 |          0 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=3 | xx.xx.xx.xx |     2882 | 1649174315220908 |           0 |     10977102 |              0 | 1649174324098036 |          0 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=2 | xx.xx.xx.xx |     2882 | 1649174315220558 |           0 |     10977455 |              0 | 1649174324439691 |          0 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=4 | xx.xx.xx.xx |     2882 | 1649174315221078 |           0 |     10976937 |              0 | 1649174324198304 |          0 |         |
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+-------------+--------------+----------------+------------------+------------+---------+

   ```

   e. 观察 __all_virtual_sys_task_status，每个分区都有一个 create index 任务。

   ```

   输出结果如下：

   ```shell
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | start_time                 | task_type    | task_id                       | svr_ip      | svr_port | tenant_id | comment                                                                                                                              | is_cancel |
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | 2022-04-05 23:58:35.220484 | create index | YB420B973EA3-0005D1DBCF659B82 | xx.xx.xx.xx |     2882 |      1014 | build index task: key={tid:1114904790615059, partition_id:2, part_cnt:0} index_id=1114904790615072 snapshot_version=1649174315095393 |         0 |
   | 2022-04-05 23:58:35.220862 | create index | YB420B973EA3-0005D1DBCF659B83 | xx.xx.xx.xx |     2882 |      1014 | build index task: key={tid:1114904790615059, partition_id:3, part_cnt:0} index_id=1114904790615072 snapshot_version=1649174315095393 |         0 |
   | 2022-04-05 23:58:35.221034 | create index | YB420B973EA3-0005D1DBCF659B84 | xx.xx.xx.xx |     2882 |      1014 | build index task: key={tid:1114904790615059, partition_id:4, part_cnt:0} index_id=1114904790615072 snapshot_version=1649174315095393 |         0 |
   | 2022-04-05 23:58:35.237091 | create index | YB420B973EA3-0005D1DBCF659B85 | xx.xx.xx.xx |     2882 |      1014 | build index task: key={tid:1114904790615059, partition_id:0, part_cnt:0} index_id=1114904790615072 snapshot_version=1649174315095393 |         0 |
   | 2022-04-05 23:58:35.238181 | create index | YB420B973EA3-0005D1DBCF659B86 | xx.xx.xx.xx |     2882 |      1014 | build index task: key={tid:1114904790615059, partition_id:1, part_cnt:0} index_id=1114904790615072 snapshot_version=1649174315095393 |         0 |
   +----------------------------+--------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------+-----------+

   ```

   f. 观察 __all_virtual_rebalance_task_stat，暂无任务信息。

   ```shell
   mysql> select * from __all_virtual_rebalance_task_stat;
   Empty set (0.00 sec)

   ```

   综上 __all_index_schedule_task 有记录，开始进行单副本构建，__all_virtual_table_mgr 为空，因为本地索引和主表共用 MemTable。
 3. 拷贝阶段。

   ```

   输出结果如下：

   ```

   b. 观察 __all_virtual_table_mgr，出现 table_type=1 的索引表记录说明单副本构建完成，并且可查看副本拷贝情况。

   ```shell
   mysql> select * from __all_virtual_table_mgr where index_id in (select index_table_id from __all_index_schedule_task where gmt_create>'2022-04-05 23:47:00' and tenant_id = 1014);

   ```

   输出结果如下：

   ```shell
   +-------------+----------+-----------+------------+------------------+--------------+------------------+--------------+---------------------+------------------+---------+----------------------+----------+-----------+-----+-----------+-----------+
   | svr_ip      | svr_port | tenant_id | table_type | table_id         | partition_id | index_id         | base_version | multi_version_start | snapshot_version | version | logical_data_version | size     | is_active | ref | write_ref | trx_count |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+--------------+---------------------+------------------+---------+----------------------+----------+-----------+-----+-----------+-----------+
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            3 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59132328 |         0 |   3 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            1 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59019474 |         0 |   3 |         0 |         0 |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+--------------+---------------------+------------------+---------+----------------------+----------+-----------+-----+-----------+-----------+

   ```

   c. 观察 __all_virtual_long_ops_status，该表展示集群索引构建的进度，此处进度为二处 50，三处 100。

   ```

   输出结果如下：

   ```shell
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+------------------+--------------+----------------+------------------+------------+---------+
   | tenant_id | sid | op_name      | target                                          | svr_ip      | svr_port | start_time       | finish_time      | elapsed_time | remaining_time | last_update_time | percentage | message |
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+------------------+--------------+----------------+------------------+------------+---------+
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=0 | xx.xx.xx.xx |     2882 | 1649174315237145 |                0 |     14677935 |       14677935 | 1649174326937809 |         50 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=1 | xx.xx.xx.xx |     2882 | 1649174315238229 | 1649174329427219 |     14188990 |              0 | 1649174329427219 |        100 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=3 | xx.xx.xx.xx |     2882 | 1649174315220908 | 1649174329472910 |     14252002 |              0 | 1649174329472910 |        100 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=2 | xx.xx.xx.xx |     2882 | 1649174315220558 |                0 |     14694552 |       14694552 | 1649174326959566 |         50 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=4 | xx.xx.xx.xx |     2882 | 1649174315221078 | 1649174329561240 |     14340162 |              0 | 1649174329561240 |        100 |         |
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+------------------+--------------+----------------+------------------+------------+---------+

   ```

   d. 观察 __all_virtual_sys_task_status，发现 create index 任务和 migration 任务。

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------------------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | start_time                 | task_type                  | task_id                       | svr_ip      | svr_port | tenant_id | comment                                                                                                                                                                                                                                                | is_cancel |
   +----------------------------+----------------------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+
   | 2022-04-05 23:58:35.220484 | create index               | YB420B973EA3-0005D1DBCF659B82 | xx.xx.xx.xx |     2882 |      1014 | build index task: key={tid:1114904790615059, partition_id:2, part_cnt:0} index_id=1114904790615072 snapshot_version=1649174315095393                                                                                                                   |         0 |
   | 2022-04-05 23:58:35.237091 | create index               | YB420B973EA3-0005D1DBCF659B85 | xx.xx.xx.xx |     2882 |      1014 | build index task: key={tid:1114904790615059, partition_id:0, part_cnt:0} index_id=1114904790615072 snapshot_version=1649174315095393                                                                                                                   |         0 |
   | 2022-04-05 23:58:49.886761 | group partition migration  | YB420B277B81-0005C4F8FEBAE6B2 | xx.xx.xx.xx |     2882 |      1014 | group partition migration executor: group_task_id=YB420B277B81-0005C4F8FEBAE6B2 partition_count=1 partition_id=3 key={tid:1114904790615059, partition_id:3, part_cnt:0}, op_type=COPY_LOCAL_INDEX_OP, src="xx.xx.xx.xx:xxxx", dest="xx.xx.xx.xx:xxxx", |         0 |
   | 2022-04-05 23:58:49.888828 | single partition migration | YB420B20364C-0005D52F688C7957 | xx.xx.xx.xx |     2882 |      1014 | single partition migration: group_task_id=YB420B277B81-0005C4F8FEBAE6B2 key={tid:1114904790615059, partition_id:3, part_cnt:0}, op_type=COPY_LOCAL_INDEX_OP, src="xx.xx.xx.xx:xxxx", dest="xx.xx.xx.xx:xxxx",dest_memstore_percent=100                 |         0 |
   | 2022-04-05 23:58:49.914951 | group partition migration  | YB420B277B81-0005C4F9E1FBF42E | xx.xx.xx.xx |     2882 |      1014 | group partition migration executor: group_task_id=YB420B277B81-0005C4F9E1FBF42E partition_count=1 partition_id=4 key={tid:1114904790615059, partition_id:4, part_cnt:0}, op_type=COPY_LOCAL_INDEX_OP, src="xx.xx.xx.xx:xxxx", dest="xx.xx.xx.xx:xxxx", |         0 |
   | 2022-04-05 23:58:49.916544 | single partition migration | YB420B20364C-0005D52F688C7958 | xx.xx.xx.xx |     2882 |      1014 | single partition migration: group_task_id=YB420B277B81-0005C4F9E1FBF42E key={tid:1114904790615059, partition_id:4, part_cnt:0}, op_type=COPY_LOCAL_INDEX_OP, src="xx.xx.xx.xx:xxxx", dest="xx.xx.xx.xx:xxxx",dest_memstore_percent=100                 |         0 |
   +----------------------------+----------------------------+-------------------------------+-------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+

   ```

   e. 观察 __all_virtual_rebalance_task_stat，发现 COPY_SSTABLE 任务。

   ```

   输出结果如下：

   ```shell
   +-----------+------------------+--------------+-----------------+------------------+------------------+------------------+-----------+--------------+--------------+--------------+-----------+--------------+----------------+
   | tenant_id | table_id         | partition_id | partition_count | source           | data_source      | destination      | offline   | is_replicate | task_type    | is_scheduled | is_manual | waiting_time | executing_time |
   +-----------+------------------+--------------+-----------------+------------------+------------------+------------------+-----------+--------------+--------------+--------------+-----------+--------------+----------------+
   |      1014 | 1114904790615059 |            3 |               0 | xx.xx.xx.xx:xxxx | xx.xx.xx.xx:xxxx | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | COPY_SSTABLE | Yes          | No        |       175792 |          49796 |
   |      1014 | 1114904790615059 |            4 |               0 | xx.xx.xx.xx:xxxx | xx.xx.xx.xx:xxxx | xx.xx.xx.xx:xxxx | 0.0.0.0:0 | No           | COPY_SSTABLE | Yes          | No        |        22679 |          21548 |
   +-----------+------------------+--------------+-----------------+------------------+------------------+------------------+-----------+--------------+--------------+--------------+-----------+--------------+----------------+

   ```

   综上 __all_virtual_table_mgr 出现 table_type=1 的记录，并且__all_virtual_rebalance_task_stat 出现 COPY_SSTABLE 任务。
 4. 收尾阶段。

   a. 观察信息表 __all_index_build_stat 的 status 为空。

   ```shell
   mysql> select * from __all_index_build_stat;
   Empty set (0.00 sec)

   ```

   ```

   输出结果如下：

   ```shell
   +-------------+----------+-----------+------------+------------------+--------------+------------------+--------------+---------------------+------------------+---------+----------------------+----------+-----------+-----+-----------+-----------+
   | svr_ip      | svr_port | tenant_id | table_type | table_id         | partition_id | index_id         | base_version | multi_version_start | snapshot_version | version | logical_data_version | size     | is_active | ref | write_ref | trx_count |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+--------------+---------------------+------------------+---------+----------------------+----------+-----------+-----+-----------+-----------+
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            4 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59024299 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            2 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59065069 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            2 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59065069 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            1 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59019474 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            1 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59019474 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            0 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59086290 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            2 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59065069 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            4 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59024299 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            3 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59132328 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            3 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59132328 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            3 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59132328 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            0 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59086290 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            1 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59019474 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            0 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59086290 |         0 |   2 |         0 |         0 |
   | xx.xx.xx.xx |     2882 |      1014 |          1 | 1114904790615059 |            4 | 1114904790615072 |            0 |    1649174315095393 | 1649174315095393 |     298 |                  298 | 59024299 |         0 |   2 |         0 |         0 |
   +-------------+----------+-----------+------------+------------------+--------------+------------------+--------------+---------------------+------------------+---------+----------------------+----------+-----------+-----+-----------+-----------+

   ```

   c. 观察 __all_virtual_long_ops_status，该表展示集群索引构建的进度，此处进度全部为 100。

   ```

   输出结果如下：

   ```shell
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+------------------+--------------+----------------+------------------+------------+---------+
   | tenant_id | sid | op_name      | target                                          | svr_ip      | svr_port | start_time       | finish_time      | elapsed_time | remaining_time | last_update_time | percentage | message |
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+------------------+--------------+----------------+------------------+------------+---------+
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=0 | xx.xx.xx.xx |     2882 | 1649174315237145 | 1649174329929491 |     14692346 |              0 | 1649174329929491 |        100 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=1 | xx.xx.xx.xx |     2882 | 1649174315238229 | 1649174329427219 |     14188990 |              0 | 1649174329427219 |        100 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=3 | xx.xx.xx.xx |     2882 | 1649174315220908 | 1649174329472910 |     14252002 |              0 | 1649174329472910 |        100 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=2 | xx.xx.xx.xx |     2882 | 1649174315220558 | 1649174329965638 |     14745080 |              0 | 1649174329965638 |        100 |         |
   |      1014 |  -1 | CREATE INDEX | index_table_id=1114904790615072, partition_id=4 | xx.xx.xx.xx |     2882 | 1649174315221078 | 1649174329561240 |     14340162 |              0 | 1649174329561240 |        100 |         |
   +-----------+-----+--------------+-------------------------------------------------+-------------+----------+------------------+------------------+--------------+----------------+------------------+------------+---------+

   ```

   d. 观察 __all_virtual_sys_task_status，暂无任务信息。

   ```

   e. 观察 __all_virtual_rebalance_task_stat，暂无任务信息。

   ```

   综上__all_virtual_table_mgr 副本已全部补齐，__all_virtual_long_ops_status进度全部为100

   a. 观察 __all_rootservice_event_history。

   ```shell
   mysql> select * from __all_rootservice_event_history where gmt_create>'2022-04-05 23:47:00';

   ```

   输出结果如下：

   ```shell
   +----------------------------+----------+---------------------+-----------+------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------+---------------------+---------+--------------------------+-------------------+--------+------------+-------------+-------------+
   | gmt_create                 | module   | event               | name1     | value1                                                                 | name2       | value2                                                                                                                                                         | name3          | value3                                                                                                                                                         | name4                  | value4              | name5   | value5                   | name6             | value6 | extra_info | rs_svr_ip   | rs_svr_port |
   +----------------------------+----------+---------------------+-----------+------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------+---------------------+---------+--------------------------+-------------------+--------+------------+-------------+-------------+
   | 2022-04-05 23:58:35.198681 | snapshot | acquire_snapshot    | ret       | 0                                                                     | snapshot    | {snapshot_type:1, snapshot_ts:1649174315095393, schema_version:1649174297424768, tenant_id:1014, table_id:1114904790615059, comment:null}                      | index_table_id | 1114904790615072                                                                                                                                               | rs_addr                | "xx.xx.xx.xx:xxxx"  |         |                          |                   |        |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.437130 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:1, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329436960, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204840, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.483225 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:3, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329483075, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204991, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.659821 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:1, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204840, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329436960, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 221860 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.659991 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:4, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329570725, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845205017, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.709537 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:3, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204991, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329483075, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 225502 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.709723 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:1, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329664243, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204840, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.885358 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:4, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845205017, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329570725, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 224513 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.885528 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:3, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329709633, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204991, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.913607 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:1, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204840, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329664243, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 201996 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:49.913801 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:4, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329891029, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845205017, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.068782 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:3, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204991, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329709633, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 181354 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.068952 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:0, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329939138, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204803, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.091776 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:4, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845205017, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329891029, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 176090 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.092031 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:2, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329975079, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204879, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.295340 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:0, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204803, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329939138, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 225588 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.296838 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:0, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174330296701, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204803, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.313536 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:2, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204879, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1040, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174329975079, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 220561 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.326999 | balancer | start_copy_sstable  | partition | {pkey:{tid:1114904790615059, partition_id:2, part_cnt:0}, data_size:0} | destination | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174330326836, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | data_source    | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204879, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | index_table_id         | 1114904790615072    | comment | copy local index sstable | switchover_epoch_ | 0      |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.479907 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:0, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204803, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174330296701, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 181184 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.502998 | balancer | finish_copy_sstable | partition | {pkey:{tid:1114904790615059, partition_id:2, part_cnt:0}, data_size:0} | source      | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204879, flag:0, replica_type:0, region:"default_region", memstore_percent:100}                                 | destination    | {zone:"", unit_id:1042, member:{server:"xx.xx.xx.xx:xxxx", timestamp:1649174330326836, flag:0, replica_type:0, region:"default_region", memstore_percent:100}} | result                 | 0                   | comment | copy local index sstable | elapsed           | 173741 |            | xx.xx.xx.xx |        2882 |
   | 2022-04-05 23:58:50.678176 | snapshot | release_snapshot    | ret       | 0                                                                      | snapshot    | {snapshot_type:1, snapshot_ts:1649174315095393, schema_version:1649174297424768, tenant_id:1014, table_id:1114904790615059, comment:null}                      | rs_addr        | "xx.xx.xx.xx:xxxx"                                                                                                                                             |                        |                     |         |                          |                   |        |            | xx.xx.xx.xx |        2882 |
   +----------------------------+----------+---------------------+-----------+------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------+---------------------+---------+--------------------------+-------------------+--------+------------+-------------+-------------+

   ```

   ```shell
   mysql> select * from __all_server_event_history where gmt_create>'2022-04-05 23:47:00';

   ```

   输出结果如下：

   ```shell
   +----------------------------+-------------+----------+---------+------------------------+-----------+----------------------------------------------------+----------------+----------------------------------------------------+--------------+--------------------------------------------------------------------------------------------------------------------------------+-------+--------------------------------------------------------------------------------------------------------------------------------+-------+--------+-------+--------+------------+
   | gmt_create                 | svr_ip      | svr_port | module  | event                  | name1     | value1                                             | name2          | value2                                             | name3        | value3                                                                                                                         | name4 | value4                                                                                                                         | name5 | value5 | name6 | value6 | extra_info |
   +----------------------------+-------------+----------+---------+------------------------+-----------+----------------------------------------------------+----------------+----------------------------------------------------+--------------+--------------------------------------------------------------------------------------------------------------------------------+-------+--------------------------------------------------------------------------------------------------------------------------------+-------+--------+-------+--------+------------+
   | 2022-04-05 23:58:49.437352 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:1, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:49.437840 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:1, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204840, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329436960, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:49.483453 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:3, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:49.483919 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:3, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204991, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329483075, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:49.660276 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:4, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:49.660733 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:4, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845205017, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329570725, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:50.069158 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:0, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:50.069629 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:0, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204803, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329939138, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:50.092290 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:2, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:50.092835 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:2, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204879, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329975079, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:57:15.663885 | xx.xx.xx.xx |     2882 | storage | check_partition_table  | ret       | 0                                                  | dangling_count | 0                                                  | report_count | 5709                                                                                                                           |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:49.710488 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:1, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:49.710960 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:1, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204840, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329664243, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:49.886308 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:3, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:49.886779 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:3, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204991, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329709633, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:49.914565 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:4, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:49.915034 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:4, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845205017, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174329891029, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:50.297613 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:0, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:50.298087 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:0, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204803, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174330296701, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:58:50.327861 | xx.xx.xx.xx |     2882 | storage | copy local index begin | partition | {tid:1114904790615059, partition_id:2, part_cnt:0} | index_id       | 1114904790615072                                   |              |                                                                                                                                |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:50.328358 | xx.xx.xx.xx |     2882 | ddl     | copy_sstable_batch     | ret       | 0                                                  | partition      | {tid:1114904790615059, partition_id:2, part_cnt:0} | src          | {server:"xx.xx.xx.xx:xxxx", timestamp:1649155845204879, flag:0, replica_type:0, region:"default_region", memstore_percent:100} | dst   | {server:"xx.xx.xx.xx:xxxx", timestamp:1649174330326836, flag:0, replica_type:0, region:"default_region", memstore_percent:100} |       |        |       |        |            |
   | 2022-04-05 23:47:48.456067 | xx.xx.xx.xx |     2882 | sql     | execute_cmd            | cmd_type  | 22                                                 | sql_text       | alter table t1 drop index idx_pad                  | return_code  | 0                                                                                                                              |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:47:49.381144 | xx.xx.xx.xx |     2882 | sql     | execute_cmd            | cmd_type  | 12                                                 | sql_text       | ALTER SYSTEM CHANGE TENANT TENANT_ID = 1           | return_code  | 0                                                                                                                              |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:47:49.392310 | xx.xx.xx.xx |     2882 | sql     | execute_cmd            | cmd_type  | 12                                                 | sql_text       | ALTER SYSTEM CHANGE TENANT TENANT_ID = 1014        | return_code  | 0                                                                                                                              |       |                                                                                                                                |       |        |       |        |            |
   | 2022-04-05 23:58:50.614277 | xx.xx.xx.xx |     2882 | sql     | execute_cmd            | cmd_type  | 23                                                 | sql_text       | create index idx_pad on t1(pad) local              | return_code  | 0                                                                                                                              |       |                                                                                                                                |       |        |       |        |            |
   +----------------------------+-------------+----------+---------+------------------------+-----------+----------------------------------------------------+----------------+----------------------------------------------------+--------------+--------------------------------------------------------------------------------------------------------------------------------+-------+--------------------------------------------------------------------------------------------------------------------------------+-------+--------+-------+--------+------------+

   ```

## 总结

- 诊断任务与事件状态的内部虚拟表。

     - 通过查询内部虚拟表，如 __all_index_build_stat、__all_index_wait_transaction_status、__all_virtual_sys_task_status 等，可以实时监控索引构建的进度和状态。
     - 检查展示正在执行的任务和记录当前正在进行的负载均衡任务的常用的任务与事件诊断用的虚拟表和视图，如 __all_virtual_sys_task_status 和__all_virtual_rebalance_task_stat，以获取相关分区的索引创建任务和分布式任务信息。
     - 通过 __all_virtual_table_mgr 表，可以观察到 MemTable 的创建和 SSTable 的拷贝情况。
 - 历史事件记录表。

     - 通过查询历史事件记录表 __all_rootservice_event_history 和__all_server_event_history 内部虚拟表获取的详细信息，包括快照、任务开始/完成、SSTable 复制等事件的记录。

#### 注意

观察索引创建进度是一个动态的过程，需要定期查询系统表以获取最新的状态信息。索引创建的时间取决于多种因素，如表的大小、系统的负载、副本的数量等，当创建索引可能会影响数据库的性能，建议在低峰时间段进行。

## 适用版本

OceanBase 数据库 V2.x 和 V3.x 版本。

Previous

[TRUNCATE 或 DROP 表分区后导致全局索引失效](https://www.oceanbase.com/knowledge-base/oceanbase-database-20000000099)

Next

[全局索引上不支持 INSERT IGNORE 语句](https://www.oceanbase.com/knowledge-base/oceanbase-database-20000000116) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
