ziliangzeng opened a new issue #13253:
URL: https://github.com/apache/shardingsphere/issues/13253


   ## Bug Report
   Use the proxy example to test and find that the jdbc can be sharded 
normally, but the proxy does appear to be only sharded to the last database 
configured. 
   Is my configuration file wrong? I copied it directly from the previous 
successful jdbc yaml configuration
   ### Which version of ShardingSphere did you use?
   5.0.0-beta
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   Insert data should go to ds0
   
   ### Actual behavior
   Insert data go to ds0
   
   ### Reason analyze (If you can)
   I think it is the problem of my configuration file settings, but I copied it 
directly from the yaml configuration of the previous successful jdbc example
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   **server.yaml:**
   `rules:
    - !AUTHORITY
      users:
        - root@%:root
        - sharding@:sharding
      provider:
        type: NATIVE
   
   props:
    max-connections-size-per-query: 1
    executor-size: 16  # Infinite by default.
    proxy-frontend-flush-threshold: 128  # The default value is 128.
      # LOCAL: Proxy will run with LOCAL transaction.
      # XA: Proxy will run with XA transaction.
      # BASE: Proxy will run with B.A.S.E transaction.
    proxy-transaction-type: LOCAL
    xa-transaction-manager-type: Atomikos
    proxy-opentracing-enabled: false
    proxy-hint-enabled: false
    sql-show: true
    check-table-metadata-enabled: false
    lock-wait-timeout-milliseconds: 50000 # The maximum time to wait for a lock`
   
   **config-sharding.yaml**
   `schemaName: sharding_db
   
   dataSources:
     ds_0:
       url: jdbc:mysql://127.0.0.1:3306/ds0?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
       maintenanceIntervalMilliseconds: 30000
     ds_1:
       url: jdbc:mysql://127.0.0.1:3306/ds1?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
       maintenanceIntervalMilliseconds: 30000
   
   rules:
     - !SHARDING
       # tables:
       #   t_order:
       #     actualDataNodes: ds_${0..1}.t_order${1..2}
       #     keyGenerateStrategy:
       #       column: id
       #       keyGeneratorName: snowflake
       broadcastTables:
         - t_order1
       
       defaultDatabaseStrategy:
         standard:
           shardingColumn: order_id
           shardingAlgorithmName: database_inline
       defaultTableStrategy:
         none:
   
       shardingAlgorithms:
         database_inline:
           type: INLINE
           props:
             algorithm-expression: ds_${order_id % 2}
   
       # keyGenerators:
       #   snowflake:
       #     type: SNOWFLAKE
       #     props:
       #       worker-id: 123`
   
   **create table** 
   `
   SET NAMES utf8mb4;
   SET FOREIGN_KEY_CHECKS = 0;
   
   -- ----------------------------
   -- Table structure for t_order1
   -- ----------------------------
   DROP TABLE IF EXISTS `t_order1`;
   CREATE TABLE `t_order1`  (
     `id` int(0) NOT NULL AUTO_INCREMENT,
     `user_id` int(0) NULL DEFAULT NULL,
     `order_id` int(0) NULL DEFAULT NULL,
     `cloumn` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL 
DEFAULT NULL,
     PRIMARY KEY (`id`) USING BTREE
   ) ENGINE = InnoDB AUTO_INCREMENT = 1233452 CHARACTER SET = utf8mb4 COLLATE = 
utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
   
   -- ----------------------------
   -- Table structure for t_order2
   -- ----------------------------
   DROP TABLE IF EXISTS `t_order2`;
   CREATE TABLE `t_order2`  (
     `id` int(0) NOT NULL AUTO_INCREMENT,
     `user_id` int(0) NULL DEFAULT NULL,
     `order_id` int(0) NULL DEFAULT NULL,
     `cloumn` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL 
DEFAULT NULL,
     PRIMARY KEY (`id`) USING BTREE
   ) ENGINE = InnoDB AUTO_INCREMENT = 1227 CHARACTER SET = utf8mb4 COLLATE = 
utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
   
   SET FOREIGN_KEY_CHECKS = 1;
   
   -- ----------------------------
   -- Table structure for t_order1
   -- ----------------------------
   DROP TABLE IF EXISTS `t_order1`;
   CREATE TABLE `t_order1`  (
     `id` int(0) NOT NULL AUTO_INCREMENT,
     `user_id` int(0) NULL DEFAULT NULL,
     `order_id` int(0) NULL DEFAULT NULL,
     `cloumn` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL 
DEFAULT NULL,
     PRIMARY KEY (`id`) USING BTREE
   ) ENGINE = InnoDB AUTO_INCREMENT = 1233452 CHARACTER SET = utf8mb4 COLLATE = 
utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
   
   -- ----------------------------
   -- Table structure for t_order2
   -- ----------------------------
   DROP TABLE IF EXISTS `t_order2`;
   CREATE TABLE `t_order2`  (
     `id` int(0) NOT NULL AUTO_INCREMENT,
     `user_id` int(0) NULL DEFAULT NULL,
     `order_id` int(0) NULL DEFAULT NULL,
     `cloumn` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL 
DEFAULT NULL,
     PRIMARY KEY (`id`) USING BTREE
   ) ENGINE = InnoDB AUTO_INCREMENT = 123 CHARACTER SET = utf8mb4 COLLATE = 
utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
   `
   **test insert code**
   `INSERT INTO t_order2(id,user_id,order_id,cloumn) VALUES 
('10','10','10','分片表,应该在ds0')`
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to