Golong-me opened a new issue, #32564:
URL: https://github.com/apache/shardingsphere/issues/32564
when i use autoTables ,i evnet can't run shardingsphere
- this is my proxy config
```
rules:
- !SHARDING
autoTables:
tb_order:
actualDataSources: ds_${0..1}
shardingStrategy:
standard:
shardingColumn: id
shardingAlgorithmName: myMod
shardingAlgorithms:
myMod:
type: MOD
props:
sharding-count: 2
```
- can't start shardingsphere
```
Exception in thread "main" java.lang.NullPointerException: Cannot invoke
"Object.hashCode()" because "key" is null
at
java.base/java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
at
java.base/java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:964)
at
org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry.<init>(DatabaseTypeRegistry.java:44)
at
org.apache.shardingsphere.infra.metadata.database.schema.util.SchemaMetaDataUtils.getDefaultSchemaNameByStorageType(SchemaMetaDataUtils.java:77)
at
org.apache.shardingsphere.infra.metadata.database.schema.util.SchemaMetaDataUtils.getMetaDataLoaderMaterials(SchemaMetaDataUtils.java:70)
at
org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilder.loadSchemas(GenericSchemaBuilder.java:97)
at
org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilder.build(GenericSchemaBuilder.java:80)
at
org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilder.build(GenericSchemaBuilder.java:68)
at
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.create(ShardingSphereDatabase.java:93)
at
org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory.createGenericDatabases(ExternalMetaDataFactory.java:85)
at
org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory.create(ExternalMetaDataFactory.java:72)
at
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:98)
at
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:72)
at
org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:53)
at
org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.createContextManager(BootstrapInitializer.java:68)
at
org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:58)
at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:55)
```
- when i use this
```
rules:
- !SHARDING
tables:
tb_order:
actualDataNodes: ds_0.tb_order,ds_1.tb_order
databaseStrategy:
standard:
shardingColumn: id
shardingAlgorithmName: myInline
shardingAlgorithms:
myInline:
#指定算法的类型,这个很重要,去官方文档看
type: INLINE
props:
algorithm-expression: ds_${id % 2}
```
- it' still can't be work
```
Exception in thread "main"
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException:
Algorithm 'Object.'MOD' initialization failed, reason is: `tb_order` tables
sharding configuration can not use auto sharding algorithm..
at
org.apache.shardingsphere.sharding.rule.ShardingRule.lambda$checkManualShardingAlgorithm$16(ShardingRule.java:207)
at
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:41)
at
org.apache.shardingsphere.sharding.rule.ShardingRule.checkManualShardingAlgorithm(ShardingRule.java:206)
at
org.apache.shardingsphere.sharding.rule.ShardingRule.lambda$createShardingTable$14(ShardingRule.java:199)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at
org.apache.shardingsphere.sharding.rule.ShardingRule.createShardingTable(ShardingRule.java:199)
at
org.apache.shardingsphere.sharding.rule.ShardingRule.lambda$createShardingTables$12(ShardingRule.java:194)
at
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at
java.base/java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1249)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at
java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at
org.apache.shardingsphere.sharding.rule.ShardingRule.createShardingTables(ShardingRule.java:195)
at
org.apache.shardingsphere.sharding.rule.ShardingRule.<init>(ShardingRule.java:126)
at
org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:43)
at
org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:37)
at
org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder.build(DatabaseRulesBuilder.java:69)
at
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.create(ShardingSphereDatabase.java:91)
at
org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory.createGenericDatabases(ExternalMetaDataFactory.java:85)
at
org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory.create(ExternalMetaDataFactory.java:72)
at
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:98)
at
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:72)
at
org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:53)
at
org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.createContextManager(BootstrapInitializer.java:68)
at
org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:58)
at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:55)
```
- how i can't use these Algorithms ? I spent the all day trying to figure
it out, but failed
--
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:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]