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 2021/09/26 09:41:49 UTC

[GitHub] [shardingsphere] 15898317421 edited a comment on issue #9896: Combine use sharding rule and shadow rule, but shadow rule config does not load.

15898317421 edited a comment on issue #9896:
URL: https://github.com/apache/shardingsphere/issues/9896#issuecomment-812342731


   > @15898317421 Hi, can you test it with the newest code, the `master` branch?
   
   I try it again with version 5.0.0-alpha, but it still wrong output.
   
   ```
   
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #     http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   #
   
   schemaName: demo
   
   dataSourceCommon:
     username: root
     password: 123456
   #  connectionTimeoutMilliseconds: 30000
   #  idleTimeoutMilliseconds: 60000
   #  maxLifetimeMilliseconds: 1800000
     maxPoolSize: 50
   #  minPoolSize: 1
   #  maintenanceIntervalMilliseconds: 30000
   
   dataSources:
     ds0:
       url: jdbc:mysql://localhost:3316/demo0?serverTimezone=UTC&useSSL=false
     ds1:
       url: jdbc:mysql://localhost:3316/demo1?serverTimezone=UTC&useSSL=false
   
   rules:
   - !SHARDING
     tables:
       demo_one:
         actualDataNodes: ds${0}.demo_one_${0..1}
         tableStrategy:
           standard:
             shardingColumn: sharding_id
             shardingAlgorithmName: demo_one_inline
         keyGenerateStrategy:
           column: sharding_id
           keyGeneratorName: snowflake
     defaultTableStrategy:
       none:
     shardingAlgorithms:
       demo_one_inline:
         type: INLINE
         props:
           algorithm-expression: demo_one_${sharding_id % 2}
     keyGenerators:
       snowflake:
         type: SNOWFLAKE
         props:
           worker-id: 123
   - !SHADOW
     column: shadow
     sourceDataSourceNames:
      - ds0
     shadowDataSourceNames:
      - ds1
   
   [INFO ] 14:09:33.662 [ShardingSphere-Command-3] ShardingSphere-SQL - Logic SQL: insert into demo_one(name, age, shadow) values ("insert", 18, true)
   [INFO ] 14:09:33.665 [ShardingSphere-Command-3] ShardingSphere-SQL - SQLStatement: MySQLInsertStatement(setAssignment=Optional.empty, onDuplicateKeyColumns=Optional.empty)
   [INFO ] 14:09:33.665 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ds0 ::: insert into demo_one_1(name, age, sharding_id) values ('insert', 18, 584745426205782017)
   
   [INFO ] 14:09:03.662 [ShardingSphere-Command-5] ShardingSphere-SQL - Logic SQL: insert into demo_one(name, age) values ("insert", 18)
   [INFO ] 14:09:03.662 [ShardingSphere-Command-5] ShardingSphere-SQL - SQLStatement: MySQLInsertStatement(setAssignment=Optional.empty, onDuplicateKeyColumns=Optional.empty)
   [INFO ] 14:09:03.662 [ShardingSphere-Command-5] ShardingSphere-SQL - Actual SQL: ds0 ::: insert into demo_one_0(name, age, sharding_id) values ('insert', 18, 584745299378417664)
   ```


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