You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Pace2Car (via GitHub)" <gi...@apache.org> on 2023/05/17 12:52:28 UTC

[GitHub] [shardingsphere] Pace2Car opened a new pull request, #25743: Rebuild TransactionRuleConfiguration when set dist variable transaction_type

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

   Changes proposed in this pull request:
     - Rebuild TransactionRuleConfiguration when set dist variable transaction_type
     - Update related test cases
   
   ---
   
   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.
   - [x] 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] Pace2Car commented on a diff in pull request #25743: Rebuild TransactionRuleConfiguration when set dist variable transaction_type

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


##########
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdater.java:
##########
@@ -122,12 +126,18 @@ private void syncSQLSimpleToLoggingRule(final TypedPropertyKey propertyKey, fina
     
     private void handleVariables(final ConnectionSession connectionSession, final SetDistVariableStatement sqlStatement) {
         VariableEnum variable = VariableEnum.getValueOf(sqlStatement.getName());
-        switch (variable) {
-            case TRANSACTION_TYPE:
-                connectionSession.getTransactionStatus().setTransactionType(getTransactionType(sqlStatement.getValue()));
-                break;
-            default:
-                throw new UnsupportedVariableException(sqlStatement.getName());
+        if (variable == VariableEnum.TRANSACTION_TYPE) {
+            ContextManager contextManager = ProxyContext.getInstance().getContextManager();
+            Collection<RuleConfiguration> ruleConfigurations = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getConfigurations();

Review Comment:
   Changed, THX for point 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] zhaojinchao95 commented on a diff in pull request #25743: Rebuild TransactionRuleConfiguration when set dist variable transaction_type

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


##########
proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdater.java:
##########
@@ -122,12 +126,18 @@ private void syncSQLSimpleToLoggingRule(final TypedPropertyKey propertyKey, fina
     
     private void handleVariables(final ConnectionSession connectionSession, final SetDistVariableStatement sqlStatement) {
         VariableEnum variable = VariableEnum.getValueOf(sqlStatement.getName());
-        switch (variable) {
-            case TRANSACTION_TYPE:
-                connectionSession.getTransactionStatus().setTransactionType(getTransactionType(sqlStatement.getValue()));
-                break;
-            default:
-                throw new UnsupportedVariableException(sqlStatement.getName());
+        if (variable == VariableEnum.TRANSACTION_TYPE) {
+            ContextManager contextManager = ProxyContext.getInstance().getContextManager();
+            Collection<RuleConfiguration> ruleConfigurations = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getConfigurations();

Review Comment:
   Change `ruleConfigurations` to `ruleConfigs` are 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] Pace2Car closed pull request #25743: Rebuild TransactionRuleConfiguration when set dist variable transaction_type

Posted by "Pace2Car (via GitHub)" <gi...@apache.org>.
Pace2Car closed pull request #25743: Rebuild TransactionRuleConfiguration when set dist variable transaction_type
URL: https://github.com/apache/shardingsphere/pull/25743


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