You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "QiangYuan0828 (via GitHub)" <gi...@apache.org> on 2023/04/01 04:19:33 UTC

[GitHub] [shardingsphere] QiangYuan0828 opened a new pull request, #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

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

   Fixes #24752 
   
   Changes proposed in this pull request:
     -check if every index is out of range;
     -check if every String is neither nor or "";
   but a little confused if I need to create specific Exception classes.
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [X] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [X] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [X] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
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] QiangYuan0828 commented on pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "QiangYuan0828 (via GitHub)" <gi...@apache.org>.
QiangYuan0828 commented on PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#issuecomment-1518943533

   @Pace2Car  Sorry for being late. Already modified. But I submitted via the IDEA plugin this time, not sure why it shows that I dismissed stale review and marked review outdated.


-- 
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] Pace2Car commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1172224576


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/exception/algorithm/ReadQueryLoadBalanceAlgorithmInitializationExcpetion.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.exception.algorithm;
+
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
+import org.apache.shardingsphere.readwritesplitting.exception.ReadwriteSplittingSQLException;
+
+public class ReadQueryLoadBalanceAlgorithmInitializationExcpetion extends ReadwriteSplittingSQLException {
+    
+    private static final long serialVersionUID = -8673960967175624027L;
+    
+    public ReadQueryLoadBalanceAlgorithmInitializationExcpetion(final String loadBalanceAlgorithmType, final String reason) {
+        super(XOpenSQLState.CHECK_OPTION_VIOLATION, 83, "'%s' Read Query Load BalanceAlgorithm initialization failed, reason is: %s.", loadBalanceAlgorithmType, reason);

Review Comment:
   Use natural syntax in exception messages, `'%s' read query load balance algorithm initialization failed, reason is: %s.`.



-- 
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] Pace2Car commented on pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#issuecomment-1518929206

   Hi @QiangYuan0828 , there are still some code style comments left in this PR, please modify, and then it can be merged.


-- 
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] Pace2Car commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1168112049


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/RandomReadQueryLoadBalanceAlgorithm.java:
##########
@@ -29,7 +30,10 @@ public final class RandomReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     
     @Override
     public String getDataSource(final String name, final String writeDataSourceName, final List<String> readDataSourceNames) {
-        return readDataSourceNames.get(ThreadLocalRandom.current().nextInt(readDataSourceNames.size()));
+        Preconditions.checkState(readDataSourceNames.size() > 0, "read data need at least 1 source.");

Review Comment:
   Please use `ShardingSpherePreconditions` to replace `Preconditions`.



-- 
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] Pace2Car commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169558321


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/WeightReadQueryLoadBalanceAlgorithm.java:
##########
@@ -50,6 +51,17 @@ public final class WeightReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     public void init(final Properties props) {
         this.props = props;
         dataSourceNames = props.stringPropertyNames();
+        ShardingSpherePreconditions.checkState(!dataSourceNames.isEmpty(), () -> new ReadQueryLoadBalanceAlgorithmInitializationExcpetion(getType(), "data source shouldn't be empty!"));

Review Comment:
   message `Read data source is required` could be better.



-- 
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] QiangYuan0828 commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "QiangYuan0828 (via GitHub)" <gi...@apache.org>.
QiangYuan0828 commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1170846104


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/WeightReadQueryLoadBalanceAlgorithm.java:
##########
@@ -50,6 +51,17 @@ public final class WeightReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     public void init(final Properties props) {
         this.props = props;
         dataSourceNames = props.stringPropertyNames();
+        ShardingSpherePreconditions.checkState(!dataSourceNames.isEmpty(), () -> new ReadQueryLoadBalanceAlgorithmInitializationExcpetion(getType(), "data source shouldn't be empty!"));
+        for (String dataSourceName : dataSourceNames) {
+            Object weightObject = props.get(dataSourceName);
+            ShardingSpherePreconditions.checkNotNull(weightObject,
+                    () -> new MissingRequiredReadDatabaseWeightException(getType(), String.format("Read database `%s` access weight is not configured.", dataSourceName)));
+            try {
+                Double.parseDouble(weightObject.toString());
+            } catch (final NumberFormatException ex) {
+                throw new InvalidReadDatabaseWeightException(weightObject);
+            }
+        }

Review Comment:
   Thanks for your suggestions. Already modified.



-- 
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] QiangYuan0828 commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "QiangYuan0828 (via GitHub)" <gi...@apache.org>.
QiangYuan0828 commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169482375


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/RandomReadQueryLoadBalanceAlgorithm.java:
##########
@@ -29,7 +30,10 @@ public final class RandomReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     
     @Override
     public String getDataSource(final String name, final String writeDataSourceName, final List<String> readDataSourceNames) {
-        return readDataSourceNames.get(ThreadLocalRandom.current().nextInt(readDataSourceNames.size()));
+        Preconditions.checkState(readDataSourceNames.size() > 0, "read data need at least 1 source.");

Review Comment:
   Thanks for your clarification. I have already reverted the first commit. May I have some suggestions about the commit about `init` in `WeightReadQueryLoadBalanceAlgorithm`?



-- 
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] QiangYuan0828 commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "QiangYuan0828 (via GitHub)" <gi...@apache.org>.
QiangYuan0828 commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169423555


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/RandomReadQueryLoadBalanceAlgorithm.java:
##########
@@ -29,7 +30,10 @@ public final class RandomReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     
     @Override
     public String getDataSource(final String name, final String writeDataSourceName, final List<String> readDataSourceNames) {
-        return readDataSourceNames.get(ThreadLocalRandom.current().nextInt(readDataSourceNames.size()));
+        Preconditions.checkState(readDataSourceNames.size() > 0, "read data need at least 1 source.");

Review Comment:
   I’m sorry for the misunderstanding. In the first commit, I misunderstand this issue, I change the `getDataSource` function rather than `init` function. After your suggetions in #24752 , I  imporve the properties verification of `init` in `WeightReadQueryLoadBalanceAlgorithm` in the second commit but forget cancel the first commit. Sould I continue or cancel the first commit? 
   By the way, I didn't find 'init' function in `RandomReadQueryLoadBalanceAlgorithm` and `RoundRobinReadQueryLoadBalanceAlgorithm`, should I write `init` function by myself like `WeightReadQueryLoadBalanceAlgorithm`?
   Sorry for the inconvenience.



-- 
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] Pace2Car commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1172221790


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/WeightReadQueryLoadBalanceAlgorithm.java:
##########
@@ -50,6 +51,17 @@ public final class WeightReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     public void init(final Properties props) {
         this.props = props;
         dataSourceNames = props.stringPropertyNames();
+        ShardingSpherePreconditions.checkState(!dataSourceNames.isEmpty(), () -> new ReadQueryLoadBalanceAlgorithmInitializationExcpetion(getType(), "Read data source is required"));
+        for (String dataSourceName : dataSourceNames) {
+            Object weightObject = props.get(dataSourceName);

Review Comment:
   Here you can directly get the String from props.getProperty().



-- 
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] Pace2Car commented on pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#issuecomment-1514210564

   Hi @QiangYuan0828, please resolve conflicts.


-- 
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] RaigorJiang commented on pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#issuecomment-1518980629

   @QiangYuan0828 @Pace2Car  Merged, thank you!


