lanchengx commented on issue #13902:
URL: 
https://github.com/apache/shardingsphere/issues/13902#issuecomment-985229361


   - The previous `DistSQL` is as follows:
   
     ```sql
     CREATE DB_DISCOVERY RULE ha_group_0 (
     RESOURCES(resource_0,resource_1),
     TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec',keepAliveCron=''))
     );
     
     ALTER DB_DISCOVERY RULE ha_group_0 (
     RESOURCES(resource_0,resource_1,resource_2),
     TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec' ,keepAliveCron=''))
     );
     
     DROP DB_DISCOVERY RULE ha_group_0;
     ```
   
   - The adjusted `DistSQL` is as follows:
   
     **DB_DISCOVERY RULE**
     ```
     CREATE/ALTER DB_DISCOVERY RULE primary_replica_ds (
     RESOURCES(ds_0, ds_1, ds_2),
     TYPE(NAME=mgr,PROPERTIES('groupName'='92504d5b-6dec')),
     HEARTBEAT(PROPERTIES('keepAliveCron'='0/5 * * * * ?'))
     );
     ```
       The names of `DiscoveryType` and `DiscoveryHeartbeat` created in this 
way are automatically generated, and the generated rules are defined as 
`${DiscoveryRuleName}_${DiscoveryTypeName}`, 
`${DiscoveryRuleName}_heartbeat`,for example, the name generated in the current 
example is `primary_replica_ds_mgr`、`primary_replica_ds_heartbeart`
   
     Also supports specifying the existing `DiscoveryType` and `HeartBeatType`
     ```sql
     CREATE/ALTER DB_DISCOVERY RULE primary_replica_ds (
     RESOURCES(ds_0, ds_1, ds_2),
     TYPE=primary_replica_ds_mgr,
     HEARTBEAT=mgr_heartbeat
     );
     
     DROP DB_DISCOVERY RULE ha_group_0;
     
     SHOW DB_DISCOVERY RULES [FROM schemaName]
     
     | name  | data_source_names   | primary_data_source_name | discovery_type  
                                                                          | 
heartbeart_props                   |
     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     | pr_ds | ds_0, ds_1, ds_2    | ds_0                     | {"name": 
"primary_replica_ds_mgr", "type": "mgr", "props":{"groupName":"92504d5b-6dec"} 
} | {"keepAliveCron":"0/5 * * * * ?""} |
     ```
     **DB_DISCOVERY TYPE**
     ```sql
     CREATE/ALTER DB_DISCOVERY TYPE primary_replica_ds_mgr(
       TYPE(NAME=mgr,PROPERTIES('groupName'='92504d5b-6dec'))
     )
     
     DROP DB_DISCOVERY TYPE primary_replica_ds_mgr;
     
     SHOW DB_DISCOVERY TYPE [FROM schemaName]
     
     | name                    | discovery_type | discovery_props            |
     -------------------------------------------------------------------------
     | primary_replica_ds_mgr  | mgr            | "groupName":"92504d5b-6dec"|
     
     ```
     **DB_DISCOVERY HEARTBEAT**
     ```sql
     CREATE/ALTER DB_DISCOVERY HEARTBEAT mgr_heartbeat(
       PROPERTIES('keepAliveCron'='0/5 * * * * ?')
     )
     
     DROP DB_DISCOVERY HEARTBEAT mgr_heartbeat;
     
     SHOW DB_DISCOVERY HEARTBEAT [FROM schemaName]
     
     | name           | discovery_props                  |
     -----------------------------------------------------
     | mgr_heartbeat  | "keepAliveCron":"0/5 * * * * ?"  |
     ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to