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/11/17 07:43:36 UTC

[GitHub] [shardingsphere] happy89lgk opened a new issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

happy89lgk opened a new issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   ### Which version of ShardingSphere did you use?
   4.0.0-RC2   Upgrade to  5.0.0
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
    entry doSharding method ,  Insert into the correct table (2021_sys_login_log)
   ### Actual behavior
   No entry doSharding method , Insert into wrong table (sys_login_log)
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   4.0.0-RC2  
   ![image](https://user-images.githubusercontent.com/34465209/142156677-7c8754c0-9d6e-4fe2-ace8-a727d984f8a4.png)
   ![image](https://user-images.githubusercontent.com/34465209/142156759-6be91020-bf15-4e40-ab2e-06d10ee42141.png)
   
   5.0.0
   ![image](https://user-images.githubusercontent.com/34465209/142157014-7950c9d0-6e66-4ab4-b9e2-9455532f1e4e.png)
   ![image](https://user-images.githubusercontent.com/34465209/142157108-3f59c1e5-061d-45f1-97d8-6f2193961232.png)
   
   ### Example codes for reproduce this issue (such as a github link).
   


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



[GitHub] [shardingsphere] happy89lgk edited a comment on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk edited a comment on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972671554


   Because some tables may not be created, they will be created when necessary. For example, the table I inserted in 2021 enters the dosharding method of the standardshardingalgorithm and obtains 2021_ sys_ login_ Log, but why query other years_sys_ login_ log.
   Is this the reason for Seata or sharding?


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



[GitHub] [shardingsphere] HCTzz commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
HCTzz commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-980054009


   @happy89lgk do you solve this error ? (get table meta error )


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



[GitHub] [shardingsphere] menghaoranss commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
menghaoranss commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972661278


   It seems seata report the exception, but you may be need to confirm the table is created dynamically through ShardingSphere


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



[GitHub] [shardingsphere] happy89lgk commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972673048


   Is this the reason for Seata or sharding?


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



[GitHub] [shardingsphere] happy89lgk commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972671554


   Because some tables may not be created, they will be created when necessary. For example, the table I inserted in 2021 enters the dosharding method of the standardshardingalgorithm and obtains 2021_ sys_ login_ Log, but why query sys of other years_ login_ log


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



[GitHub] [shardingsphere] happy89lgk commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-981417247


   @HCTzz There is no time to deal with 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



[GitHub] [shardingsphere] happy89lgk commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972637274


   the config is ok,entry doSharding method 。
   but
   my project Dynamic table creation,Create a table when me need it ,
   now insert 2021_sys_login_log,the table is created,but the log is printed as follows
   ![image](https://user-images.githubusercontent.com/34465209/142378021-5c29401f-2926-4ec5-bbe2-2ac234ef79ae.png)
   Because those tables have not been created (according to other business),so report errors:
   2021-11-18 16:20:40 [http-nio-9202-exec-4] ERROR io.seata.rm.datasource.sql.struct.cache.AbstractTableMetaCache - get table meta of the table `sys_login_log` error: Table 'financialcloud-tool.2000_sys_login_log' doesn't exist
   java.sql.SQLSyntaxErrorException: Table 'financialcloud-tool.2000_sys_login_log' doesn't exist
   	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
   	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
   	at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1202)
   	at com.alibaba.druid.pool.DruidPooledStatement.executeQuery(DruidPooledStatement.java:296)
   	at org.apache.shardingsphere.driver.executor.callback.impl.StatementExecuteQueryCallback.executeQuery(StatementExecuteQueryCallback.java:39)
   	at org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback.executeSQL(ExecuteQueryCallback.java:44)
   	at org.apache.shardingsphere.driver.executor.callback.ExecuteQueryCallback.executeSQL(ExecuteQueryCallback.java:36)
   	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
   	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:101)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.serialExecute(ExecutorEngine.java:87)
   	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:81)
   	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:65)
   	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:49)
   	at org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.executeQuery(DriverJDBCExecutor.java:73)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeQuery0(ShardingSphereStatement.java:163)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeQuery(ShardingSphereStatement.java:136)
   	at io.seata.rm.datasource.sql.struct.cache.MysqlTableMetaCache.fetchSchema(MysqlTableMetaCache.java:81)
   	at io.seata.rm.datasource.sql.struct.cache.AbstractTableMetaCache.lambda$getTableMeta$0(AbstractTableMetaCache.java:61)
   	at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2413)
   	at java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853)
   	at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2411)
   	at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2394)
   	at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:108)
   	at com.github.benmanes.caffeine.cache.LocalManualCache.get(LocalManualCache.java:62)
   	at io.seata.rm.datasource.sql.struct.cache.AbstractTableMetaCache.getTableMeta(AbstractTableMetaCache.java:59)
   	at io.seata.rm.datasource.exec.BaseTransactionalExecutor.getTableMeta(BaseTransactionalExecutor.java:215)
   	at io.seata.rm.datasource.exec.BaseTransactionalExecutor.getTableMeta(BaseTransactionalExecutor.java:200)
   	at io.seata.rm.datasource.exec.BaseInsertExecutor.beforeImage(BaseInsertExecutor.java:71)
   	at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.executeAutoCommitFalse(AbstractDMLBaseExecutor.java:99)
   	at io.seata.rm.datasource.exec.AbstractDMLBaseExecutor.doExecute(AbstractDMLBaseExecutor.java:84)
   	at io.seata.rm.datasource.exec.BaseTransactionalExecutor.execute(BaseTransactionalExecutor.java:113)
   	at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:111)
   	at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:50)
   	at io.seata.rm.datasource.PreparedStatementProxy.executeUpdate(PreparedStatementProxy.java:65)
   	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
   	at org.hibernate.dialect.identity.GetGeneratedKeysDelegate.executeAndExtract(GetGeneratedKeysDelegate.java:57)
   	at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:43)
   	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3196)
   	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3802)
   	at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:84)
   	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:645)
   	at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:282)
   	at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:263)
   	at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:317)
   	at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:330)
   	at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
   	at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193)
   	at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:123)
   	at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:185)
   	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:128)
   	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:55)
   	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:99)
   	at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:720)
   	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:706)
   	at sun.reflect.GeneratedMethodAccessor220.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:362)
   	at com.sun.proxy.$Proxy302.persist(Unknown Source)
   	at sun.reflect.GeneratedMethodAccessor220.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:311)
   	at com.sun.proxy.$Proxy302.persist(Unknown Source)
   	at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:597)
   	at sun.reflect.GeneratedMethodAccessor225.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289)
   	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
   	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
   	at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:529)
   	at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)
   	at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:599)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:163)
   	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
   	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
   	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
   	at com.sun.proxy.$Proxy311.save(Unknown Source)


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



