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] Update sql statements about data-and-status-management #1890

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,51 @@ under the License.

## Description

This statement is used to cancel rebalancing disks of specified backends with high priority
The `CANCEL REBALANCE DISK` statement is used to cancel the high-priority disk data balancing for Backend (BE) nodes. This statement has the following functionalities:

Grammar:
- It can cancel the high-priority disk balancing for specified BE nodes.
- It can cancel the high-priority disk balancing for all BE nodes in the entire cluster.
- After cancellation, the system will still balance the disk data of BE nodes using the default scheduling method.

ADMIN CANCEL REBALANCE DISK [ON ("BackendHost1:BackendHeartBeatPort1", "BackendHost2:BackendHeartBeatPort2", ...)];
## Syntax

Explain:
```sql
ADMIN CANCEL REBALANCE DISK [ ON ( "<host>:<port>" [, ... ] ) ];
```

1. This statement only indicates that the system no longer rebalance disks of specified backends with high priority. The system will still rebalance disks by default scheduling.
## Optional Parameters

## Example
**1. `"<host>:<port>"`**

1. Cancel High Priority Disk Rebalance of all of backends of the cluster
> Specifies the list of BE nodes for which the high-priority disk balancing needs to be canceled.
>
> Each node consists of a hostname (or IP address) and a heartbeat port.
>
> If this parameter is not specified, it will cancel the high-priority disk balancing for all BE nodes.

ADMIN CANCEL REBALANCE DISK;
## Access Control Requirements

2. Cancel High Priority Disk Rebalance of specified backends
Users executing this SQL command must have at least the following permissions:

ADMIN CANCEL REBALANCE DISK ON ("192.168.1.1:1234", "192.168.1.2:1234");
| Privilege | Object | Notes |
| :-------------- | :---------- | :-------------------------------------------- |
| ADMIN | System | The user must have ADMIN privileges to execute this command. |

## Usage Notes

## Keywords
- This statement only indicates that the system will no longer prioritize balancing the disk data of specified BEs; however, the system will still balance BE's disk data using the default scheduling method.
- After executing this command, any previously set high-priority balancing strategy will become immediately invalid.

ADMIN,CANCEL,REBALANCE DISK
## Examples

## Best Practice
- Cancel high-priority disk balancing for all BEs in the cluster:

```sql
ADMIN CANCEL REBALANCE DISK;
```

- Cancel high-priority disk balancing for specified BEs:

```sql
ADMIN CANCEL REBALANCE DISK ON ("192.168.1.1:1234", "192.168.1.2:1234");
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
{
"title": "CANCEL REPAIR",
"title": "CANCEL REPAIR TABLE",
"language": "en"
}
---
Expand All @@ -27,29 +27,59 @@ under the License.

## Description

This statement is used to cancel the repair of the specified table or partition with high priority
The `CANCEL REPAIR TABLE` statement is used to cancel high-priority repairs for a specified table or partition. This statement has the following functionalities:

grammar:
- It can cancel high-priority repairs for an entire table.
- It can cancel high-priority repairs for specified partitions.
- It does not affect the system's default replica repair mechanism.

## Syntax

```sql
ADMIN CANCEL REPAIR TABLE table_name[ PARTITION (p1,...)];
ADMIN CANCEL REPAIR TABLE <table_name> [ PARTITION (<partition_name> [, ...]) ];
```

illustrate:
## Required Parameters

**1. `<table_name>`**

> Specifies the name of the table for which the repair is to be canceled.
>
> The table name must be unique within its database.

## Optional Parameters

**1. `PARTITION (<partition_name> [, ...])`**

> Specifies a list of partition names for which the repair is to be canceled.
>
> If this parameter is not specified, it will cancel high-priority repairs for the entire table.

## Access Control Requirements

Users executing this SQL command must have at least the following permissions:

1. This statement simply means that the system will no longer repair shard copies of the specified table or partition with high priority. Replicas are still repaired with the default schedule.
| Privilege | Object | Notes |
| :-------------- | :---------- | :-------------------------------------------- |
| ADMIN | System | The user must have ADMIN privileges to execute this command. |

## Example
## Usage Notes

1. Cancel high priority repair
- This statement only cancels high-priority repairs and does not stop the system's default replica repair mechanism.
- After cancellation, the system will still repair replicas using the default scheduling method.
- If there is a need to re-establish high-priority repairs, the `ADMIN REPAIR TABLE` command can be used.
- The effects of this command take place immediately after execution.

```sql
ADMIN CANCEL REPAIR TABLE tbl PARTITION(p1);
```
## Examples

## Keywords
- Cancel high-priority repairs for an entire table:

ADMIN, CANCEL, REPAIR
```sql
ADMIN CANCEL REPAIR TABLE tbl;
```

## Best Practice
- Cancel high-priority repairs for specified partitions:

```sql
ADMIN CANCEL REPAIR TABLE tbl PARTITION(p1, p2);
```
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,54 @@ under the License.
-->


## Description

The `REBALANCE DISK` statement is used to optimize the data distribution on Backend (BE) nodes. This statement has the following functionalities:

### Name
- It can perform data balancing for specified BE nodes.
- It can balance data across all BE nodes in the entire cluster.
- It prioritizes balancing the data of specified nodes, regardless of the overall balance state of the cluster.

ADMIN REBALANCE DISK
## Syntax

## Description
```sql
ADMIN REBALANCE DISK [ ON ( "<host>:<port>" [, ... ] ) ];
```

This statement is used to try to rebalance disks of the specified backends first, no matter if the cluster is balanced
## Optional Parameters

Grammar:
**1. `"<host>:<port>"`**

```
ADMIN REBALANCE DISK [ON ("BackendHost1:BackendHeartBeatPort1", "BackendHost2:BackendHeartBeatPort2", ...)];
```
> Specifies the list of BE nodes that need to be balanced.
>
> Each node consists of a hostname (or IP address) and a heartbeat port.
>
> If this parameter is not specified, it will balance all BE nodes.

Explain:
## Access Control Requirements

1. This statement only means that the system attempts to rebalance disks of specified backends with high priority, no matter if the cluster is balanced.
2. The default timeout is 24 hours. Timeout means that the system will no longer rebalance disks of specified backends with high priority. The command settings need to be reused.
Users executing this SQL command must have at least the following permissions:

## Example
| Privilege | Object | Notes |
| :-------------- | :---------- | :-------------------------------------------- |
| ADMIN | System | The user must have ADMIN privileges to execute this command. |

1. Attempt to rebalance disks of all backends
## Usage Notes

```
- The default timeout for this command is 24 hours. After this period, the system will no longer prioritize balancing the disk data of specified BEs. To continue balancing, the command needs to be executed again.
- Once the disk data balancing for a specified BE node is completed, the high-priority setting for that node will automatically become invalid.
- This command can be executed even when the cluster is in an unbalanced state.

