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

update doc of unregister storage unit DistSQL #29003

Merged
merged 1 commit into from
Nov 10, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ weight = 3
{{% tab name="语法" %}}
```sql
UnregisterStorageUnit ::=
'UNREGISTER' 'STORAGE' 'UNIT' ifExists? storageUnitName (',' storageUnitName)* ('IGNORE' 'SINGLE' 'TABLES')?
'UNREGISTER' 'STORAGE' 'UNIT' ifExists? storageUnitName (',' storageUnitName)* (ignoreSingleTables | ignoreBroadcastTables | ignoreSingleAndBroadcastTables)?

ignoreSingleTables ::=
'IGNORE' 'SINGLE' 'TABLES'

ignoreBroadcastTables ::=
'IGNORE' 'BROADCAST' 'TABLES'

ignoreSingleAndBroadcastTables ::=
'IGNORE' ('SINGLE' ',' 'BROADCAST' | 'BROADCAST' ',' 'SINGLE') 'TABLES'

ifExists ::=
'IF' 'EXISTS'
Expand All @@ -31,7 +40,7 @@ storageUnitName ::=

- `UNREGISTER STORAGE UNIT` 只会移除 Proxy 中的存储单元,不会删除与存储单元对应的真实数据源;
- 无法移除已经被规则使用的存储单元。移除被规则使用的存储单元时会提示 `Storage unit are still in used`;
- 将要移除的存储单元中仅包含 `SINGLE RULE`,且用户确认可以忽略该限制时,可添加 `IGNORE SINGLE TABLES` 关键字移除存储单元;
- 将要移除的存储单元中仅包含 `SINGLE RULE`、`BROADCAST RULE`,且用户确认可以忽略该限制时,可添加 `IGNORE SINGLE TABLES` 、 `IGNORE BROADCAST TABLES` 、 `IGNORE SINGLE, BROADCAST TABLES` 关键字移除存储单元;
- `ifExists` 子句用于避免 `Storage unit not exists` 错误。

### 示例
Expand All @@ -54,6 +63,18 @@ UNREGISTER STORAGE UNIT ds_0, ds_1;
UNREGISTER STORAGE UNIT ds_0 IGNORE SINGLE TABLES;
```

- 忽略广播表移除存储单元

```sql
UNREGISTER STORAGE UNIT ds_0 IGNORE BROADCAST TABLES;
```

- 忽略单表和广播表移除存储单元

```sql
UNREGISTER STORAGE UNIT ds_0 IGNORE SINGLE, BROADCAST TABLES;
```

- 使用 `ifExists` 子句移除存储单元

```sql
Expand All @@ -62,7 +83,7 @@ UNREGISTER STORAGE UNIT IF EXISTS ds_0;

### 保留字

`DROP`、`STORAGE`、`UNIT`、`IF`、`EXISTS`、`IGNORE`、`SINGLE`、`TABLES`
`DROP`、`STORAGE`、`UNIT`、`IF`、`EXISTS`、`IGNORE`、`SINGLE`、`BROADCAST`、`TABLES`

### 相关链接

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ The `UNREGISTER STORAGE UNIT` syntax is used to unregister storage unit from the
{{% tab name="Grammar" %}}
```sql
UnregisterStorageUnit ::=
'UNREGISTER' 'STORAGE' 'UNIT' ifExists? storageUnitName (',' storageUnitName)* ('IGNORE' 'SINGLE' 'TABLES')?
'UNREGISTER' 'STORAGE' 'UNIT' ifExists? storageUnitName (',' storageUnitName)* (ignoreSingleTables | ignoreBroadcastTables | ignoreSingleAndBroadcastTables)?

ignoreSingleTables ::=
'IGNORE' 'SINGLE' 'TABLES'

ignoreBroadcastTables ::=
'IGNORE' 'BROADCAST' 'TABLES'

ignoreSingleAndBroadcastTables ::=
'IGNORE' ('SINGLE' ',' 'BROADCAST' | 'BROADCAST' ',' 'SINGLE') 'TABLES'

ifExists ::=
'IF' 'EXISTS'
Expand All @@ -33,8 +42,8 @@ storageUnitName ::=
unregistered;
- Unable to unregister storage unit already used by rules. `Storage unit are still in used.` will be prompted when removing
storage units used by rules;
- The storage unit need to be removed only contains `SINGLE RULE`, and when the user confirms that this restriction
can be ignored, the `IGNORE SINGLE TABLES` keyword can be added to remove the storage unit;
- The storage unit need to be removed only contains `SINGLE RULE`, `BROADCAST RULE` and when the user confirms that this restriction
can be ignored, the `IGNORE SINGLE TABLES`, `IGNORE BROADCAST TABLES`, `IGNORE SINGLE, BROADCAST TABLES` keyword can be added to remove the storage unit;
- `ifExists` clause is used for avoid `Storage unit not exists` error.

### Example
Expand All @@ -57,6 +66,14 @@ UNREGISTER STORAGE UNIT ds_0, ds_1;
UNREGISTER STORAGE UNIT ds_0 IGNORE SINGLE TABLES;
```

```sql
UNREGISTER STORAGE UNIT ds_0 IGNORE BROADCAST TABLES;
```

```sql
UNREGISTER STORAGE UNIT ds_0 IGNORE SINGLE, BROADCAST TABLES;
```

- Drop the storage unit with `ifExists` clause

```sql
Expand All @@ -65,7 +82,7 @@ UNREGISTER STORAGE UNIT IF EXISTS ds_0;

### Reserved word

`DROP`, `STORAGE`, `UNIT`, `IF`, `EXISTS`, `IGNORE`, `SINGLE`, `TABLES`
`DROP`, `STORAGE`, `UNIT`, `IF`, `EXISTS`, `IGNORE`, `SINGLE`, `BROADCAST`, `TABLES`

### Related links

Expand Down