Comments (6)
- 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.
@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.
@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.
- I'm just providing some additional information.
- In fact, NativeTest under GraalVM Native Image reuses the example file, and nativeTest is normal. Reference https://github.com/apache/shardingsphere/blob/b3fed4cb1834ca6089c13b72db162cd0c2124f6f/test/native/src/test/resources/test-native/yaml/features/shadow.yaml .
- The relevant unit tests are located at https://github.com/apache/shardingsphere/blob/830dfc8d8e63909a59ef8b1cd45ba7bf8b1a6ef4/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/features/ShadowTest.java . You can execute this unit test manually in IntelliJ IDEA. I would say this looks like the example is not initializing part of the table accurately.
from shardingsphere.
After verification, the issue can be resolved by adding the following configuration. I will close this issue.
- !SINGLE
tables:
- "*.*"
from shardingsphere.
Related Issues (20)
- After restarting ShardingSphere-Proxy 5.5, previously created tables cannot be viewed. HOT 6
- after create database in proxy,when excute `use database`, ERROR 1049 (42000): Unknown database 'encrypt_db' HOT 3
- shardingsphere proxy execte group by sql throw exception
- 5.4.1版本使用mariadb数据库时,连接提示Can not find builder rule: `MariaDB.shardingsphere` HOT 1
- Spilt MetaDataVersion to DataSourceMetaDataVersion, TableMetaDataVersion and RuleMetaDataVersion
- File to compile error: org. Apache. Shardingsphere. Infra. Autogen. Version. ShardingSphereVersion couldn't find the problem. HOT 2
- When using the mariadb database in version 5.4.1, the connection prompt is Can not find builder rule: `MariaDB.shardingsphere` HOT 1
- Verify and support more MySQL function parsing
- Optimize the number of node record rows with JDBC repository in Standalone mode HOT 1
- How can I use multiple sharding rules for the same table? HOT 2
- which is the last release version that can be compiled with jdk8? HOT 3
- YamlReadwriteSplittingRuleConfiguration jar and soruce is diff HOT 1
- Garbage specification document HOT 1
- java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.segment.dml.column.ColumnSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.segment.dml.expr.ExpressionSegment HOT 1
- 5.4.1 delete plainColumn, how to save plain value in encrypt rule? HOT 4
- 5.4.1 start proxy failed, reported Property useServerPrepStmts does not exist on target class com.zaxxer.hikari.HikariDataSource, how to solve the problem?
- 5.4.1 start proxy failed, reported Property useServerPrepStmts does not exist on target class com.zaxxer.hikari.HikariDataSource, how to solve the problem? Does it need me to modify the source code of hikarip and recompile it? HOT 1
- NPE occurs when import metadata HOT 1
- can not get value on use ShardingSpherePreparedStament.getResultSet()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shardingsphere.