Support create a table with a given tiflash replica number
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Feature Request
**Is your feature request related to a problem? Please describe:**
In the current version, we need **two steps** to create a table with tiflash replica:
```
CREATE TABLE t1 (a int);
ALTER TABLE t1 SET TIFLASH REPLICA 2;
```
And we can not know how many tiflash replicas on the table by showing the create table statement. The only way to check how many tiflash replicas are created for the table is to check the system table `information_schema.tiflash_replica`
Lacking of this information is not user friendly enough under certain situations, one of the post from the asktug ask for this feature: https://asktug.com/t/topic/1030122
**Describe the feature you'd like:**
1. Support creating a table with a given number of tiflash replicas by one statement
2. `SHOW CREATE TABLE` can show how many tiflash replicas is added
For example:
```mysql
> CREATE TABLE t1 (a int) TIFLASH_REPLICA_NUM = 2;
> SHOW CREATE TABLE t1
+-------+-------------------------------------------------------------+
| Table | Create Table |
+-------+-------------------------------------------------------------+
| t1 | CREATE TABLE `t1` ( |
| | `a` int(11) DEFAULT NULL |
| | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T! TIFLASH_REPLICA_NUM=2 */ |
+-------+-------------------------------------------------------------+
```
**Describe alternatives you've considered:**
**Teachability, Documentation, Adoption, Migration Strategy:**
Contributor guide
Assessment
This issue has not been assessed yet.