zjcnb opened a new issue, #18445:
URL: https://github.com/apache/shardingsphere/issues/18445

   Hi community,
   
   I think `MySQLNormalReplicationDatabaseDiscoveryProviderAlgorithm` need 
enhancement. Currently it only supports `master-slave` cluster mode, but not 
support `CASCADE` cluster mode. The reason to support it some users can connect 
a `standby database` on the `slave` node to achieve the purpose of backing up 
data.
   
   ```
       public void checkEnvironment(final String databaseName, final 
Collection<DataSource> dataSources) {
           ExecutorService executorService = 
ExecutorEngine.createExecutorEngineWithCPUAndResources(dataSources.size()).getExecutorServiceManager().getExecutorService();
           Collection<CompletableFuture<Collection<String>>> completableFutures 
= new LinkedList<>();
           for (DataSource dataSource : dataSources) {
               completableFutures.add(supplyAsyncCheckEnvironment(dataSource, 
executorService));
           }
           CompletableFuture.allOf(completableFutures.toArray(new 
CompletableFuture[0]));
           Iterator<CompletableFuture<Collection<String>>> 
replicationInstancesFuture = completableFutures.stream().iterator();
           int replicationGroupCount = 0;
           while (replicationInstancesFuture.hasNext()) {
               if (!replicationInstancesFuture.next().join().isEmpty()) {
                   replicationGroupCount++;
               }
           }
           Preconditions.checkState(1 == replicationGroupCount, "Check 
Environment are failed in database `%s`.", databaseName);
       }
   ```
   
   `Mster-slave mode : `
   
   
![image](https://user-images.githubusercontent.com/33742097/174548442-8af27e7f-571f-45cb-85e1-af6db3fa6874.png)
   
   `cascade mode : `
   
   ![Uploading image.png…]()
   
   - [ ] Adjustment checkEnvironment method.
   - [ ] Adjustment find primary replica relation logic.
   
   
   


-- 
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