[GitHub] [shardingsphere] happy89lgk commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972639133


   My project is integrated Seata 1.4.2


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



[GitHub] [shardingsphere] menghaoranss edited a comment on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
menghaoranss edited a comment on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972661278


   It seems seata report the exception, but you may need to confirm the table is created dynamically through ShardingSphere


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



[GitHub] [shardingsphere] happy89lgk removed a comment on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk removed a comment on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972673048


   Is this the reason for Seata or sharding?


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



[GitHub] [shardingsphere] happy89lgk commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
happy89lgk commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-972435459


   i will try 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



[GitHub] [shardingsphere] menghaoranss commented on issue #13658: implements StandardShardingAlgorithm doSharding doesn't work

Posted by GitBox <gi...@apache.org>.
menghaoranss commented on issue #13658:
URL: https://github.com/apache/shardingsphere/issues/13658#issuecomment-971384304


   Please use `CLASS_BASED` type to configure custom sharding algorithm in 5.0.0 version:
   ```
   rules:
   - !SHARDING
     tables:
       t_order: 
         actualDataNodes: ds_${0..1}.t_order
         keyGenerateStrategy:
           column: order_id
           keyGeneratorName: snowflake
       t_order_item:
         actualDataNodes: ds_${0..1}.t_order_item
         keyGenerateStrategy:
           column: order_item_id
           keyGeneratorName: snowflake
     bindingTables:
       - t_order,t_order_item
     broadcastTables:
       - t_address
     defaultDatabaseStrategy:
       standard:
         shardingColumn: user_id
         shardingAlgorithmName: database_classbased
     defaultTableStrategy:
       none:
     
     shardingAlgorithms:
       database_classbased:
         type: CLASS_BASED
         props:
           strategy: standard
           algorithmClassName: org.apache.shardingsphere.example.extension.sharding.algortihm.classbased.fixture.ClassBasedStandardShardingAlgorithmFixture
       
   ```


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