## Examples

- Balance data across all BE nodes in the cluster:

```sql
ADMIN REBALANCE DISK;
```

2. Attempt to rebalance disks oof the specified backends
- Balance data for two specified BE nodes:

```
```sql
ADMIN REBALANCE DISK ON ("192.168.1.1:1234", "192.168.1.2:1234");
```

## Keywords

ADMIN,REBALANCE,DISK

## Best Practice

Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,68 @@ under the License.

## Description

statement used to attempt to preferentially repair the specified table or partition
The `REPAIR TABLE` statement is used to prioritize the repair of replicas for a specified table or partition. This statement has the following functionalities:

grammar:
- It can repair all replicas of an entire table.
- It can repair replicas of specified partitions.
- It performs replica repairs with high priority.
- It supports setting a repair timeout.

## Syntax

```sql
ADMIN REPAIR TABLE table_name[ PARTITION (p1,...)]
ADMIN REPAIR TABLE <table_name> [ PARTITION (<partition_name> [, ...]) ];
```

illustrate:
## Required Parameters

**1. `<table_name>`**

> Specifies the name of the table that needs to be repaired.
>
> The table name must be unique within its database.

## Optional Parameters

**1. `PARTITION (<partition_name> [, ...])`**

> Specifies a list of partition names that need to be repaired.
>
> If this parameter is not specified, it will repair all partitions of the entire table.

## Access Control Requirements

Users executing this SQL command must have at least the following permissions:

1. This statement only means to let the system try to repair the shard copy of the specified table or partition with high priority, and does not guarantee that the repair can be successful. Users can view the repair status through the SHOW REPLICA STATUS command.
2. The default timeout is 14400 seconds (4 hours). A timeout means that the system will no longer repair shard copies of the specified table or partition with high priority. Need to re-use this command to set
| Privilege | Object | Notes |
| :-------------- | :---------- | :-------------------------------------------- |
| ADMIN | System | The user must have ADMIN privileges to execute this command. |

## Example
## Usage Notes

1. Attempt to repair the specified table
- This statement indicates that the system will attempt to repair the specified replicas with high priority, but it does not guarantee successful repairs.
- The default timeout is set to 14,400 seconds (4 hours).
- After the timeout, the system will no longer prioritize the repair of specified replicas.
- If a repair times out, the command needs to be executed again to continue the repair process.
- The progress of repairs can be monitored using the `SHOW REPLICA STATUS` command.
- This command does not affect the normal replica repair mechanism of the system; it merely elevates the priority of repairs for the specified table or partition.

ADMIN REPAIR TABLE tbl1;
## Examples

2. Try to repair the specified partition
- Repair all replicas of an entire table:

ADMIN REPAIR TABLE tbl1 PARTITION (p1, p2);
```sql
ADMIN REPAIR TABLE tbl1;
```

## Keywords
- Repair replicas of specified partitions:

ADMIN, REPAIR, TABLE
```sql
ADMIN REPAIR TABLE tbl1 PARTITION (p1, p2);
```

## Best Practice
- Check the repair progress:

```sql
SHOW REPLICA STATUS FROM tbl1;
```
Loading
Loading