Skip to content

Commit

Permalink
*: refine placement rule in sql docs (#15231)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiancai authored Nov 15, 2023
1 parent aa5ecb2 commit feffa9b
Show file tree
Hide file tree
Showing 8 changed files with 383 additions and 186 deletions.
1 change: 1 addition & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
- [`ALTER INDEX`](/sql-statements/sql-statement-alter-index.md)
- [`ALTER INSTANCE`](/sql-statements/sql-statement-alter-instance.md)
- [`ALTER PLACEMENT POLICY`](/sql-statements/sql-statement-alter-placement-policy.md)
- [`ALTER RANGE`](/sql-statements/sql-statement-alter-range.md)
- [`ALTER RESOURCE GROUP`](/sql-statements/sql-statement-alter-resource-group.md)
- [`ALTER TABLE`](/sql-statements/sql-statement-alter-table.md)
- [`ALTER TABLE COMPACT`](/sql-statements/sql-statement-alter-table-compact.md)
Expand Down
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@
- [`ALTER INDEX`](/sql-statements/sql-statement-alter-index.md)
- [`ALTER INSTANCE`](/sql-statements/sql-statement-alter-instance.md)
- [`ALTER PLACEMENT POLICY`](/sql-statements/sql-statement-alter-placement-policy.md)
- [`ALTER RANGE`](/sql-statements/sql-statement-alter-range.md)
- [`ALTER RESOURCE GROUP`](/sql-statements/sql-statement-alter-resource-group.md)
- [`ALTER TABLE`](/sql-statements/sql-statement-alter-table.md)
- [`ALTER TABLE COMPACT`](/sql-statements/sql-statement-alter-table-compact.md)
Expand Down
523 changes: 342 additions & 181 deletions placement-rules-in-sql.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion releases/release-6.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ In v6.3.0-DMR, the key new features and improvements are as follows:

* Address the conflict between SQL-based data Placement Rules and TiFlash replicas [#37171](https://github.com/pingcap/tidb/issues/37171) @[lcwangchao](https://github.com/lcwangchao)

TiDB v6.0.0 provides SQL-based data Placement Rules. But this feature conflicts with TiFlash replicas due to implementation issues. TiDB v6.3.0 optimizes the implementation mechanisms, and [resolves the conflict between SQL-based data Placement Rules and TiFlash](/placement-rules-in-sql.md#known-limitations).
TiDB v6.0.0 provides [SQL-based data Placement Rules](/placement-rules-in-sql.md). But this feature conflicts with TiFlash replicas due to implementation issues. TiDB v6.3.0 optimizes the implementation mechanisms, and resolves the conflict between SQL-based data Placement Rules and TiFlash.

### MySQL compatibility

Expand Down
8 changes: 4 additions & 4 deletions releases/release-6.6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ In v6.6.0-DMR, the key new features and improvements are as follows:
- For TiDB clusters deployed across cloud regions, when a cloud region fails, the specified databases or tables can survive in another cloud region.
- For TiDB clusters deployed in a single cloud region, when an availability zone fails, the specified databases or tables can survive in another availability zone.

For more information, see [documentation](/placement-rules-in-sql.md#survival-preferences).
For more information, see [documentation](/placement-rules-in-sql.md#specify-survival-preferences).

* Support rolling back DDL operations via the `FLASHBACK CLUSTER TO TIMESTAMP` statement [#14088](https://github.com/tikv/tikv/pull/14088) @[Defined2014](https://github.com/Defined2014) @[JmPotato](https://github.com/JmPotato)

Expand Down Expand Up @@ -224,7 +224,7 @@ In v6.6.0-DMR, the key new features and improvements are as follows:

For more information, see [documentation](/tidb-lightning/tidb-lightning-configuration.md#tidb-lightning-task).

* TiDB Lightning supports enabling compressed transfers when sending key-value pairs to TiKV [#41163](https://github.com/pingcap/tidb/issues/41163) @[gozssky](https://github.com/gozssky)
* TiDB Lightning supports enabling compressed transfers when sending key-value pairs to TiKV [#41163](https://github.com/pingcap/tidb/issues/41163) @[sleepymole](https://github.com/sleepymole)

Starting from v6.6.0, TiDB Lightning supports compressing locally encoded and sorted key-value pairs for network transfer when sending them to TiKV, thus reducing the amount of data transferred over the network and lowering the network bandwidth overhead. In the earlier TiDB versions before this feature is supported, TiDB Lightning requires relatively high network bandwidth and incurs high traffic charges in case of large data volumes.

Expand Down Expand Up @@ -490,7 +490,7 @@ In v6.6.0-DMR, the key new features and improvements are as follows:
- Support setting the maximum number of conflicts by `lightning.max-error` [#40743](https://github.com/pingcap/tidb/issues/40743) @[dsdashun](https://github.com/dsdashun)
- Support importing CSV data files with BOM headers [#40744](https://github.com/pingcap/tidb/issues/40744) @[dsdashun](https://github.com/dsdashun)
- Optimize the processing logic when encountering TiKV flow-limiting errors and try other available regions instead [#40205](https://github.com/pingcap/tidb/issues/40205) @[lance6716](https://github.com/lance6716)
- Disable checking the table foreign keys during import [#40027](https://github.com/pingcap/tidb/issues/40027) @[gozssky](https://github.com/gozssky)
- Disable checking the table foreign keys during import [#40027](https://github.com/pingcap/tidb/issues/40027) @[sleepymole](https://github.com/sleepymole)
+ Dumpling
Expand Down Expand Up @@ -603,7 +603,7 @@ In v6.6.0-DMR, the key new features and improvements are as follows:
- Fix the issue that TiDB Lightning might incorrectly skip conflict resolution when all but the last TiDB Lightning instance encounters a local duplicate record during a parallel import [#40923](https://github.com/pingcap/tidb/issues/40923) @[lichunzhu](https://github.com/lichunzhu)
- Fix the issue that precheck cannot accurately detect the presence of a running TiCDC in the target cluster [#41040](https://github.com/pingcap/tidb/issues/41040) @[lance6716](https://github.com/lance6716)
- Fix the issue that TiDB Lightning panics in the split-region phase [#40934](https://github.com/pingcap/tidb/issues/40934) @[lance6716](https://github.com/lance6716)
- Fix the issue that the conflict resolution logic (`duplicate-resolution`) might lead to inconsistent checksums [#40657](https://github.com/pingcap/tidb/issues/40657) @[gozssky](https://github.com/gozssky)
- Fix the issue that the conflict resolution logic (`duplicate-resolution`) might lead to inconsistent checksums [#40657](https://github.com/pingcap/tidb/issues/40657) @[sleepymole](https://github.com/sleepymole)
- Fix a possible OOM problem when there is an unclosed delimiter in the data file [#40400](https://github.com/pingcap/tidb/issues/40400) @[buchuitoudegou](https://github.com/buchuitoudegou)
- Fix the issue that the file offset in the error report exceeds the file size [#40034](https://github.com/pingcap/tidb/issues/40034) @[buchuitoudegou](https://github.com/buchuitoudegou)
- Fix an issue with the new version of PDClient that might cause parallel import to fail [#40493](https://github.com/pingcap/tidb/issues/40493) @[AmoebaProtozoa](https://github.com/AmoebaProtozoa)
Expand Down
1 change: 1 addition & 0 deletions sql-statements/sql-statement-alter-placement-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ AdvancedPlacementOption ::=
| "LEADER_CONSTRAINTS" EqOpt stringLit
| "FOLLOWER_CONSTRAINTS" EqOpt stringLit
| "LEARNER_CONSTRAINTS" EqOpt stringLit
| "SURVIVAL_PREFERENCES" EqOpt stringLit
```

## Examples
Expand Down
32 changes: 32 additions & 0 deletions sql-statements/sql-statement-alter-range.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: ALTER RANGE
summary: An overview of the usage of ALTER RANGE for TiDB.
---

# ALTER RANGE

Currently, the `ALTER RANGE` statement can only be used to modify the range of a specific placement policy in TiDB.

## Synopsis

```ebnf+diagram
AlterRangeStmt ::=
'ALTER' 'RANGE' Identifier PlacementPolicyOption
```

`ALTER RANGE` supports the following two parameters:

- `global`: indicates the range of all data in a cluster.
- `meta`: indicates the range of internal metadata stored in TiDB.

## Examples

```sql
CREATE PLACEMENT POLICY `deploy111` CONSTRAINTS='{"+region=us-east-1":1, "+region=us-east-2": 1, "+region=us-west-1": 1}';
CREATE PLACEMENT POLICY `five_replicas` FOLLOWERS=4;

ALTER RANGE global PLACEMENT POLICY = "deploy111";
ALTER RANGE meta PLACEMENT POLICY = "five_replicas";
```

The preceding example creates two placement policies (`deploy111` and `five_replicas`), specifies constraints for different regions, and then applies the `deploy111` placement policy to all data in the cluster range and the `five_replicas` placement policy to the metadata range.
1 change: 1 addition & 0 deletions sql-statements/sql-statement-create-placement-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ AdvancedPlacementOption ::=
| "LEADER_CONSTRAINTS" EqOpt stringLit
| "FOLLOWER_CONSTRAINTS" EqOpt stringLit
| "LEARNER_CONSTRAINTS" EqOpt stringLit
| "SURVIVAL_PREFERENCES" EqOpt stringLit
```

## Examples
Expand Down

0 comments on commit feffa9b

Please sign in to comment.