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/03/24 09:14:51 UTC
[shardingsphere] branch master updated: Revise docs for transactionalReadQueryStrategy (#24804)
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 eb411f6afe6 Revise docs for transactionalReadQueryStrategy (#24804)
eb411f6afe6 is described below
commit eb411f6afe6719cc089697d9559ab90b1ba23c01
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Mar 24 17:14:43 2023 +0800
Revise docs for transactionalReadQueryStrategy (#24804)
* Rename TransactionalReadQueryStrategy
* Revise docs for transactionalReadQueryStrategy
---
.../builtin-algorithm/load-balance.cn.md | 25 +++--------------
.../builtin-algorithm/load-balance.en.md | 25 +++--------------
.../java-api/rules/readwrite-splitting.cn.md | 31 +++++++++++-----------
.../java-api/rules/readwrite-splitting.en.md | 25 ++++++++---------
.../yaml-config/rules/readwrite-splitting.cn.md | 3 +++
.../yaml-config/rules/readwrite-splitting.en.md | 3 +++
6 files changed, 41 insertions(+), 71 deletions(-)
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 aec31e47582..b539eeaad3b 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
@@ -13,38 +13,19 @@ ShardingSphere 内置提供了多种负载均衡算法,具体包括了轮询
类型:ROUND_ROBIN
-说明:事务内,读请求根据 `transaction-read-query-strategy` 属性的配置进行路由。事务外,采用轮询策略路由到 replica。
-
-可配置属性:
-
-| *属性名称* | *数据类型* | *说明* |
-| -------------- |--------|-------------------------------------------------------------------------------------------------------------------------------------------|
-| transaction-read-query-strategy | String | 事务内读请求路由策略,可选值:FIXED_PRIMARY(路由到 primary)、FIXED_REPLICA(根据轮询策略选择一个固定的 replica)、DYNAMIC_REPLICA(根据轮询策略路由到不同的 replica),默认值:FIXED_PRIMARY。 |
-
### 随机负载均衡算法
类型:RANDOM
-说明:事务内,读请求根据 `transaction-read-query-strategy` 属性的配置进行路由。事务外,采用随机策略路由到 replica。
-
-可配置属性:
-
-| *属性名称* | *数据类型* | *说明* |
-| -------------- |--------|-----------------------------------------------------------------------------------------------------------------------------------------|
-| transaction-read-query-strategy | String | 事务内读请求路由策略,可选值:FIXED_PRIMARY(路由到 primary)、FIXED_REPLICA(根据随机策略选择一个固定的 replica)、DYNAMIC_REPLICA(根据随机策略路由到不同的 replica),默认值:FIXED_PRIMARY。 |
-
### 权重负载均衡算法
类型:WEIGHT
-说明:事务内,读请求根据 `transaction-read-query-strategy` 属性的配置进行路由。事务外,采用权重策略路由到 replica。
-
可配置属性:
-| *属性名称* | *数据类型* | *说明* |
-| -------------- |--------|-----------------------------------------------------------------------------------------------------------------------------------------|
-| ${replica-name} | double | 属性名使用读库名称,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
-| transaction-read-query-strategy | String | 事务内读请求路由策略,可选值:FIXED_PRIMARY(路由到 primary)、FIXED_REPLICA(根据权重策略选择一个固定的 replica)、DYNAMIC_REPLICA(根据权重策略路由到不同的 replica),默认值:FIXED_PRIMARY。 |
+| *属性名称* | *数据类型* | *说明* |
+|-----------------|--------|--------------------------------------------------------------|
+| ${replica-name} | double | 属性名使用读库名称,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
## 操作步骤
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 f381a992ade..4a18fbdd4e4 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
@@ -15,38 +15,19 @@ Moreover, considering the complexity of the business scenario, the built-in algo
Type: ROUND_ROBIN
-Description: Within the transaction, read query are routed according to the configuration of the `transaction-read-query-strategy` property, and outside the transaction, the round-robin strategy is used to route to the replica.
-
-Attributes:
-
-| *Name* | *DataType* | *Description* |
-| -------------- |------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| transaction-read-query-strategy | String | Routing strategy for read query within a transaction, optional values: FIXED_PRIMARY (route to primary), FIXED_REPLICA (select a fixed replica according to the round-robin strategy), DYNAMIC_REPLICA (route to different replicas according to the round-robin strategy), default value: FIXED_PRIMARY. |
-
### Random Load Balance Algorithm
Type: RANDOM
-Description: Within the transaction, read query are routed according to the configuration of the `transaction-read-query-strategy` property, and outside the transaction, the random strategy is used to route to the replica.
-
-Attributes:
-
-| *Name* | *DataType* | *Description* |
-| -------------- |------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| transaction-read-query-strategy | String | Routing strategy for read query within a transaction, optional values: FIXED_PRIMARY (route to primary), FIXED_REPLICA (select a fixed replica according to the random strategy), DYNAMIC_REPLICA (route to different replicas according to the random strategy), default value: FIXED_PRIMARY. |
-
### Weight Load Balance Algorithm
Type: WEIGHT
-Description: Within the transaction, read query are routed according to the configuration of the `transaction-read-query-strategy` property, and outside the transaction, the weight strategy is used to route to the replica.
-
Attributes:
-| *Name* | *DataType* | *Description* |
-| -------------- |------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| ${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. |
-| transaction-read-query-strategy | String | Routing strategy for read query within a transaction, optional values: FIXED_PRIMARY (route to primary), FIXED_REPLICA (select a fixed replica according to the weight strategy), DYNAMIC_REPLICA (route to different replicas according to the weight strategy), default value: FIXED_PRIMARY. |
+| *Name* | *DataType* | *Description* |
+|-----------------|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| ${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. |
## Procedure
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.cn.md
index 816d341d8b0..42be85b99e9 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.cn.md
@@ -15,9 +15,9 @@ Java API 形式配置的读写分离可以方便的适用于各种场景,不
可配置属性:
-| *名称* | *数据类型* | *说明* |
-| ----------------- | ----------------------------------------------------------- | ---------------- |
-| dataSources (+) | Collection\<ReadwriteSplittingDataSourceRuleConfiguration\> | 读写数据源配置 |
+| *名称* | *数据类型* | *说明* |
+|-------------------|-------------------------------------------------------------|------------|
+| dataSources (+) | Collection\<ReadwriteSplittingDataSourceRuleConfiguration\> | 读写数据源配置 |
| loadBalancers (*) | Map\<String, AlgorithmConfiguration\> | 从库负载均衡算法配置 |
## 主从数据源配置
@@ -26,19 +26,20 @@ Java API 形式配置的读写分离可以方便的适用于各种场景,不
可配置属性:
-| *名称* | *数据类型* | *说明* | *默认值* |
-| -------------------- | ---------------------------------------------- | ---------------- | ------------- |
-| name | String | 读写分离数据源名称 | - |
-| staticStrategy | StaticReadwriteSplittingStrategyConfiguration | 静态读写分离配置 | - |
-| dynamicStrategy | DynamicReadwriteSplittingStrategyConfiguration | 动态读写分离配置 | - |
-| loadBalancerName (?) | String | 读库负载均衡算法名称 | 轮询负载均衡算法 |
+| *名称* | *数据类型* | *说明* | *默认值* |
+|------------------------------------|------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------|
+| name | String | 读写分离数据源名称 | - |
+| staticStrategy | StaticReadwriteSplittingStrategyConfiguration | 静态读写分离配置 | - |
+| dynamicStrategy | DynamicReadwriteSplittingStrategyConfiguration | 动态读写分离配置 | - |
+| transactionalReadQueryStrategy (?) | TransactionalReadQueryStrategy | 事务内读请求的路由策略,可选值:FIXED_PRIMARY(路由至主库)、FIXED_REPLICA(同一事务内路由至固定数据源)、DYNAMIC_REPLICA(同一事务内路由至非固定数据源)。默认值:DYNAMIC_REPLICA。 |
+| loadBalancerName (?) | String | 读库负载均衡算法名称 | 轮询负载均衡算法 |
类名称:org.apache.shardingsphere.readwritesplitting.api.strategy.StaticReadwriteSplittingStrategyConfiguration
可配置属性:
-| *名称* | *数据类型* | *说明* |
-| ------------------- | -------------- | ----------- |
+| *名称* | *数据类型* | *说明* |
+|---------------------|----------------|---------|
| writeDataSourceName | String | 写库数据源名称 |
| readDataSourceNames | List\<String\> | 读库数据源列表 |
@@ -46,10 +47,10 @@ Java API 形式配置的读写分离可以方便的适用于各种场景,不
可配置属性:
-| *名称* | *数据类型* | *说明* | *默认值* |
-| ------------------------------- | --------- | -------------------------- | ------- |
-| autoAwareDataSourceName | String | 数据库发现的逻辑数据源名称 | - |
-| writeDataSourceQueryEnabled (?) | String | 读库全部下线,主库是否承担读流量 | true |
+| *名称* | *数据类型* | *说明* | *默认值* |
+|---------------------------------|--------|------------------|-------|
+| autoAwareDataSourceName | String | 数据库发现的逻辑数据源名称 | - |
+| writeDataSourceQueryEnabled (?) | String | 读库全部下线,主库是否承担读流量 | true |
算法类型的详情,请参见[内置负载均衡算法列表](/cn/user-manual/common-config/builtin-algorithm/load-balance)。
查询一致性路由的详情,请参见[核心特性:读写分离](/cn/features/readwrite-splitting/)。
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.en.md
index e442ffae07b..d5f49721108 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/java-api/rules/readwrite-splitting.en.md
@@ -16,7 +16,7 @@ Class name: org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingR
Configurable Properties:
| *Name* | *DataType* | *Description* |
-| ----------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------- |
+|-------------------|-------------------------------------------------------------|------------------------------------------------------------------------|
| dataSources (+) | Collection\<ReadwriteSplittingDataSourceRuleConfiguration\> | Data sources of write and reads |
| loadBalancers (*) | Map\<String, AlgorithmConfiguration\> | Load balance algorithm name and configurations of replica data sources |
@@ -26,19 +26,20 @@ Class name: org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplit
Configurable Properties:
-| *Name* | *DataType* | *Description* | *Default Value* |
-| -------------------- | ---------- | ---------------------------------------------- | ---------------------------------- |
-| name | String | Readwrite-splitting data source name | - |
-| staticStrategy | String | Static Readwrite-splitting configuration | - |
-| dynamicStrategy | Properties | Dynamic Readwrite-splitting configuration | - |
-| loadBalancerName (?) | String | Load balance algorithm name of replica sources | Round robin load balance algorithm |
+| *Name* | *DataType* | *Description* | *Default Value* |
+|------------------------------------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
+| name | String | Readwrite-splitting data source name | - |
+| staticStrategy | String | Static Readwrite-splitting configuration | - |
+| dynamicStrategy | Properties | Dynamic Readwrite-splitting configuration | - |
+| transactionalReadQueryStrategy (?) | TransactionalReadQueryStrategy | Routing strategy for read query within a transaction, values include: FIXED_PRIMARY (to primary), FIXED_REPLICA (to fixed data source), DYNAMIC_REPLICA (to any data source), default value: DYNAMIC_REPLICA. |
+| loadBalancerName (?) | String | Load balance algorithm name of replica sources | Round robin load balance algorithm |
Class name:org.apache.shardingsphere.readwritesplitting.api.strategy.StaticReadwriteSplittingStrategyConfiguration
Configurable Properties:
| *Name* | *DataType* | *Description* |
-| ------------------- | -------------- | ---------------------- |
+|---------------------|----------------|------------------------|
| writeDataSourceName | String | Write data source name |
| readDataSourceNames | List\<String\> | Read data sources list |
@@ -46,10 +47,10 @@ Class name:org.apache.shardingsphere.readwritesplitting.api.strategy.DynamicRe
Configurable Properties:
-| *Name* | *DataType* | *Description* | *Default Value* |
-| ------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------| -------------------|
-| autoAwareDataSourceName | String | Database discovery logic data source name | - |
-| writeDataSourceQueryEnabled (?) | String | All read data source are offline, write data source whether the data source is responsible for read traffic | true |
+| *Name* | *DataType* | *Description* | *Default Value* |
+|---------------------------------|------------|-------------------------------------------------------------------------------------------------------------|-----------------|
+| autoAwareDataSourceName | String | Database discovery logic data source name | - |
+| writeDataSourceQueryEnabled (?) | String | All read data source are offline, write data source whether the data source is responsible for read traffic | true |
Please refer to [Built-in Load Balance Algorithm List](/en/user-manual/common-config/builtin-algorithm/load-balance) for details on algorithm types.
Please refer to [Read-write splitting-Core features](/en/features/readwrite-splitting/) for more details about query consistent routing.
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.cn.md
index 80b30601d9a..5aeaff11dd7 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.cn.md
@@ -19,6 +19,7 @@ rules:
static_strategy: # 读写分离类型
write_data_source_name: # 写库数据源名称
read_data_source_names: # 读库数据源名称,多个从数据源用逗号分隔
+ transactionalReadQueryStrategy (?): # 事务内读请求的路由策略,可选值:FIXED_PRIMARY(路由至主库)、FIXED_REPLICA(同一事务内路由至固定数据源)、DYNAMIC_REPLICA(同一事务内路由至非固定数据源)。默认值:DYNAMIC_REPLICA
loadBalancerName: # 负载均衡算法名称
# 负载均衡算法配置
@@ -38,6 +39,7 @@ rules:
<data_source_name> (+): # 读写分离逻辑数据源名称
dynamic_strategy: # 读写分离类型
auto_aware_data_source_name: # 数据库发现逻辑数据源名称
+ transactionalReadQueryStrategy (?): # 事务内读请求的路由策略,可选值:FIXED_PRIMARY(路由至主库)、FIXED_REPLICA(同一事务内路由至固定数据源)、DYNAMIC_REPLICA(同一事务内路由至非固定数据源)。默认值:DYNAMIC_REPLICA
loadBalancerName: # 负载均衡算法名称
# 负载均衡算法配置
@@ -66,6 +68,7 @@ rules:
readDataSourceNames:
- read_ds_0
- read_ds_1
+ transactionalReadQueryStrategy: FIXED_PRIMARY
loadBalancerName: random
loadBalancers:
random:
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.en.md
index 7bf9278ff92..25b2882c029 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting.en.md
@@ -18,6 +18,7 @@ rules:
static_strategy: # Readwrite-splitting type
write_data_source_name: # Write data source name
read_data_source_names: # Read data source names, multiple data source names separated with comma
+ transactionalReadQueryStrategy (?): # Routing strategy for read query within a transaction, values include: FIXED_PRIMARY (to primary), FIXED_REPLICA (to fixed data source), DYNAMIC_REPLICA (to any data source), default value: DYNAMIC_REPLICA
loadBalancerName: # Load balance algorithm name
# Load balance algorithm configuration
@@ -37,6 +38,7 @@ rules:
<data_source_name> (+): # Logic data source name of readwrite-splitting
dynamic_strategy: # Readwrite-splitting type
auto_aware_data_source_name: # Database discovery logic data source name
+ transactionalReadQueryStrategy (?): # Routing strategy for read query within a transaction, values include: FIXED_PRIMARY (to primary), FIXED_REPLICA (to fixed data source), DYNAMIC_REPLICA (to any data source), default value: DYNAMIC_REPLICA
loadBalancerName: # Load balance algorithm name
# Load balance algorithm configuration
@@ -66,6 +68,7 @@ rules:
readDataSourceNames:
- read_ds_0
- read_ds_1
+ transactionalReadQueryStrategy: FIXED_PRIMARY
loadBalancerName: random
loadBalancers:
random: