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/22 09:31:11 UTC

[GitHub] [shardingsphere] zjcnb opened a new pull request, #18517: Add show result write_data_source_query_enable for show readwrite_splitting rules

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

   Fixes #18473 
   


-- 
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 closed pull request #18517: Add show result write_data_source_query_enable for show readwrite_splitting rules

Posted by GitBox <gi...@apache.org>.
zjcnb closed pull request #18517: Add show result write_data_source_query_enable for show readwrite_splitting rules
URL: https://github.com/apache/shardingsphere/pull/18517


-- 
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 a diff in pull request #18517: Add show result write_data_source_query_enable for show readwrite_splitting rules

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


##########
docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/readwrite-splitting.en.md:
##########
@@ -11,46 +11,36 @@ SHOW READWRITE_SPLITTING RULES [FROM databaseName]
 
 ## Return Value Description
 
-| Column                      | Description                          |
-| --------------------------- | ------------------------------------ |
-| name                        | Rule name                            |
-| auto_aware_data_source_name | Auto-Aware discovery data source name (Display configuration dynamic readwrite splitting rules) |
-| write_data_source_name      | Write data source name                |
-| read_data_source_names      | Read data source name list            |
-| load_balancer_type          | Load balance algorithm type           |
-| load_balancer_props         | Load balance algorithm parameter      |
+| Column                          | Description                          |
+| ------------------------------- | ------------------------------------ |
+| name                            | Rule name                            |
+| auto_aware_data_source_name     | Auto-Aware discovery data source name (Display configuration dynamic readwrite splitting rules) |
+| write_data_source_query_enabled | all replicas offline, primary data source whether provide query (Display configuration dynamic readwrite splitting rules)|
+| write_data_source_name          | Write data source name                |
+| read_data_source_names          | Read data source name list            |
+| load_balancer_type              | Load balance algorithm type           |
+| load_balancer_props             | Load balance algorithm parameter      |
 
 ## Example
 
 *Static Readwrite Splitting Rules*
 ```sql
 mysql> show readwrite_splitting rules;
-+------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
-| name       | auto_aware_data_source_name | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
-+------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
-| ms_group_0 |                             | ds_primary             | ds_slave_0, ds_slave_1 | random             |                     |
-+------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
-1 row in set (0.00 sec)
-```
-
-*Dynamic Readwrite Splitting Rules*
-```sql
-mysql> show readwrite_splitting rules from readwrite_splitting_db;
-+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
-| name         | auto_aware_data_source_name | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
-+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
-| readwrite_ds | ms_group_0                  |                        |                        | random             | read_weight=2:1     |
-+-------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
++--------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+
+| name         | auto_aware_data_source_name | write_data_source_query_enabled | write_data_source_name | read_data_source_names | load_balancer_type | 
++--------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+
+| ms_group_0   |                             |                                 | ds_primary             | ds_slave_0,ds_slave_1  | RANDOM             |
++--------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+
 1 row in set (0.01 sec)
 ```
 
-*Static Readwrite Splitting Rules And Dynamic Readwrite Splitting Rules*
+*Dynamic Readwrite Splitting Rules*
 ```sql
 mysql> show readwrite_splitting rules from readwrite_splitting_db;
-+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
-| name         | auto_aware_data_source_name | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
-+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
-| readwrite_ds | ms_group_0                  | write_ds               | read_ds_0, read_ds_1   | random             | read_weight=2:1     |
-+-------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
++----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
+| name           | auto_aware_data_source_name | write_data_source_query_enabled | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
++----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
+| readwrite_ds   | ms_group_0                  | true                            | ds_primary             | ds_slave_0,ds_slave_1  |  random            | read_weight=2:1     |

Review Comment:
   Hi @zjcnb , the random load balancer dose not need props.



-- 
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 a diff in pull request #18517: Add show result write_data_source_query_enable for show readwrite_splitting rules

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


##########
shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingRuleQueryResultSet.java:
##########
@@ -82,6 +82,7 @@ private Collection<Object> buildDataItem(final ReadwriteSplittingDataSourceRuleC
         Optional<ShardingSphereAlgorithmConfiguration> loadBalancer = Optional.ofNullable(loadBalancers.get(dataSourceRuleConfig.getLoadBalancerName()));
         return Arrays.asList(name,
                 dataSourceRuleConfig.getAutoAwareDataSourceName().orElse(""),
+                DYNAMIC.equalsIgnoreCase(dataSourceRuleConfig.getType()) ? dataSourceRuleConfig.getWriteDataSourceQueryEnabled().orElse("") : "",

Review Comment:
   Dose the result of `dataSourceRuleConfig.getWriteDataSourceQueryEnabled()` have a default boolean value?



-- 
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 pull request #18517: Add show result write_data_source_query_enable for show readwrite_splitting rules

Posted by GitBox <gi...@apache.org>.
zjcnb commented on PR #18517:
URL: https://github.com/apache/shardingsphere/pull/18517#issuecomment-1162881181

   `Dynamic readwrite-splitting :`
   
   ```
   mysql> show readwrite_splitting rules;
   +----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   | name           | auto_aware_data_source_name | write-data-source-query-enabled | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
   +----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   | replication_ds | readwrite_ds                | false                           | ds_1                   | ds_0,ds_2              |                    |                     |
   +----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   1 row in set (0.00 sec)
   
   mysql> show readwrite_splitting rules;
   +----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   | name           | auto_aware_data_source_name | write-data-source-query-enabled | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
   +----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   | replication_ds | readwrite_ds                | true                            | ds_1                   | ds_0,ds_2              |                    |                     |
   +----------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   1 row in set (0.01 sec)
   ```
   
   `Static readwrite-splitting :` 
   
   ```
   mysql> show readwrite_splitting rules;
   +--------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   | name         | auto_aware_data_source_name | write-data-source-query-enabled | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
   +--------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   | readwrite_ds |                             |                                 | write_ds               | read_ds_0,read_ds_1    | RANDOM             |                     |
   +--------------+-----------------------------+---------------------------------+------------------------+------------------------+--------------------+---------------------+
   1 row in set (0.01 sec)
   ```


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