You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "sandynz (via GitHub)" <gi...@apache.org> on 2023/02/17 06:12:24 UTC

[GitHub] [shardingsphere] sandynz opened a new issue, #24210: Insert failed on MySQL VARBINARY column when it is sharding column

sandynz opened a new issue, #24210:
URL: https://github.com/apache/shardingsphere/issues/24210

   ## Feature Request
   
   ### Is your feature request related to a problem?
   Yes
   
   ### Describe the feature you would like.
   MySQL is used, table primary key is VARBINARY type. Primary key column is sharding column, and keyGenerateStrategy is NOT configured.
   When insert into table, there's exception thrown.
   It's tested in migration job. The inserted varbinary value is byte array (read from MySQL and write to ShardingSphere with MySQL).
   ```
   o.a.s.e.e.h.g.LogJobErrorHandler - Job 'j0101b36ade21a62d0d8bdc8b55d2eb1ea55a' exception occur in job processing
   java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.apache.shardingsphere.sharding.exception.data.NotImplementComparableValueException: Sharding value: [B@6fd51628 value must implements Comparable.
           at org.apache.shardingsphere.data.pipeline.core.execute.ExecuteEngine.trigger(ExecuteEngine.java:117)
           at org.apache.shardingsphere.data.pipeline.core.task.InventoryIncrementalTasksRunner.executeInventoryTask(InventoryIncrementalTasksRunner.java:97)
           at org.apache.shardingsphere.data.pipeline.core.task.InventoryIncrementalTasksRunner.start(InventoryIncrementalTasksRunner.java:84)
           at org.apache.shardingsphere.data.pipeline.core.job.AbstractSimplePipelineJob.execute(AbstractSimplePipelineJob.java:60)
           at org.apache.shardingsphere.elasticjob.simple.executor.SimpleJobExecutor.process(SimpleJobExecutor.java:33)
           at org.apache.shardingsphere.elasticjob.simple.executor.SimpleJobExecutor.process(SimpleJobExecutor.java:29)
           at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.process(ElasticJobExecutor.java:173)
           at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.process(ElasticJobExecutor.java:142)
           at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:124)
           at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:100)
           at org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJob.execute(LiteJob.java:35)
           at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
           at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
   Caused by: java.util.concurrent.ExecutionException: org.apache.shardingsphere.sharding.exception.data.NotImplementComparableValueException: Sharding value: [B@6fd51628 value must implements Comparable.
           at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
           at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
           at org.apache.shardingsphere.data.pipeline.core.execute.ExecuteEngine.trigger(ExecuteEngine.java:111)
           ... 12 common frames omitted
   Caused by: org.apache.shardingsphere.sharding.exception.data.NotImplementComparableValueException: Sharding value: [B@6fd51628 value must implements Comparable.
           at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine.lambda$getShardingValue$0(InsertClauseShardingConditionEngine.java:145)
           at org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:41)
           at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine.getShardingValue(InsertClauseShardingConditionEngine.java:145)
           at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine.createShardingCondition(InsertClauseShardingConditionEngine.java:115)
           at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine.createShardingConditionsWithInsertValues(InsertClauseShardingConditionEngine.java:84)
           at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.InsertClauseShardingConditionEngine.createShardingConditions(InsertClauseShardingConditionEngine.java:71)
           at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.DefaultShardingConditionEngine.createShardingConditions(DefaultShardingConditionEngine.java:47)
           at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createShardingConditions(ShardingSQLRouter.java:69)
           at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:53)
           at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:46)
           at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:69)
           at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:55)
           at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:59)
           at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:51)
           at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.createExecutionContext(ShardingSpherePreparedStatement.java:697)
           at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.addBatch(ShardingSpherePreparedStatement.java:780)
           at org.apache.shardingsphere.data.pipeline.core.importer.DataSourceImporter.executeBatchInsert(DataSourceImporter.java:191)
           at org.apache.shardingsphere.data.pipeline.core.importer.DataSourceImporter.doFlush(DataSourceImporter.java:160)
           at org.apache.shardingsphere.data.pipeline.core.importer.DataSourceImporter.tryFlush(DataSourceImporter.java:142)
           at org.apache.shardingsphere.data.pipeline.core.importer.DataSourceImporter.flushInternal(DataSourceImporter.java:135)
           at org.apache.shardingsphere.data.pipeline.core.importer.DataSourceImporter.flush(DataSourceImporter.java:125)
           at org.apache.shardingsphere.data.pipeline.core.importer.DataSourceImporter.runBlocking(DataSourceImporter.java:101)
           at org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor.start(AbstractLifecycleExecutor.java:52)
           at org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor.run(AbstractLifecycleExecutor.java:90)
           at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1736)
           at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java)
           at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
           at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
           at java.base/java.lang.Thread.run(Thread.java:834)
   ```
   
   Example table structure, yaml configuration and test code could refer to #24135.
   
   Just remove keyGenerateStrategy and change `shardingColumn: user_id` to `shardingColumn: order_id`.
   ```
   databaseName: logic_db
   # ...
   
   rules:
     - !SHARDING
       autoTables:
         t_order:
           actualDataSources: ds_2,ds_3,ds_4
           logicTable: t_order
           shardingStrategy:
             standard:
               shardingAlgorithmName: t_order_hash_mod
               shardingColumn: order_id
       shardingAlgorithms:
         t_order_hash_mod:
           props:
             sharding-count: '6'
           type: hash_mod
   ```
   


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


[GitHub] [shardingsphere] strongduanmu closed issue #24210: Insert failed on MySQL VARBINARY column when it is sharding column

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu closed issue #24210: Insert failed on MySQL VARBINARY column when it is sharding column
URL: https://github.com/apache/shardingsphere/issues/24210


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