You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/02/03 13:56:23 UTC
[shardingsphere] branch master updated: Remove FIXED_PRIMARY loadbalance algorithm(#23974) (#23976)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 8d715589c32 Remove FIXED_PRIMARY loadbalance algorithm(#23974) (#23976)
8d715589c32 is described below
commit 8d715589c32d702d461294baf77812be0c196aec
Author: ZhangCheng <fl...@outlook.com>
AuthorDate: Fri Feb 3 21:56:07 2023 +0800
Remove FIXED_PRIMARY loadbalance algorithm(#23974) (#23976)
---
.../content/dev-manual/readwrite-splitting.cn.md | 1 -
.../content/dev-manual/readwrite-splitting.en.md | 1 -
.../builtin-algorithm/load-balance.cn.md | 8 -----
.../builtin-algorithm/load-balance.en.md | 8 -----
.../FixedPrimaryReadQueryLoadBalanceAlgorithm.java | 39 --------------------
...ritesplitting.spi.ReadQueryLoadBalanceAlgorithm | 1 -
...edPrimaryReadQueryLoadBalanceAlgorithmTest.java | 41 ----------------------
.../antlr4/imports/readwrite-splitting/BaseRule.g4 | 1 -
8 files changed, 100 deletions(-)
diff --git a/docs/document/content/dev-manual/readwrite-splitting.cn.md b/docs/document/content/dev-manual/readwrite-splitting.cn.md
index b322efecbcd..e8d5e044fe6 100644
--- a/docs/document/content/dev-manual/readwrite-splitting.cn.md
+++ b/docs/document/content/dev-manual/readwrite-splitting.cn.md
@@ -28,4 +28,3 @@ chapter = true
| FIXED_REPLICA_RANDOM | 显式开启事务,读请求采用随机策略路由到一个固定读库;不开事务,每次读流量使用指定算法路由到不同的读库 | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaRandomReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedReplicaRandomReadQueryLoadBalanceAlgorithm.java) |
| FIXED_REPLICA_ROUND_ROBIN | 显式开启事务,读请求采用轮询策略路由到一个固定读库;不开事务,每次读流量使用指定算法路由到不同的读库 | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaRoundRobinReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedReplicaRoundRobinReadQueryLoadBalanceAlgorithm.java) |
| FIXED_REPLICA_WEIGHT | 显式开启事务,读请求采用权重策略路由到多个读库;不开事务,每次读流量使用指定算法路由到不同的读库 | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaWeightReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedReplicaWeightReadQueryLoadBalanceAlgorithm.java) |
-| FIXED_PRIMARY | 读请求全部路由到主库 | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedPrimaryReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedPrimaryReadQueryLoadBalanceAlgorithm.java) |
diff --git a/docs/document/content/dev-manual/readwrite-splitting.en.md b/docs/document/content/dev-manual/readwrite-splitting.en.md
index fb71a994256..24911c18aa4 100644
--- a/docs/document/content/dev-manual/readwrite-splitting.en.md
+++ b/docs/document/content/dev-manual/readwrite-splitting.en.md
@@ -28,4 +28,3 @@ Read query load balance algorithm's definition
| FIXED_REPLICA_RANDOM | Open transaction, and the read request is routed to a fixed replica using a random strategy; if the transaction is not opened, each read traffic is routed to a different replica using the specified algorithm | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaRandomReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/r [...]
| FIXED_REPLICA_ROUND_ROBIN | Open transaction, and the read request is routed to a fixed replica using a round-robin strategy; if the transaction is not opened, each read traffic is routed to a different replica using the specified algorithm | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaRoundRobinReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphe [...]
| FIXED_REPLICA_WEIGHT | Open transaction, and the read request is routed to a fixed replica using a weight strategy; if the transaction is not opened, each read traffic is routed to a different replica using the specified algorithm | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaWeightReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/r [...]
-| FIXED_PRIMARY | All read traffic is routed to the primary | [`org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedPrimaryReadQueryLoadBalanceAlgorithm`](https://github.com/apache/shardingsphere/blob/master/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwri [...]
diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md
index 314a53da2bd..655d583ebcd 100644
--- a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md
+++ b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md
@@ -93,14 +93,6 @@ ShardingSphere 内置提供了多种负载均衡算法,具体包括了轮询
| -------------- | -------- |--------------------------------------------------------------|
| ${replica-name} | double | 属性名使用读库名称,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
-### 固定主库负载均衡算法
-
-类型:FIXED_PRIMARY
-
-说明:读请求全部路由到 primary
-
-可配置属性:无
-
## 操作步骤
1. 使用读写分离时,在 loadBalancers 属性下配置对应的负载均衡算法即可;
diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md
index d0aabb61ce6..78923b12e36 100644
--- a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md
+++ b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md
@@ -95,14 +95,6 @@ Attributes:
| -------------- |------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ${replica-name} | double | Attribute name uses the name of the replica, and the parameter fills in the weight value corresponding to the replica. Weight parameter range min > 0, total <= Double.MAX_VALUE. |
-### Fixed Primary Load Balance Algorithm
-
-Type: FIXED_PRIMARY
-
-Description: All read query are routed to the primary.
-
-Attributes: None
-
## Procedure
1. Configure a load balancer algorithm for the loadBalancers attribute to use read/write splitting.
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedPrimaryReadQueryLoadBalanceAlgorithm.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedPrimaryReadQueryLoadBalanceAlgorithm.java
deleted file mode 100644
index 4f1555a3868..00000000000
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedPrimaryReadQueryLoadBalanceAlgorithm.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.algorithm.loadbalance;
-
-import org.apache.shardingsphere.infra.context.transaction.TransactionConnectionContext;
-import org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm;
-
-import java.util.List;
-
-/**
- * Fixed primary read query load-balance algorithm.
- */
-public final class FixedPrimaryReadQueryLoadBalanceAlgorithm implements ReadQueryLoadBalanceAlgorithm {
-
- @Override
- public String getDataSource(final String name, final String writeDataSourceName, final List<String> readDataSourceNames, final TransactionConnectionContext context) {
- return writeDataSourceName;
- }
-
- @Override
- public String getType() {
- return "FIXED_PRIMARY";
- }
-}
diff --git a/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm b/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm
index 79791cd3643..e29145febfd 100644
--- a/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm
+++ b/features/readwrite-splitting/core/src/main/resources/META-INF/services/org.apache.shardingsphere.readwritesplitting.spi.ReadQueryLoadBalanceAlgorithm
@@ -18,7 +18,6 @@
org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.RoundRobinReadQueryLoadBalanceAlgorithm
org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.RandomReadQueryLoadBalanceAlgorithm
org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.WeightReadQueryLoadBalanceAlgorithm
-org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedPrimaryReadQueryLoadBalanceAlgorithm
org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaRandomReadQueryLoadBalanceAlgorithm
org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaRoundRobinReadQueryLoadBalanceAlgorithm
org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.FixedReplicaWeightReadQueryLoadBalanceAlgorithm
diff --git a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedPrimaryReadQueryLoadBalanceAlgorithmTest.java b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedPrimaryReadQueryLoadBalanceAlgorithmTest.java
deleted file mode 100644
index 61ded549a7d..00000000000
--- a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/algorithm/loadbalance/FixedPrimaryReadQueryLoadBalanceAlgorithmTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.algorithm.loadbalance;
-
-import org.apache.shardingsphere.infra.context.transaction.TransactionConnectionContext;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public final class FixedPrimaryReadQueryLoadBalanceAlgorithmTest {
-
- private final FixedPrimaryReadQueryLoadBalanceAlgorithm loadBalanceAlgorithm = new FixedPrimaryReadQueryLoadBalanceAlgorithm();
-
- @Test
- public void assertGetDataSource() {
- String writeDataSourceName = "test_write_ds";
- String readDataSourceName1 = "test_replica_ds_1";
- String readDataSourceName2 = "test_replica_ds_2";
- List<String> readDataSourceNames = Arrays.asList(readDataSourceName1, readDataSourceName2);
- assertThat(loadBalanceAlgorithm.getDataSource("ds", writeDataSourceName, readDataSourceNames, new TransactionConnectionContext()), is(writeDataSourceName));
- }
-}
diff --git a/features/readwrite-splitting/distsql/parser/src/main/antlr4/imports/readwrite-splitting/BaseRule.g4 b/features/readwrite-splitting/distsql/parser/src/main/antlr4/imports/readwrite-splitting/BaseRule.g4
index f6463f333fd..572f78b3a9c 100644
--- a/features/readwrite-splitting/distsql/parser/src/main/antlr4/imports/readwrite-splitting/BaseRule.g4
+++ b/features/readwrite-splitting/distsql/parser/src/main/antlr4/imports/readwrite-splitting/BaseRule.g4
@@ -41,7 +41,6 @@ buildInAlgorithmTypeName
| FIXED_REPLICA_RANDOM
| FIXED_REPLICA_ROUND_ROBIN
| FIXED_REPLICA_WEIGHT
- | FIXED_PRIMARY
;
propertiesDefinition