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/06/18 21:09:48 UTC

[GitHub] [shardingsphere] darkaquarius commented on issue #10862: When to support native auto-incrementing primary keys

darkaquarius commented on issue #10862:
URL: https://github.com/apache/shardingsphere/issues/10862#issuecomment-863879344


   when I insert a line to table skill_theme_read, or table skill_evaluation_xx,do NOT support auto-incrementing primary keys
   
   shardingsphere version: 5.0.0-RC1-SNAPSHOT
   Table Structure:
   CREATE TABLE `skill_theme_read` (
     `id` bigint(11) unsigned NOT NULL AUTO_INCREMENT,
     `uid` bigint(20) NOT NULL,
     `theme_id` bigint(11) NOT NULL COMMENT 'theme_info表的id,主题id',
     `update_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
     `add_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
     PRIMARY KEY (`id`),
     KEY `idx_uid` (`uid`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='技能包是否已读';
   
   sharing-jdbc config:
   
   dataSources:
     mysql_0:
       driverClassName: com.mysql.jdbc.Driver
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       ......
   
   rules:
     # 配置分片规则
     - !SHARDING
       defaultDatabaseStrategy:
         none:
       defaultTableStrategy:
         none:
       tables:
         skill_collection:
           actualDataNodes: mysql_0.skill_collection_${0..99}
           # 配置分表策略
           tableStrategy:
             standard:
               shardingColumn: uid
               shardingAlgorithmName: skill_collection_inline
         skill_evaluation:
           actualDataNodes: mysql_0.skill_evaluation_${0..99}
           # 配置分表策略
           tableStrategy:
             standard:
               shardingColumn: uid
               shardingAlgorithmName: skill_evaluation_inline
       # 配置分片算法
       shardingAlgorithms:
         skill_collection_inline:
           type: INLINE
           props:
             algorithm-expression: skill_collection_${uid % 100}
         skill_evaluation_inline:
           type: INLINE
           props:
             algorithm-expression: skill_evaluation_${uid % 100}
   props:
     sql-show: true


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org