Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions docs/admin-manual/open-api/be-http/compaction-score.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
{
"title": "View Tablet Compaction Score",
"language": "en",
"description": "It is used to view tablet compaction scores on a BE node."
}
---

# View Tablet Compaction Score

## Request

`GET /api/compaction_score?top_n={int}&sync_meta={bool}`

## Description

It is used to view tablet compaction scores on a BE node. The compaction score is calculated as the sum of the compaction scores of all rowsets in each tablet. The response is sorted by `compaction_score` in descending order.

## Query parameters

* `top_n`

Optional. A non-negative integer. If specified, only the top N tablets with the highest compaction scores are returned. If not specified, all tablets on the BE node are returned. `top_n=0` returns an empty array.

* `sync_meta`

Optional. Cloud mode only. Valid values are `true` and `false`. If set to `true`, BE synchronizes tablet metadata and rowsets from the meta service before calculating the compaction scores. Do not specify this parameter in non-cloud mode.

## Request body

None

## Response

Returns a JSON array. Each element contains the following fields:

* `tablet_id`: Tablet ID. The value is returned as a string.
* `compaction_score`: Tablet compaction score. The value is returned as a string.

Example response:

```json
[
{
"compaction_score": "5",
"tablet_id": "42595"
},
{
"compaction_score": "4",
"tablet_id": "10034"
}
]
```

## Error handling

* If `top_n` is not a valid non-negative integer, the API returns HTTP 400 with an error such as `invalid argument: top_n=wrong`.
* If `sync_meta` is specified in non-cloud mode, the API returns HTTP 400 with an error message: ``param `sync_meta` is only available for cloud mode``.
* If `sync_meta` is not `true` or `false`, the API returns HTTP 400 with an error such as `invalid argument: sync_meta=wrong`.

## Examples

View the top 10 tablets with the highest compaction scores:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10"
```

View compaction scores after synchronizing metadata in cloud mode:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10&sync_meta=true"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
{
"title": "查看 Tablet Compaction Score",
"language": "zh-CN",
"description": "用于查看 BE 节点上各 Tablet 的 Compaction Score。"
}
---

# 查看 Tablet Compaction Score

## 请求路径

`GET /api/compaction_score?top_n={int}&sync_meta={bool}`

## 描述

用于查看某个 BE 节点上各 Tablet 的 Compaction Score。Compaction Score 按每个 Tablet 中所有 Rowset 的 Compaction Score 求和得到。响应结果按 `compaction_score` 降序排列。

## 请求参数

* `top_n`

可选。非负整数。指定后仅返回 Compaction Score 最高的前 N 个 Tablet;不指定时返回该 BE 节点上的所有 Tablet。`top_n=0` 返回空数组。

* `sync_meta`

可选。仅适用于存算分离模式。取值为 `true` 或 `false`。设置为 `true` 时,BE 会先从 Meta Service 同步 Tablet 元数据和 Rowset,再计算 Compaction Score。非存算分离模式下不要指定该参数。

## 请求体


## 响应

返回 JSON 数组,每个元素包含以下字段:

* `tablet_id`:Tablet ID。返回值类型为字符串。
* `compaction_score`:Tablet 的 Compaction Score。返回值类型为字符串。

响应示例:

```json
[
{
"compaction_score": "5",
"tablet_id": "42595"
},
{
"compaction_score": "4",
"tablet_id": "10034"
}
]
```

## 错误处理

* `top_n` 不是合法的非负整数时,API 返回 HTTP 400,错误信息如 `invalid argument: top_n=wrong`。
* 非存算分离模式下指定 `sync_meta` 时,API 返回 HTTP 400,错误信息为 ``param `sync_meta` is only available for cloud mode``。
* `sync_meta` 不是 `true` 或 `false` 时,API 返回 HTTP 400,错误信息如 `invalid argument: sync_meta=wrong`。

## 示例

查看 Compaction Score 最高的前 10 个 Tablet:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10"
```

在存算分离模式下同步元数据后查看 Compaction Score:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10&sync_meta=true"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
{
"title": "查看 Tablet Compaction Score",
"language": "zh-CN",
"description": "用于查看 BE 节点上各 Tablet 的 Compaction Score。"
}
---

# 查看 Tablet Compaction Score

## 请求路径

`GET /api/compaction_score?top_n={int}`

## 描述

用于查看某个 BE 节点上各 Tablet 的 Compaction Score。Compaction Score 按每个 Tablet 中所有 Rowset 的 Compaction Score 求和得到。响应结果按 `compaction_score` 降序排列。

## 请求参数

* `top_n`

可选。非负整数。指定后仅返回 Compaction Score 最高的前 N 个 Tablet;不指定时返回该 BE 节点上的所有 Tablet。`top_n=0` 返回空数组。

## 请求体


## 响应

返回 JSON 数组,每个元素包含以下字段:

* `tablet_id`:Tablet ID。返回值类型为字符串。
* `compaction_score`:Tablet 的 Compaction Score。返回值类型为字符串。

响应示例:

