Git Product home page Git Product logo

Comments (6)

TherChenYang avatar TherChenYang commented on June 26, 2024 1
  • When the initEnvironment() method in ShawTest is commented out, directly executing selectAll will still result in the same error. When using the shadow module, we do not restrict that table initialization must be done within ShardingSphere.
  • I think we should load the tables that have already been configured in the configuration file. See PR #31378.

from shardingsphere.

zhaojinchao95 avatar zhaojinchao95 commented on June 26, 2024 1

@bobbyz007 Hello,maybe you should add single configuration. such as:

databaseName: shadow_db

dataSources:
  ds:
    url: jdbc:mysql://127.0.0.1:3306/ds?useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_shadow:
    url: jdbc:mysql://127.0.0.1:3306/ds_shadow?useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
  - !SINGLE
    tables:
      - "*.*"
  - !SHADOW
    dataSources:
      shadowDataSource:
        productionDataSourceName: ds
        shadowDataSourceName: ds_shadow
    tables:
      t_user:
        dataSourceNames:
          - shadowDataSource
        shadowAlgorithmNames:
          - user_id_insert_match_algorithm
          - user_id_delete_match_algorithm
          - user_id_select_match_algorithm
          - sql_hint_algorithm
    shadowAlgorithms:
      user_id_insert_match_algorithm:
        type: REGEX_MATCH
        props:
          operation: insert
          column: user_type
          regex: "[1]"
      user_id_delete_match_algorithm:
        type: REGEX_MATCH
        props:
          operation: delete
          column: user_type
          regex: "[1]"
      user_id_select_match_algorithm:
        type: REGEX_MATCH
        props:
          operation: select
          column: user_type
          regex: "[1]"
      sql_hint_algorithm:
        type: SQL_HINT

from shardingsphere.

TherChenYang avatar TherChenYang commented on June 26, 2024

@bobbyz007 Thank you for your feedback, I have verified the same issue in master, and will investigate this issue and provide a response.

from shardingsphere.

linghengqian avatar linghengqian commented on June 26, 2024

from shardingsphere.

TherChenYang avatar TherChenYang commented on June 26, 2024

After verification, the issue can be resolved by adding the following configuration. I will close this issue.

  - !SINGLE
    tables:
      - "*.*"

from shardingsphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.