Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc]modify show transaction doc #1905

Merged
merged 2 commits into from
Jan 24, 2025
Merged
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
92 changes: 46 additions & 46 deletions docs/sql-manual/sql-statements/transaction/SHOW-TRANSACTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,56 +24,63 @@ specific language governing permissions and limitations
under the License.
-->


## Description

This syntax is used to view transaction details for the specified transaction id or label.

grammar:
## Syntax

```sql
SHOW TRANSACTION
[FROM db_name]
[FROM <db_name>]
WHERE
[id=transaction_id]
[label = label_name];
[id = <transaction_id> | label = <label_name>];
```

Example of returned result:
## Required Parameters

```
TransactionId: 4005
Label: insert_8d807d5d-bcdd-46eb-be6d-3fa87aa4952d
Coordinator: FE: 10.74.167.16
TransactionStatus: VISIBLE
LoadJobSourceType: INSERT_STREAMING
PrepareTime: 2020-01-09 14:59:07
CommitTime: 2020-01-09 14:59:09
FinishTime: 2020-01-09 14:59:09
Reason:
ErrorReplicasCount: 0
ListenerId: -1
TimeoutMs: 300000
```
**1. `<transaction_id>`**

The transaction ID whose details need to be viewed.

**2. `<label_name>`**

The label whose transaction details need to be viewed.

## Optional Parameters

**1. `<db_name>`**

The database whose transaction details need to be viewed.

* TransactionId: transaction id
* Label: the label corresponding to the import task
* Coordinator: The node responsible for transaction coordination
* TransactionStatus: transaction status
* PREPARE: preparation stage
* COMMITTED: The transaction succeeded, but the data was not visible
* VISIBLE: The transaction succeeded and the data is visible
* ABORTED: Transaction failed
* LoadJobSourceType: Type of import job.
* PrepareTime: transaction start time
* CommitTime: The time when the transaction was successfully committed
* FinishTime: The time when the data is visible
* Reason: error message
* ErrorReplicasCount: The number of replicas with errors
* ListenerId: The id of the related import job
* TimeoutMs: Transaction timeout, in milliseconds

## Example
## Return Value

| Column Name | Description |
|---|---|
| TransactionId | Transaction ID |
| Label | Label associated with the import task |
| Coordinator | Node responsible for coordinating the transaction |
| TransactionStatus | Status of the transaction |
| PREPARE | Preparation phase |
| COMMITTED | Transaction succeeded, but data is not visible yet |
| VISIBLE | Transaction succeeded, and data is visible |
| ABORTED | Transaction failed |
| LoadJobSourceType | Type of the import task |
| PrepareTime | Start time of the transaction |
| CommitTime | Time when the transaction was successfully committed |
| FinishTime | Time when the data became visible |
| Reason | Error message |
| ErrorReplicasCount | Number of replicas with errors |
| ListenerId | ID of the related import job |
| TimeoutMs | Transaction timeout duration in milliseconds |

## Access Control Requirements

| Privilege | Object | Notes |
| :-------------- | :----------- | :------------------------ |
| ADMIN_PRIV | Database | Only users with ADMIN_PRIV can perform this operation. |

## Examples

1. View the transaction with id 4005:

Expand All @@ -91,11 +98,4 @@ ErrorReplicasCount: 0

```sql
SHOW TRANSACTION WHERE LABEL = 'label_name';
```

## Keywords

SHOW, TRANSACTION

## Best Practice

