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 1 commit
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,58 @@ 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 ( "host1:port1" [, "host2:port2" ... ] ) ];
QuakeWang marked this conversation as resolved.
Show resolved Hide resolved
```

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.
Where:

## Example
```sql
host:port
QuakeWang marked this conversation as resolved.
Show resolved Hide resolved
: Composed of the hostname (or IP address) and heartbeat port.
```

1. Cancel High Priority Disk Rebalance of all of backends of the cluster
## Optional Parameters

ADMIN CANCEL REBALANCE DISK;
**1. `<ON ("host:port" [, ...])>`**
QuakeWang marked this conversation as resolved.
Show resolved Hide resolved

2. Cancel High Priority Disk Rebalance of specified backends
> 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 ON ("192.168.1.1:1234", "192.168.1.2:1234");
## Access Control Requirements

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

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

## Keywords
## Usage Notes

ADMIN,CANCEL,REBALANCE DISK
- 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.

## Best Practice
## Examples

- 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");
```

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
{
"title": "CANCEL REPAIR",
"language": "en"
}
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->


## Description

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

- 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 (<partition_name> [, ...]) ];
```

## 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:

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

## Usage Notes

- 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.

## Examples

- Cancel high-priority repairs for an entire table:

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

- 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,61 @@ 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

ADMIN REBALANCE DISK
- 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.

## Description
## Syntax

This statement is used to try to rebalance disks of the specified backends first, no matter if the cluster is balanced
```sql
ADMIN REBALANCE DISK [ ON ( "host1:port1" [, "host2:port2" ... ] ) ];
QuakeWang marked this conversation as resolved.
Show resolved Hide resolved
```

Grammar:
Where:

```
ADMIN REBALANCE DISK [ON ("BackendHost1:BackendHeartBeatPort1", "BackendHost2:BackendHeartBeatPort2", ...)];
```sql
host:port
: Composed of the hostname (or IP address) and heartbeat port.
```

Explain:
## Optional Parameters

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.
**1. `<ON ("host:port" [, ...])>`**

## Example
> 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.

1. Attempt to rebalance disks of all backends
## Access Control Requirements

```
ADMIN REBALANCE DISK;
```
Users executing this SQL command must have at least the following permissions:

2. Attempt to rebalance disks oof the specified backends
| Privilege | Object | Notes |
| :-------------- | :---------- | :-------------------------------------------- |
| ADMIN | System | The user must have ADMIN privileges to execute this command. |

```
ADMIN REBALANCE DISK ON ("192.168.1.1:1234", "192.168.1.2:1234");
```
## 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

## Keywords
- Balance data across all BE nodes in the cluster:

ADMIN,REBALANCE,DISK
```sql
ADMIN REBALANCE DISK;
```

## Best Practice
- Balance data for two specified BE nodes:

```sql
ADMIN REBALANCE DISK ON ("192.168.1.1:1234", "192.168.1.2:1234");
```
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