zy-kkk opened a new pull request, #19211:
URL: https://github.com/apache/doris/pull/19211

   # Proposed changes
   
   Issue Number: close #17423
   
   ## Problem summary
   
   In this PR, I optimized the error message for creating insufficient table 
replications
   This is my test
   I have 3 Be,, two of them are in the default resource group and one is in 
the test resource group
   
![image](https://user-images.githubusercontent.com/70795751/235120500-b1cafe0b-f880-4a9a-ade0-8b059cc9d2d5.png)
   
   If I create a  4 replications table, I get the following error
   
   ```sql
   mysql> CREATE TABLE IF NOT EXISTS `rep` (
       ->     `k`  int
       -> ) ENGINE=OLAP
       -> DUPLICATE KEY(`k`)
       -> DISTRIBUTED BY HASH(`k`) BUCKETS 8
       -> PROPERTIES (
       ->     "replication_num" = "4"
       -> );
   ERROR 1105 (HY000): errCode = 2, detailMessage = replication num should be 
less than the number of available backends. replication num is 4, available 
backend num is 3
   ```
   
   Then I create a table with 3 replications, but I set all three copies of it 
to be in the default resource group
   
   ```sql
   mysql> CREATE TABLE IF NOT EXISTS `rep` (
       ->     `k`  int
       -> ) ENGINE=OLAP
       -> DUPLICATE KEY(`k`)
       -> DISTRIBUTED BY HASH(`k`) BUCKETS 8
       -> PROPERTIES (
       ->     "replication_num" = "3"
       -> );
   ERROR 1105 (HY000): errCode = 2, detailMessage = Failed to find enough 
backend, please check the replication num,replication tag and storage medium.
   Create failed replications:
   replication tag: {"location" : "default"}, replication num: 3, storage 
medium: HDD
   ```
   
   Then I  create a 3 replications table with one replication in the default 
resource group and two replications in the test resource group
   
   ```sql
   mysql> CREATE TABLE IF NOT EXISTS `rep` (
       ->     `k`  int
       -> ) ENGINE=OLAP
       -> DUPLICATE KEY(`k`)
       -> DISTRIBUTED BY HASH(`k`) BUCKETS 8
       -> PROPERTIES (
       ->     "replication_allocation" = "tag.location.test: 
2,tag.location.default: 1"
       -> );
   ERROR 1105 (HY000): errCode = 2, detailMessage = Failed to find enough 
backend, please check the replication num,replication tag and storage medium.
   Create failed replications:
   replication tag: {"location" : "test"}, replication num: 2, storage medium: 
HDD
   ```
   
   Then I  create a 3 replications table with one replication in the test 
resource group and two replications in the default resource group
   
   ```sql
   mysql> CREATE TABLE IF NOT EXISTS `rep` (
       ->     `k`  int
       -> ) ENGINE=OLAP
       -> DUPLICATE KEY(`k`)
       -> DISTRIBUTED BY HASH(`k`) BUCKETS 8
       -> PROPERTIES (
       ->     "replication_allocation" = "tag.location.test: 
1,tag.location.default: 2"
       -> );
   Query OK, 0 rows affected (0.28 sec)
   ```
   
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to