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/01/18 06:59:35 UTC

[GitHub] [shardingsphere] zjcnb opened a new pull request #14856: Fix weight load balance throw IndexOutOfBoundsException.

zjcnb opened a new pull request #14856:
URL: https://github.com/apache/shardingsphere/pull/14856


   Fixes #14855 
   


-- 
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] menghaoranss merged pull request #14856: Fix weight load balance throw IndexOutOfBoundsException.

Posted by GitBox <gi...@apache.org>.
menghaoranss merged pull request #14856:
URL: https://github.com/apache/shardingsphere/pull/14856


   


-- 
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 change in pull request #14856: Fix weight load balance throw IndexOutOfBoundsException.

Posted by GitBox <gi...@apache.org>.
zjcnb commented on a change in pull request #14856:
URL: https://github.com/apache/shardingsphere/pull/14856#discussion_r786463040



##########
File path: shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/WeightReplicaLoadBalanceAlgorithm.java
##########
@@ -53,6 +53,9 @@ public String getDataSource(final String name, final String writeDataSourceName,
     }
 
     private String getDataSourceName(final List<String> readDataSourceNames, final double[] weight) {
+        if (1 == readDataSourceNames.size()) {
+            return readDataSourceNames.stream().findFirst().get();

Review comment:
       I will adjust `get(0)`.




-- 
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 #14856: Fix weight load balance throw IndexOutOfBoundsException.

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/14856?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 [#14856](https://codecov.io/gh/apache/shardingsphere/pull/14856?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (27ae8e9) into [master](https://codecov.io/gh/apache/shardingsphere/commit/b99a7c18052094510c018cb85455fcdfcbcea5ce?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b99a7c1) will **decrease** coverage by `0.05%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/14856/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/14856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #14856      +/-   ##
   ============================================
   - Coverage     58.97%   58.92%   -0.06%     
     Complexity     1847     1847              
   ============================================
     Files          3103     3104       +1     
     Lines         46486    46548      +62     
     Branches       7879     7894      +15     
   ============================================
   + Hits          27417    27428      +11     
   - Misses        16905    16955      +50     
   - Partials       2164     2165       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/14856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...loadbalance/WeightReplicaLoadBalanceAlgorithm.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy9zaGFyZGluZ3NwaGVyZS1yZWFkd3JpdGUtc3BsaXR0aW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9hbGdvcml0aG0vbG9hZGJhbGFuY2UvV2VpZ2h0UmVwbGljYUxvYWRCYWxhbmNlQWxnb3JpdGhtLmphdmE=) | `64.00% <0.00%> (-2.67%)` | :arrow_down: |
   | [...d/text/distsql/ral/common/hint/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9oaW50L0hpbnRTb3VyY2VUeXBlLmphdmE=) | `0.00% <0.00%> (-42.86%)` | :arrow_down: |
   | [...rter/ReadwriteSplittingRuleStatementConverter.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy9zaGFyZGluZ3NwaGVyZS1yZWFkd3JpdGUtc3BsaXR0aW5nLWRpc3RzcWwvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvY29udmVydGVyL1JlYWR3cml0ZVNwbGl0dGluZ1J1bGVTdGF0ZW1lbnRDb252ZXJ0ZXIuamF2YQ==) | `16.66% <0.00%> (-4.77%)` | :arrow_down: |
   | [...istsql/parser/core/ScalingSQLStatementVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctZGlzdHNxbC9zaGFyZGluZ3NwaGVyZS1zaGFyZGluZy1kaXN0c3FsLXBhcnNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2NhbGluZy9kaXN0c3FsL3BhcnNlci9jb3JlL1NjYWxpbmdTUUxTdGF0ZW1lbnRWaXNpdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [.../parser/segment/ReadwriteSplittingRuleSegment.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy9zaGFyZGluZ3NwaGVyZS1yZWFkd3JpdGUtc3BsaXR0aW5nLWRpc3RzcWwvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy1kaXN0c3FsLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcmVhZHdyaXRlc3BsaXR0aW5nL2Rpc3RzcWwvcGFyc2VyL3NlZ21lbnQvUmVhZHdyaXRlU3BsaXR0aW5nUnVsZVNlZ21lbnQuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...er/query/ReadwriteSplittingRuleQueryResultSet.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy9zaGFyZGluZ3NwaGVyZS1yZWFkd3JpdGUtc3BsaXR0aW5nLWRpc3RzcWwvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy1kaXN0c3FsLWhhbmRsZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9kaXN0c3FsL2hhbmRsZXIvcXVlcnkvUmVhZHdyaXRlU3BsaXR0aW5nUnVsZVF1ZXJ5UmVzdWx0U2V0LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...tgreSQLStatementMemoryStrictlyFetchSizeSetter.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL2pkYmMvc3RhdGVtZW50L2ltcGwvUG9zdGdyZVNRTFN0YXRlbWVudE1lbW9yeVN0cmljdGx5RmV0Y2hTaXplU2V0dGVyLmphdmE=) | | |
   | [...l/MySQLStatementMemoryStrictlyFetchSizeSetter.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL2pkYmMvc3RhdGVtZW50L2ltcGwvTXlTUUxTdGF0ZW1lbnRNZW1vcnlTdHJpY3RseUZldGNoU2l6ZVNldHRlci5qYXZh) | | |
   | [...enGaussStatementMemoryStrictlyFetchSizeSetter.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL2pkYmMvc3RhdGVtZW50L2ltcGwvT3BlbkdhdXNzU3RhdGVtZW50TWVtb3J5U3RyaWN0bHlGZXRjaFNpemVTZXR0ZXIuamF2YQ==) | | |
   | [...enGaussStatementMemoryStrictlyFetchSizeSetter.java](https://codecov.io/gh/apache/shardingsphere/pull/14856/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtZXhlY3V0b3Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL2V4ZWN1dG9yL3NxbC9leGVjdXRlL2VuZ2luZS9kcml2ZXIvamRiYy9zdGF0ZW1lbnQvaW1wbC9PcGVuR2F1c3NTdGF0ZW1lbnRNZW1vcnlTdHJpY3RseUZldGNoU2l6ZVNldHRlci5qYXZh) | `100.00% <0.00%> (ø)` | |
   | ... and [6 more](https://codecov.io/gh/apache/shardingsphere/pull/14856/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/14856?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/14856?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 [b99a7c1...27ae8e9](https://codecov.io/gh/apache/shardingsphere/pull/14856?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 change in pull request #14856: Fix weight load balance throw IndexOutOfBoundsException.

Posted by GitBox <gi...@apache.org>.
zjcnb commented on a change in pull request #14856:
URL: https://github.com/apache/shardingsphere/pull/14856#discussion_r786463040



##########
File path: shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/WeightReplicaLoadBalanceAlgorithm.java
##########
@@ -53,6 +53,9 @@ public String getDataSource(final String name, final String writeDataSourceName,
     }
 
     private String getDataSourceName(final List<String> readDataSourceNames, final double[] weight) {
+        if (1 == readDataSourceNames.size()) {
+            return readDataSourceNames.stream().findFirst().get();

Review comment:
       I will adjust get(0).




-- 
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] TeslaCN commented on a change in pull request #14856: Fix weight load balance throw IndexOutOfBoundsException.

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #14856:
URL: https://github.com/apache/shardingsphere/pull/14856#discussion_r786461913



##########
File path: shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/WeightReplicaLoadBalanceAlgorithm.java
##########
@@ -53,6 +53,9 @@ public String getDataSource(final String name, final String writeDataSourceName,
     }
 
     private String getDataSourceName(final List<String> readDataSourceNames, final double[] weight) {
+        if (1 == readDataSourceNames.size()) {
+            return readDataSourceNames.stream().findFirst().get();

Review comment:
       Why not just `get(0)`?




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