diff --git a/docs/reference/sql/information-schema/overview.md b/docs/reference/sql/information-schema/overview.md index babe5bdf9..ded7684cd 100644 --- a/docs/reference/sql/information-schema/overview.md +++ b/docs/reference/sql/information-schema/overview.md @@ -56,6 +56,7 @@ There is still lots of work to do for `INFORMATION_SCHEMA`. The tracking [issue] | Table Name | Description | | --- | --- | | [`BUILD_INFO`](./build-info.md) | Provides the system build info. | +| [`REGION_INFO`](./region-info.md) | Provides detailed region runtime and manifest metadata for inspection and debugging. | | [`REGION_PEERS`](./region-peers.md) | Provides details about where regions are stored. | | [`REGION_STATISTICS`](./region-statistics.md) | Provides details about region statistics info, such as disk size, etc. | | [`CLUSTER_INFO`](./cluster-info.md)| Provides the topology information of the cluster.| diff --git a/docs/reference/sql/information-schema/region-info.md b/docs/reference/sql/information-schema/region-info.md new file mode 100644 index 000000000..3f0c64351 --- /dev/null +++ b/docs/reference/sql/information-schema/region-info.md @@ -0,0 +1,64 @@ +--- +keywords: [region info, region runtime, region manifest, committed sequence, flushed sequence] +description: Provides detailed region runtime and manifest metadata for inspection and debugging. +--- + +# REGION_INFO + +The `REGION_INFO` table provides detailed runtime and manifest metadata for regions, useful for inspection and debugging. + +```sql +USE INFORMATION_SCHEMA; +DESC REGION_INFO; +``` + +The output is as follows: + +```sql ++------------------------+---------+------+------+---------+---------------+ +| Column | Type | Key | Null | Default | Semantic Type | ++------------------------+---------+------+------+---------+---------------+ +| region_id | UInt64 | | NO | | FIELD | +| table_id | UInt32 | | NO | | FIELD | +| region_number | UInt32 | | NO | | FIELD | +| region_group | UInt8 | | NO | | FIELD | +| region_sequence | UInt32 | | NO | | FIELD | +| state | String | | NO | | FIELD | +| role | String | | NO | | FIELD | +| writable | Boolean | | NO | | FIELD | +| committed_sequence | UInt64 | | NO | | FIELD | +| flushed_sequence | UInt64 | | YES | | FIELD | +| manifest_version | UInt64 | | NO | | FIELD | +| compaction_time_window | String | | YES | | FIELD | +| region_options | String | | NO | | FIELD | +| sst_format | String | | NO | | FIELD | +| node_id | UInt64 | | YES | | FIELD | ++------------------------+---------+------+------+---------+---------------+ +``` + +Fields in the `REGION_INFO` table are described as follows: + +- `region_id`: The ID of the region. +- `table_id`: The ID of the table. +- `region_number`: The region number inside the table. +- `region_group`: The region group. +- `region_sequence`: The region sequence inside the group. +- `state`: The detailed runtime role/state label, such as `Leader(Writable)` or `Follower`. +- `role`: The coarse region role, such as `Leader` or `Follower`. +- `writable`: Whether the region accepts writes. +- `committed_sequence`: The committed sequence of the region. +- `flushed_sequence`: The latest sequence that has been persisted into SST files. +- `manifest_version`: The manifest version of the region. +- `compaction_time_window`: The human-readable compaction time window. +- `region_options`: Region options encoded as JSON. +- `sst_format`: The SST format used by the region. +- `node_id`: The datanode ID reporting this row. + +Retrieve region info for a specific table as follows: + +```sql +SELECT r.* +FROM REGION_INFO r +LEFT JOIN REGION_PEERS p ON r.region_id = p.region_id +WHERE p.table_name = 'region_info_case'; +``` diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/overview.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/overview.md index 7dc114240..c347edfe4 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/overview.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/overview.md @@ -54,6 +54,7 @@ description: INFORMATION_SCHEMA 提供对系统元数据的访问,例如数据 |表名 | 描述| | --- | --- | | [`BUILD_INFO`](./build-info.md) | 提供了系统构建的信息。 | +| [`REGION_INFO`](./region-info.md) | 提供 Region 的运行时和 manifest 详细元数据,用于排查和调试。 | | [`REGION_PEERS`](./region-peers.md) | 提供了表的 Region 存储的详细信息。 | | [`REGION_STATISTICS`](./region-statistics.md) | 提供 Region 的详细统计信息,例如行数等。 | | [`CLUSTER_INFO`](./cluster-info.md)| 提供了集群的节点拓扑信息。| diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/region-info.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/region-info.md new file mode 100644 index 000000000..36fcc9197 --- /dev/null +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/information-schema/region-info.md @@ -0,0 +1,64 @@ +--- +keywords: [Region 信息, 运行时元数据, manifest 元数据, committed sequence, flushed sequence] +description: 提供 Region 的运行时和 manifest 详细元数据,用于排查和调试。 +--- + +# REGION_INFO + +`REGION_INFO` 表提供 Region 的运行时和 manifest 详细元数据,用于排查和调试。 + +```sql +USE INFORMATION_SCHEMA; +DESC REGION_INFO; +``` + +输出如下: + +```sql ++------------------------+---------+------+------+---------+---------------+ +| Column | Type | Key | Null | Default | Semantic Type | ++------------------------+---------+------+------+---------+---------------+ +| region_id | UInt64 | | NO | | FIELD | +| table_id | UInt32 | | NO | | FIELD | +| region_number | UInt32 | | NO | | FIELD | +| region_group | UInt8 | | NO | | FIELD | +| region_sequence | UInt32 | | NO | | FIELD | +| state | String | | NO | | FIELD | +| role | String | | NO | | FIELD | +| writable | Boolean | | NO | | FIELD | +| committed_sequence | UInt64 | | NO | | FIELD | +| flushed_sequence | UInt64 | | YES | | FIELD | +| manifest_version | UInt64 | | NO | | FIELD | +| compaction_time_window | String | | YES | | FIELD | +| region_options | String | | NO | | FIELD | +| sst_format | String | | NO | | FIELD | +| node_id | UInt64 | | YES | | FIELD | ++------------------------+---------+------+------+---------+---------------+ +``` + +`REGION_INFO` 表中的字段描述如下: + +- `region_id`:Region 的 ID。 +- `table_id`:表的 ID。 +- `region_number`:Region 在表中的编号。 +- `region_group`:Region 组编号。 +- `region_sequence`:Region 在组内的序号。 +- `state`:详细的运行时角色/状态标签,例如 `Leader(Writable)` 或 `Follower`。 +- `role`:Region 的粗粒度角色,例如 `Leader` 或 `Follower`。 +- `writable`:Region 是否可写。 +- `committed_sequence`:Region 的已提交 sequence。 +- `flushed_sequence`:最近已刷入 SST 文件的 sequence。 +- `manifest_version`:Region 的 manifest 版本。 +- `compaction_time_window`:可读格式的 compaction 时间窗口。 +- `region_options`:JSON 编码的 Region 配置项。 +- `sst_format`:Region 使用的 SST 格式。 +- `node_id`:上报该行信息的 datanode ID。 + +查询某张表的 Region 信息示例如下: + +```sql +SELECT r.* +FROM REGION_INFO r +LEFT JOIN REGION_PEERS p ON r.region_id = p.region_id +WHERE p.table_name = 'region_info_case'; +```