You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/06/20 14:16:09 UTC

[GitHub] [shardingsphere] natehuangting opened a new pull request, #18465: MySQLNormalReplicationDatabaseDiscovery support min-enabled-replicas

natehuangting opened a new pull request, #18465:
URL: https://github.com/apache/shardingsphere/pull/18465

   Fixes #18380 .
   
   Changes proposed in this pull request:
   - MySQLNormalReplicationDatabaseDiscovery support min-enabled-replicas


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zjcnb merged pull request #18465: MySQLNormalReplicationDatabaseDiscovery support min-enabled-replicas

Posted by GitBox <gi...@apache.org>.
zjcnb merged PR #18465:
URL: https://github.com/apache/shardingsphere/pull/18465


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] codecov-commenter commented on pull request #18465: MySQLNormalReplicationDatabaseDiscovery support min-enabled-replicas

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #18465:
URL: https://github.com/apache/shardingsphere/pull/18465#issuecomment-1160554676

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18465?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#18465](https://codecov.io/gh/apache/shardingsphere/pull/18465?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b27f865) into [master](https://codecov.io/gh/apache/shardingsphere/commit/d7636d89d3dde7768bd71ac0c2b1104563a4c877?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d7636d8) will **decrease** coverage by `0.00%`.
   > The diff coverage is `16.66%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #18465      +/-   ##
   ============================================
   - Coverage     59.07%   59.06%   -0.01%     
     Complexity     2262     2262              
   ============================================
     Files          3737     3737              
     Lines         54930    54940      +10     
     Branches       8020     8026       +6     
   ============================================
   + Hits          32449    32450       +1     
   - Misses        19723    19732       +9     
     Partials       2758     2758              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/18465?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...phere/mode/metadata/storage/StorageNodeStatus.java](https://codecov.io/gh/apache/shardingsphere/pull/18465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL21vZGUvbWV0YWRhdGEvc3RvcmFnZS9TdG9yYWdlTm9kZVN0YXR1cy5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...dbdiscovery/algorithm/DatabaseDiscoveryEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/18465/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZGItZGlzY292ZXJ5L3NoYXJkaW5nc3BoZXJlLWRiLWRpc2NvdmVyeS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kYmRpc2NvdmVyeS9hbGdvcml0aG0vRGF0YWJhc2VEaXNjb3ZlcnlFbmdpbmUuamF2YQ==) | `37.50% <18.18%> (-7.67%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18465?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18465?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [d7636d8...b27f865](https://codecov.io/gh/apache/shardingsphere/pull/18465?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


[GitHub] [shardingsphere] zjcnb commented on a diff in pull request #18465: MySQLNormalReplicationDatabaseDiscovery support min-enabled-replicas

Posted by GitBox <gi...@apache.org>.
zjcnb commented on code in PR #18465:
URL: https://github.com/apache/shardingsphere/pull/18465#discussion_r902149933


##########
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/algorithm/DatabaseDiscoveryEngine.java:
##########
@@ -97,11 +98,26 @@ private Map<String, DataSource> getActiveDataSourceMap(final Map<String, DataSou
         }
         return result;
     }
-    
-    private void postReplicaDataSourceDisabledEvent(final String databaseName, final String groupName, final String primaryDataSourceName, final Map<String, DataSource> dataSourceMap) {
+
+    private void postReplicaDataSourceDisabledEvent(final String databaseName, final String groupName, final String primaryDataSourceName,
+            final Map<String, DataSource> dataSourceMap, final Collection<String> disabledDataSourceNames) {
+        int enabledReplicasCount = dataSourceMap.size() - disabledDataSourceNames.size() - 1;
+
         for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
             if (!entry.getKey().equals(primaryDataSourceName)) {
-                ShardingSphereEventBus.getInstance().post(new DataSourceDisabledEvent(databaseName, groupName, entry.getKey(), createStorageNodeDataSource(loadReplicaStatus(entry.getValue()))));
+                StorageNodeDataSource storageNodeDataSource = createStorageNodeDataSource(loadReplicaStatus(entry.getValue()));
+
+                if (StorageNodeStatus.isEnable(storageNodeDataSource.getStatus())) {
+                    enabledReplicasCount += disabledDataSourceNames.contains(entry.getKey()) ? 1 : 0;
+                    ShardingSphereEventBus.getInstance().post(new DataSourceDisabledEvent(databaseName, groupName, entry.getKey(), storageNodeDataSource));
+                    continue;
+                }
+

Review Comment:
   Please remove extra blank line



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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