-- 
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] QiangYuan0828 closed pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "QiangYuan0828 (via GitHub)" <gi...@apache.org>.
QiangYuan0828 closed pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm
URL: https://github.com/apache/shardingsphere/pull/24934


-- 
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] QiangYuan0828 commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "QiangYuan0828 (via GitHub)" <gi...@apache.org>.
QiangYuan0828 commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169423555


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/RandomReadQueryLoadBalanceAlgorithm.java:
##########
@@ -29,7 +30,10 @@ public final class RandomReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     
     @Override
     public String getDataSource(final String name, final String writeDataSourceName, final List<String> readDataSourceNames) {
-        return readDataSourceNames.get(ThreadLocalRandom.current().nextInt(readDataSourceNames.size()));
+        Preconditions.checkState(readDataSourceNames.size() > 0, "read data need at least 1 source.");

Review Comment:
   I’m sorry for the misunderstanding. In the first commit, I misunderstand this issue, I change the `getDataSource` function rather than `init` function. After your suggetions in #24752 , I  imporve the properties verification of `init` in `WeightReadQueryLoadBalanceAlgorithm` in the second commit but forget cancel the first commit. Sould I continue or cancel the first commit? 
   By the way, I didn't find `init` function in `RandomReadQueryLoadBalanceAlgorithm` and `RoundRobinReadQueryLoadBalanceAlgorithm`, should I write `init` function by myself like `WeightReadQueryLoadBalanceAlgorithm`?
   Sorry for the inconvenience.



-- 
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] Pace2Car commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169564324


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/WeightReadQueryLoadBalanceAlgorithm.java:
##########
@@ -50,6 +51,17 @@ public final class WeightReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     public void init(final Properties props) {
         this.props = props;
         dataSourceNames = props.stringPropertyNames();
+        ShardingSpherePreconditions.checkState(!dataSourceNames.isEmpty(), () -> new ReadQueryLoadBalanceAlgorithmInitializationExcpetion(getType(), "data source shouldn't be empty!"));
+        for (String dataSourceName : dataSourceNames) {
+            Object weightObject = props.get(dataSourceName);
+            ShardingSpherePreconditions.checkNotNull(weightObject,
+                    () -> new MissingRequiredReadDatabaseWeightException(getType(), String.format("Read database `%s` access weight is not configured.", dataSourceName)));
+            try {
+                Double.parseDouble(weightObject.toString());
+            } catch (final NumberFormatException ex) {
+                throw new InvalidReadDatabaseWeightException(weightObject);
+            }
+        }

Review Comment:
   After the check is passed here, the check in `getWeightValue` is unnecessary and can be removed



-- 
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] Pace2Car commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169435862


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/RandomReadQueryLoadBalanceAlgorithm.java:
##########
@@ -29,7 +30,10 @@ public final class RandomReadQueryLoadBalanceAlgorithm implements ReadQueryLoadB
     
     @Override
     public String getDataSource(final String name, final String writeDataSourceName, final List<String> readDataSourceNames) {
-        return readDataSourceNames.get(ThreadLocalRandom.current().nextInt(readDataSourceNames.size()));
+        Preconditions.checkState(readDataSourceNames.size() > 0, "read data need at least 1 source.");

Review Comment:
   Ok, I reorganized it, here should revert the first commit, the goal of this issue is to improve check in `init` method.
   > As for the algorithm that does not implement the `init` method, it can be ignored, I will modify the issue tasks. Thanks for pointing out



-- 
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] RaigorJiang merged pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang merged PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934


