You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "zxh-im (via GitHub)" <gi...@apache.org> on 2024/11/18 09:37:16 UTC
[I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
zxh-im opened a new issue, #33709:
URL: https://github.com/apache/shardingsphere/issues/33709
The SINGLE table is normal, while the SHARDING table reports an error
**version:**shardingsphere-jdbc 5.5.1
**my yml:**
`dataSources:
db0:
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.39:3306/ry
username: root
password: 123456
rules:
- !SINGLE
tables:
- "*.*"
- !SHARDING
tables:
order_details:
actualDataNodes: db0.order_details_$->{com.hehui.system.config.sharding.YearMonthShardingAlgorithm.list()}
tableStrategy:
standard:
shardingColumn: createTime
shardingAlgorithmName: test1
shardingAlgorithms:
test1:
type: CLASS_BASED
props:
strategy: standard
algorithmClassName: com.hehui.system.config.sharding.OrderDetailsShardingAlgorithm
props:
sql-show: true
`
**createDataSource:**
` @Bean
public DataSource masterDataSource(DruidProperties druidProperties) throws SQLException, IOException {
DataSource dataSource =YamlShardingSphereDataSourceFactory.createDataSource(ShardingConfig.getShardingYAMLFile());
return dataSource;
}
@Bean
@ConfigurationProperties("spring.datasource.druid.slave")
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
public DataSource slaveDataSource(DruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean(name = "dynamicDataSource")
@Primary
public DynamicDataSource dataSource(DataSource masterDataSource)
{
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
return new DynamicDataSource(masterDataSource, targetDataSources);`
**this is the stacktrace:**
Caused by: org.apache.ibatis.executor.ExecutorException: Error preparing statement. Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'order_details' does not exist.
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:97)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59)
at org.apache.ibatis.executor.ReuseExecutor.prepareStatement(ReuseExecutor.java:89)
at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:51)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy478.update(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
... 167 common frames omitted
Caused by: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'order_details' does not exist.
at org.apache.shardingsphere.infra.binder.engine.segment.from.type.SimpleTableSegmentBinder.lambda$checkTableExists$3(SimpleTableSegmentBinder.java:130)
at org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:44)
at org.apache.shardingsphere.infra.binder.engine.segment.from.type.SimpleTableSegmentBinder.checkTableExists(SimpleTableSegmentBinder.java:127)
at org.apache.shardingsphere.infra.binder.engine.segment.from.type.SimpleTableSegmentBinder.bind(SimpleTableSegmentBinder.java:84)
at org.apache.shardingsphere.infra.binder.engine.statement.dml.InsertStatementBinder.lambda$bind$0(InsertStatementBinder.java:46)
at java.util.Optional.ifPresent(Optional.java:159)
at org.apache.shardingsphere.infra.binder.engine.statement.dml.InsertStatementBinder.bind(InsertStatementBinder.java:46)
at org.apache.shardingsphere.infra.binder.engine.type.DMLStatementBindEngine.bind(DMLStatementBindEngine.java:55)
at org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bindSQLStatement(SQLBindEngine.java:63)
at org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:53)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:146)
at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:126)
at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:55)
at com.sun.proxy.$Proxy128.prepareStatement(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:81)
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
... 185 common frames omitted
--
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
Re: [I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
Posted by "zxh-im (via GitHub)" <gi...@apache.org>.
zxh-im commented on issue #33709:
URL: https://github.com/apache/shardingsphere/issues/33709#issuecomment-2487565697
> The markdown format in your issue is incorrect. To facilitate reading, could you please revise it?
I've already revised the Markdown format in my issue.
--
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
Re: [I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #33709:
URL: https://github.com/apache/shardingsphere/issues/33709#issuecomment-2487775709
The issue involves other third-party dependencies, but our focus is solely on ShardingSphere itself. Since ShardingSphere implements the JDBC interface, standard applications should be functional. We wish to allocate more effort towards enhancing the current version, and therefore will no longer handle such issues. Please read the documentation or provide more effective information when submitting an issue.
--
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
Re: [I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #33709:
URL: https://github.com/apache/shardingsphere/issues/33709#issuecomment-2487415039
The markdown format in your issue is incorrect. To facilitate reading, could you please revise it?
--
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
Re: [I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #33709: -! SHARDING table error Table or view 'order_details' does not exist
URL: https://github.com/apache/shardingsphere/issues/33709
--
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
Re: [I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #33709:
URL: https://github.com/apache/shardingsphere/issues/33709#issuecomment-2506712119
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
--
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
Re: [I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
Posted by "zxh-im (via GitHub)" <gi...@apache.org>.
zxh-im commented on issue #33709:
URL: https://github.com/apache/shardingsphere/issues/33709#issuecomment-2489872484
> The issue involves other third-party dependencies, but our focus is solely on ShardingSphere itself. Since ShardingSphere implements the JDBC interface, standard applications should be functional. We wish to allocate more effort towards enhancing the current version, and therefore will no longer handle such issues. Please read the documentation or provide more effective information when submitting an issue.
I see the error occurs in the SimpleTableSegmentBinder.checkTableExists method. The binderContext.getMetaData().getDatabase(databaseName).getSchema(schemaName).containsTable(tableName) method does not contain the current shard table. I debugged and found that this data should only have a single table. Can you tell me what to check?
--
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
Re: [I] -! SHARDING table error Table or view 'order_details' does not exist [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #33709:
URL: https://github.com/apache/shardingsphere/issues/33709#issuecomment-2489942160
The best way is to provide an operation that can be reproduced, such as executing reproducible SQL through JDBC or Proxy.
--
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