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/11/03 06:37:27 UTC

[GitHub] [shardingsphere] hza2022x opened a new issue, #21923: SHARDINGSPHERE_HINT doesn't work in mixture mode

hza2022x opened a new issue, #21923:
URL: https://github.com/apache/shardingsphere/issues/21923

   ## Bug Report
   
   
   
   Before report a bug, make sure you have:
   
   ### Which version of ShardingSphere did you use?
   5.2.1
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   route to primary nodes
   
   ### Actual behavior
   route to slave nodes 
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   sharding rule:
   databaseName: test_four
   dataSources:
     # ins0_0_db_0:  1st 0:mysql instance,2nd 0:master/slave,3rd 0:db
     ins0_0_db_0:
       url: jdbc:mysql://localhost:13306/test_four_0
       username: test
       password: 123456
     ins0_0_db_1:
       url: jdbc:mysql://localhost:13306/test_four_1
       username: test
       password: 123456
     ins1_0_db_2:
       url: jdbc:mysql://localhost:23306/test_four_2
       username: test
       password: 123456
     ins1_0_db_3:
       url: jdbc:mysql://localhost:23306/test_four_3
       username: test
       password: 123456
   
     # backup: ins
     ins0_1_db_0:
       url: jdbc:mysql://localhost:13307/test_four_0
       username: test
       password: 123456
     ins0_1_db_1:
       url: jdbc:mysql://localhost:13307/test_four_1
       username: test
       password: 123456
     ins1_1_db_2:
       url: jdbc:mysql://localhost:23307/test_four_2
       username: test
       password: 123456
     ins1_1_db_3:
       url: jdbc:mysql://localhost:23307/test_four_3
       username: test
       password: 123456
   
   #
     ins0_2_db_0:
       url: jdbc:mysql://localhost:13308/test_four_0
       username: test
       password: 123456
     ins0_2_db_1:
       url: jdbc:mysql://localhost:13308/test_four_1
       username: test
       password: 123456
     ins1_2_db_2:
       url: jdbc:mysql://localhost:23308/test_four_2
       username: test
       password: 123456
     ins1_2_db_3:
       url: jdbc:mysql://localhost:23308/test_four_3
       username: test
       password: 123456
   
   rules:
     - !SHARDING
       tables:
         test:
           actualDataNodes: replica_ds_${0..3}.test_${0..3}
           tableStrategy:
             standard:
               shardingColumn: id
               shardingAlgorithmName: table_inline
       defaultDatabaseStrategy:
         standard:
           shardingColumn: id
           shardingAlgorithmName: database_inline
   
       shardingAlgorithms:
         database_inline:
           type: INLINE
           props:
             algorithm-expression: replica_ds_${id % 4}
         table_inline:
           type: INLINE
           props:
             algorithm-expression: test_${id % 4}
   
     - !READWRITE_SPLITTING
       dataSources:
         replica_ds_0:
           dynamicStrategy:
             autoAwareDataSourceName: readwrite_ds_0
         replica_ds_1:
           dynamicStrategy:
             autoAwareDataSourceName: readwrite_ds_1
         replica_ds_2:
           dynamicStrategy:
             autoAwareDataSourceName: readwrite_ds_2
         replica_ds_3:
           dynamicStrategy:
             autoAwareDataSourceName: readwrite_ds_3
   
     - !DB_DISCOVERY
       dataSources:
         readwrite_ds_0:
           dataSourceNames:
             - ins0_0_db_0
             - ins0_1_db_0
             - ins0_2_db_0
           discoveryHeartbeatName: mbs-heartbeat
           discoveryTypeName: mbs
         readwrite_ds_1:
           dataSourceNames:
             - ins0_0_db_1
             - ins0_1_db_1
             - ins0_2_db_1
           discoveryHeartbeatName: mbs-heartbeat
           discoveryTypeName: mbs
         readwrite_ds_2:
           dataSourceNames:
             - ins1_0_db_2
             - ins1_1_db_2
             - ins1_2_db_2
           discoveryHeartbeatName: mbs-heartbeat
           discoveryTypeName: mbs
         readwrite_ds_3:
           dataSourceNames:
             - ins1_0_db_3
             - ins1_1_db_3
             - ins1_2_db_3
           discoveryHeartbeatName: mbs-heartbeat
           discoveryTypeName: mbs
   
       discoveryHeartbeats:
         mbs-heartbeat:
           props:
             keep-alive-cron: '0/59 * * * * ?'
       discoveryTypes:
         mbs:
           type: MBS
           props:
             group-name: 558edd3c-02ec-11ea-9bb3-080027e39bd2
   
   ### Example codes for reproduce this issue (such as a github link).
   
   Java SQL: connected to proxy 3307
          Connection conn = getConnection();
           Statement stmt = conn.createStatement();
           String sql = " /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test ";
           ResultSet rs = stmt.executeQuery(sql);
   
   zk status:
    ins0_0_db_0 :
   replicationDelayMilliseconds: 0
   role: primary
   status: enabled
   
    ins0_1_db_0 :
   replicationDelayMilliseconds: 0
   role: member
   status: enabled
   
    ins0_2_db_0 :
   replicationDelayMilliseconds: 0
   role: member
   status: enabled
   
   Primary selection is right,0_0_db_0,1_0_db_0....,the 2nd 0 means primary。
   
   Sharding Proxy Log:
   
   ShardingSphere-SQL - Logic SQL:  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test 
   ShardingSphere-SQL - Actual SQL: ins0_1_db_0 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_0  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_2 
   ShardingSphere-SQL - Actual SQL: ins0_2_db_0 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_1  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_3 
   ShardingSphere-SQL - Actual SQL: ins0_2_db_1 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_0  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_2 
   ShardingSphere-SQL - Actual SQL: ins0_1_db_1 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_1  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_3 
   ShardingSphere-SQL - Actual SQL: ins1_2_db_2 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_0  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_2 
   ShardingSphere-SQL - Actual SQL: ins1_1_db_2 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_1  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_3 
   ShardingSphere-SQL - Actual SQL: ins1_2_db_3 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_0  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_2 
   ShardingSphere-SQL - Actual SQL: ins1_1_db_3 :::  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_1  UNION ALL  /* SHARDINGSPHERE_HINT: WRITE_ROUTE_ONLY=true */ SELECT id, name FROM test_3 
   
   
   From the log,we can see, all sqls are routed to the memter/slave
   
   What configuaration I did  wrong? or is it a bug?
   
   
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN closed issue #21923: SHARDINGSPHERE_HINT doesn't work in mixture mode

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #21923: SHARDINGSPHERE_HINT doesn't work in mixture mode
URL: https://github.com/apache/shardingsphere/issues/21923


-- 
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] hza2022x commented on issue #21923: SHARDINGSPHERE_HINT doesn't work in mixture mode

Posted by GitBox <gi...@apache.org>.
hza2022x commented on issue #21923:
URL: https://github.com/apache/shardingsphere/issues/21923#issuecomment-1301768600

   it works by adding CommentParseEnabled: true into server.ymal 


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