-- 
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] QiangYuan0828 commented on pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "QiangYuan0828 (via GitHub)" <gi...@apache.org>.
QiangYuan0828 commented on PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#issuecomment-1515370744

   @Pace2Car Thanks for your suggestion. Already resolved. 


-- 
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] Pace2Car commented on a diff in pull request #24934: Improve properties verification of ReadQueryLoadBalanceAlgorithm

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car commented on code in PR #24934:
URL: https://github.com/apache/shardingsphere/pull/24934#discussion_r1169559172


##########
features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/exception/algorithm/ReadQueryLoadBalanceAlgorithmInitializationExcpetion.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.readwritesplitting.exception.algorithm;
+
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
+import org.apache.shardingsphere.readwritesplitting.exception.ReadwriteSplittingSQLException;
+
+public class ReadQueryLoadBalanceAlgorithmInitializationExcpetion extends ReadwriteSplittingSQLException {
+    
+    private static final long serialVersionUID = -8673960967175624027L;
+    
+    public ReadQueryLoadBalanceAlgorithmInitializationExcpetion(final String loadBalanceAlgorithmType, final String reason) {
+        super(XOpenSQLState.CHECK_OPTION_VIOLATION, 82, "'%s' Read Query Load BalanceAlgorithm initialization failed, reason is: %s.", loadBalanceAlgorithmType, reason);

Review Comment:
   errorCode `82` is in used, please replace to 83



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