```
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,62 @@ specific language governing permissions and limitations
under the License.
-->


## 描述

该语法用于查看指定 transaction id 或 label 的事务详情。

### 语法


```sql
SHOW TRANSACTION
[FROM db_name]
[FROM <db_name>]
WHERE
[id = transaction_id]
[label = label_name];
[id = <transaction_id> | label = <label_name>];
```

### 返回结果
## 必选参数
**1. `<transaction_id>`**

示例:
需要查看事务详情的 transaction id

```sql
TransactionId: 4005
Label: insert_8d807d5d-bcdd-46eb-be6d-3fa87aa4952d
Coordinator: FE: 10.74.167.16
TransactionStatus: VISIBLE
LoadJobSourceType: INSERT_STREAMING
PrepareTime: 2020-01-09 14:59:07
CommitTime: 2020-01-09 14:59:09
FinishTime: 2020-01-09 14:59:09
Reason:
ErrorReplicasCount: 0
ListenerId: -1
TimeoutMs: 300000
```
**2. `<label_name>`**

需要查看事务详情的 label

## 可选参数

**1. `<db_name>`**

需要查看事务详情的database


## 返回值

| Column name | Description |
|---|---|
| TransactionId | 事务 id |
| Label | 导入任务对应的 label |
| Coordinator | 负责事务协调的节点 |
| TransactionStatus | 事务状态 |
| PREPARE | 准备阶段 |
| COMMITTED | 事务成功,但数据不可见 |
| VISIBLE | 事务成功且数据可见 |
| ABORTED | 事务失败 |
| LoadJobSourceType | 导入任务的类型 |
| PrepareTime | 事务开始时间 |
| CommitTime | 事务提交成功的时间 |
| FinishTime | 数据可见的时间 |
| Reason | 错误信息 |
| ErrorReplicasCount | 有错误的副本数 |
| ListenerId | 相关的导入作业的 id |
| TimeoutMs | 事务超时时间,单位毫秒 |

## 权限控制

| 权限(Privilege) | 对象(Object) | 说明(Notes) |
|:--------------|:-----------|:------------------------|
| ADMIN_PRIV | Database | 只有拥有 ADMIN_PRIV 的用户才能操作 |

* TransactionId:事务 id
* Label:导入任务对应的 label
* Coordinator:负责事务协调的节点
* TransactionStatus:事务状态
* PREPARE:准备阶段
* COMMITTED:事务成功,但数据不可见
* VISIBLE:事务成功且数据可见
* ABORTED:事务失败
* LoadJobSourceType:导入任务的类型。
* PrepareTime:事务开始时间
* CommitTime:事务提交成功的时间
* FinishTime:数据可见的时间
* Reason:错误信息
* ErrorReplicasCount:有错误的副本数
* ListenerId:相关的导入作业的 id
* TimeoutMs:事务超时时间,单位毫秒

## 示例

Expand All @@ -91,14 +96,7 @@ ErrorReplicasCount: 0
```

3. 查看 label 为 label_name 的事务:

```sql
SHOW TRANSACTION WHERE LABEL = 'label_name';
```

## 关键词

SHOW, TRANSACTION



Original file line number Diff line number Diff line change
Expand Up @@ -23,57 +23,61 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->



## 描述

该语法用于查看指定 transaction id 或 label 的事务详情。

语法:
### 语法

```sql
SHOW TRANSACTION
[FROM db_name]
[FROM <db_name>]
WHERE
[id = transaction_id]
[label = label_name];
[id = <transaction_id> | label = <label_name>];
```

返回结果示例:
## 必选参数
**1. `<transaction_id>`**

```sql
TransactionId: 4005
Label: insert_8d807d5d-bcdd-46eb-be6d-3fa87aa4952d
Coordinator: FE: 10.74.167.16
TransactionStatus: VISIBLE
LoadJobSourceType: INSERT_STREAMING
PrepareTime: 2020-01-09 14:59:07
CommitTime: 2020-01-09 14:59:09
FinishTime: 2020-01-09 14:59:09
Reason:
ErrorReplicasCount: 0
ListenerId: -1
TimeoutMs: 300000
```
需要查看事务详情的 transaction id

**2. `<label_name>`**

需要查看事务详情的 label

## 可选参数

**1. `<db_name>`**

需要查看事务详情的database

## 返回值

| Column name | Description |
|---|---|
| TransactionId | 事务 id |
| Label | 导入任务对应的 label |
| Coordinator | 负责事务协调的节点 |
| TransactionStatus | 事务状态 |
| PREPARE | 准备阶段 |
| COMMITTED | 事务成功,但数据不可见 |
| VISIBLE | 事务成功且数据可见 |
| ABORTED | 事务失败 |
| LoadJobSourceType | 导入任务的类型 |
| PrepareTime | 事务开始时间 |
| CommitTime | 事务提交成功的时间 |
| FinishTime | 数据可见的时间 |
| Reason | 错误信息 |
| ErrorReplicasCount | 有错误的副本数 |
| ListenerId | 相关的导入作业的 id |
| TimeoutMs | 事务超时时间,单位毫秒 |

## 权限控制

| 权限(Privilege) | 对象(Object) | 说明(Notes) |
|:--------------|:-----------|:------------------------|
| ADMIN_PRIV | Database | 只有拥有 ADMIN_PRIV 的用户才能操作 |

* TransactionId:事务 id
* Label:导入任务对应的 label
* Coordinator:负责事务协调的节点
* TransactionStatus:事务状态
* PREPARE:准备阶段
* COMMITTED:事务成功,但数据不可见
* VISIBLE:事务成功且数据可见
* ABORTED:事务失败
* LoadJobSourceType:导入任务的类型。
* PrepareTime:事务开始时间
* CommitTime:事务提交成功的时间
* FinishTime:数据可见的时间
* Reason:错误信息
* ErrorReplicasCount:有错误的副本数
* ListenerId:相关的导入作业的 id
* TimeoutMs:事务超时时间,单位毫秒

## 示例

Expand All @@ -90,14 +94,8 @@ ErrorReplicasCount: 0
```

3. 查看 label 为 label_name 的事务:

```sql
SHOW TRANSACTION WHERE LABEL = 'label_name';
```

## 关键词

SHOW, TRANSACTION

## 最佳实践

Loading
Loading