Closed duzhanfei closed 3 years ago
What is your problem, did you meet exception?
Yes, the probles is show in issues 8303. Thank you for your time.
https://github.com/apache/shardingsphere/issues/8303
At 2020-11-24 19:19:05, "Liang Zhang" notifications@github.com wrote:
What is your problem, did you meet exception?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
I wonder whether I made a mistake in configuration, so I mentioned this issue
I only test the data sharding ,the result is the same
the config of config-sharding.yaml is show below:
schemaName: sharding_db
dataSourceCommon: connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1 maintenanceIntervalMilliseconds: 30000
dataSources: ms_ds: url: jdbc:mysql://19.11.17.33:3306/crm_customer_db_master0?serverTimezone=UTC&useSSL=false username: root password: root
rules:
!SHARDING tables: bcpur_pscst_deptp_stats: actualDataNodes: ms_ds.bcpur_pscst_deptpstats${0..15} tableStrategy: standard: shardingColumn: ecif_cust_no shardingAlgorithmName: bcpur_pscst_deptp_stats_inline keyGenerateStrategy: column: ecif_cust_no keyGeneratorName: snowflake
defaultDatabaseStrategy: standard: shardingColumn: ecif_cust_no shardingAlgorithmName: database_default_inline defaultTableStrategy: none:
shardingAlgorithms: database_default_inline: type: INLINE props: algorithm-expression: ms_ds database_inline: type: INLINE props: algorithm-expression: ms_ds bcpur_pscst_deptp_stats_inline: type: INLINE props: algorithm-expression: bcpur_pscst_deptpstats${Math.abs(ecif_cust_no.hashCode() % 16)}
keyGenerators: snowflake: type: SNOWFLAKE props: worker-id: 123
request infomation:
log:
[INFO ] 20:48:16.658 [ShardingSphere-Command-3] ShardingSphere-SQL - Logic SQL: SELECT @@session.transaction_read_only [INFO ] 20:48:16.658 [ShardingSphere-Command-3] ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(limit=Optional.empty, lock=Optional.empty) [INFO ] 20:48:16.661 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ms_ds ::: SELECT @@session.transaction_read_only [INFO ] 20:48:16.681 [ShardingSphere-Command-4] ShardingSphere-SQL - Logic SQL: SELECT @@session.transaction_isolation [INFO ] 20:48:16.685 [ShardingSphere-Command-4] ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(limit=Optional.empty, lock=Optional.empty) [INFO ] 20:48:16.685 [ShardingSphere-Command-4] ShardingSphere-SQL - Actual SQL: ms_ds ::: SELECT @@session.transaction_isolation [ERROR] 20:48:17.175 [ShardingSphere-Command-5] o.a.s.p.f.c.CommandExecutorTask - Exception occur: java.lang.NullPointerException: Cannot invoke method hashCode() on null object at org.codehaus.groovy.runtime.NullObject.hashCode(NullObject.java:174) at org.codehaus.groovy.runtime.NullObject$hashCode.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at Script24$_run_closure1.doCall(Script24.groovy:1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034) at groovy.lang.Closure.call(Closure.java:420) at groovy.lang.Closure.call(Closure.java:414) at org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm.doSharding(InlineShardingAlgorithm.java:69) at org.apache.shardingsphere.sharding.route.strategy.type.standard.StandardShardingStrategy.doSharding(StandardShardingStrategy.java:67) at org.apache.shardingsphere.sharding.route.strategy.type.standard.StandardShardingStrategy.doSharding(StandardShardingStrategy.java:56) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeTables(ShardingStandardRoutingEngine.java:214) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route0(ShardingStandardRoutingEngine.java:194) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditionsWithCondition(ShardingStandardRoutingEngine.java:114) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditions(ShardingStandardRoutingEngine.java:107) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.getDataNodes(ShardingStandardRoutingEngine.java:84) at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route(ShardingStandardRoutingEngine.java:69) at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:70) at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:55) at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:59) at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:57) at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:52) at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:77) at org.apache.shardingsphere.proxy.backend.text.query.QueryBackendHandler.execute(QueryBackendHandler.java:61) at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:62) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:100) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:76) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
I suspect that My configuration is wrong, because this is the basic function, but I do not know what is wrong.
The exception is show you clearly:
Exception occur:
java.lang.NullPointerException: Cannot invoke method hashCode() on null object
at org.codehaus.groovy.runtime.NullObject.hashCode(NullObject.java:174)
It says you are calling hashCode in groovy (inline expression) and throw NullPointException. Even you said the value is not null, but the exception show the value is null.
I can insert data into the sub-table, this error occued when query by the sharding key has exist
what is your insert SQL?
insert sql :
Ok, it looks like metadata not load. I just fix an issue about this, could you use the newest dev version and try it again?
No response anymore
insert sql :
INSERT INTO pscst_prdt_cvr BIZ_DT, ECIF_CUST_NO, DEP_FLG, DBTCD_FLG, PLM_PY_FLG, PY_GTWY_FLG, SFSRV_EQP_SGNG_FLG, ATMBL_MRTG_FLG, HS_MRTG_FLG, HLPFM_ETMN_FLG, PSNL_MANG_LN_FLG, PSNL_CNSM_LN_FLG, ETC_FLG, CSCRD_FLG, MBLBNK_FLG, EBP_SGNG_FLG, params:
proxy log:
这个问题咋样了0.0
config in config-replica-query.yaml
schemaName: replica_query_db
dataSourceCommon: connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1 maintenanceIntervalMilliseconds: 30000
dataSources: primary_ds: url: jdbc:mysql://127.5.2.31:3306/crm_customer_db_master0?serverTimezone=UTC&useSSL=false username: root password: root replica_ds_0: url: jdbc:mysql://127.5.2.32:3306/crm_customer_db_master0_slave0?serverTimezone=UTC&useSSL=false username: root password: root replica_ds_1: url: jdbc:mysql://127.5.2.33:3306/crm_customer_db_master0_slave1?serverTimezone=UTC&useSSL=false username: root password: root ds_default: url: jdbc:mysql://127.5.2.34:3306/cdsp_crm_db?serverTimezone=UTC&useSSL=false username: root password: root
rules:
!SHARDING tables: pbcst_qry_info: actualDataNodes: ms_ds.pbcst_qryinfo${0..15} tableStrategy: standard: shardingColumn: ecif_cust_no shardingAlgorithmName: pbcst_qry_info_inline databaseStrategy: standard: shardingColumn: ecif_cust_no shardingAlgorithmName: database_inline keyGenerateStrategy: column: ecif_cust_no keyGeneratorName: snowflake
defaultDatabaseStrategy: standard: shardingColumn: ecif_cust_no shardingAlgorithmName: ds_default defaultTableStrategy: none:
shardingAlgorithms: database_default_inline: type: INLINE props: algorithm-expression: ms_ds database_inline: type: INLINE props: algorithm-expression: ms_ds pbcst_qry_info_inline: type: INLINE props: algorithm-expression: pbcst_qryinfo${Math.abs(ecif_cust_no.hashCode() % 16)}
keyGenerators: snowflake: type: SNOWFLAKE props: worker-id: 123
!REPLICA_QUERY dataSources: ms_ds: name: ms_ds primaryDataSourceName: primary_ds replicaDataSourceNames: