Skip to content

Commit

Permalink
update doc of unregister storage unit DistSQL (#29003)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangML authored Nov 10, 2023
1 parent e66222a commit 69f2826
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
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

0 comments on commit 69f2826

Please sign in to comment.