```json
[
{
"compaction_score": "5",
"tablet_id": "42595"
},
{
"compaction_score": "4",
"tablet_id": "10034"
}
]
```

## 错误处理

`top_n` 不是合法的非负整数时,API 返回 HTTP 400,错误信息如 `invalid argument: top_n=wrong`。

## 示例

查看 Compaction Score 最高的前 10 个 Tablet:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
{
"title": "查看 Tablet Compaction Score",
"language": "zh-CN",
"description": "用于查看 BE 节点上各 Tablet 的 Compaction Score。"
}
---

# 查看 Tablet Compaction Score

## 请求路径

`GET /api/compaction_score?top_n={int}&sync_meta={bool}`

## 描述

用于查看某个 BE 节点上各 Tablet 的 Compaction Score。Compaction Score 按每个 Tablet 中所有 Rowset 的 Compaction Score 求和得到。响应结果按 `compaction_score` 降序排列。

## 请求参数

* `top_n`

可选。非负整数。指定后仅返回 Compaction Score 最高的前 N 个 Tablet;不指定时返回该 BE 节点上的所有 Tablet。`top_n=0` 返回空数组。

* `sync_meta`

可选。仅适用于存算分离模式。取值为 `true` 或 `false`。设置为 `true` 时,BE 会先从 Meta Service 同步 Tablet 元数据和 Rowset,再计算 Compaction Score。非存算分离模式下不要指定该参数。

## 请求体


## 响应

返回 JSON 数组,每个元素包含以下字段:

* `tablet_id`:Tablet ID。返回值类型为字符串。
* `compaction_score`:Tablet 的 Compaction Score。返回值类型为字符串。

响应示例:

```json
[
{
"compaction_score": "5",
"tablet_id": "42595"
},
{
"compaction_score": "4",
"tablet_id": "10034"
}
]
```

## 错误处理

* `top_n` 不是合法的非负整数时,API 返回 HTTP 400,错误信息如 `invalid argument: top_n=wrong`。
* 非存算分离模式下指定 `sync_meta` 时,API 返回 HTTP 400,错误信息为 ``param `sync_meta` is only available for cloud mode``。
* `sync_meta` 不是 `true` 或 `false` 时,API 返回 HTTP 400,错误信息如 `invalid argument: sync_meta=wrong`。

## 示例

查看 Compaction Score 最高的前 10 个 Tablet:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10"
```

在存算分离模式下同步元数据后查看 Compaction Score:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10&sync_meta=true"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
{
"title": "查看 Tablet Compaction Score",
"language": "zh-CN",
"description": "用于查看 BE 节点上各 Tablet 的 Compaction Score。"
}
---

# 查看 Tablet Compaction Score

## 请求路径

`GET /api/compaction_score?top_n={int}&sync_meta={bool}`

## 描述

用于查看某个 BE 节点上各 Tablet 的 Compaction Score。Compaction Score 按每个 Tablet 中所有 Rowset 的 Compaction Score 求和得到。响应结果按 `compaction_score` 降序排列。

## 请求参数

* `top_n`

可选。非负整数。指定后仅返回 Compaction Score 最高的前 N 个 Tablet;不指定时返回该 BE 节点上的所有 Tablet。`top_n=0` 返回空数组。

* `sync_meta`

可选。仅适用于存算分离模式。取值为 `true` 或 `false`。设置为 `true` 时,BE 会先从 Meta Service 同步 Tablet 元数据和 Rowset,再计算 Compaction Score。非存算分离模式下不要指定该参数。

## 请求体


## 响应

返回 JSON 数组,每个元素包含以下字段:

* `tablet_id`:Tablet ID。返回值类型为字符串。
* `compaction_score`:Tablet 的 Compaction Score。返回值类型为字符串。

响应示例:

```json
[
{
"compaction_score": "5",
"tablet_id": "42595"
},
{
"compaction_score": "4",
"tablet_id": "10034"
}
]
```

## 错误处理

* `top_n` 不是合法的非负整数时,API 返回 HTTP 400,错误信息如 `invalid argument: top_n=wrong`。
* 非存算分离模式下指定 `sync_meta` 时,API 返回 HTTP 400,错误信息为 ``param `sync_meta` is only available for cloud mode``。
* `sync_meta` 不是 `true` 或 `false` 时,API 返回 HTTP 400,错误信息如 `invalid argument: sync_meta=wrong`。

## 示例

查看 Compaction Score 最高的前 10 个 Tablet:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10"
```

在存算分离模式下同步元数据后查看 Compaction Score:

```shell
curl "http://127.0.0.1:8040/api/compaction_score?top_n=10&sync_meta=true"
```
1 change: 1 addition & 0 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ const sidebars: SidebarsConfig = {
'admin-manual/open-api/be-http/reset-rpc-channel',
'admin-manual/open-api/be-http/compaction-status',
'admin-manual/open-api/be-http/compaction-run',
'admin-manual/open-api/be-http/compaction-score',
'admin-manual/open-api/be-http/meta',
'admin-manual/open-api/be-http/snapshot',
'admin-manual/open-api/be-http/check-tablet-segment',
Expand Down
Loading