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/09/14 09:54:45 UTC

[GitHub] [shardingsphere] stephensuxun opened a new issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

stephensuxun opened a new issue #12426:
URL: https://github.com/apache/shardingsphere/issues/12426


   nested exception is org.apache.ibatis.exceptions.PersistenceException: \n### Error updating database.  Cause: org.apache.shardingsphere.sharding.algorithm.sharding.ShardingAlgorithmException: failed to shard value PreciseShardingValue(logicTableName=ainews_user, columnName=create_time, value=2021-09-14 17:45:37.487), and availableTables [ainews_user_914, ainews_user_915, ainews_user_916]\n### The error may exist in com/ims/cloud/inspection/core/inspection/mapper/AiNewsUserMapper.java (best guess)\n### The error may involve com.ims.cloud.inspection.core.inspection.mapper.AiNewsUserMapper.insert-Inline\n### The error occurred while setting parameters\n### SQL: INSERT INTO ainews_user  ( user_id, user_account, user_name, nick_name, user_password,   user_used_amount,           expiration_date, create_time, update_time )  VALUES  ( ?, ?, ?, ?, ?,   ?,           ?, ?, ? )\n### Cause: org.apache.shardingsphere.sharding.algorithm.sharding.ShardingAlgorithmException: failed to shard value 
 PreciseShardingValue(logicTableName=ainews_user, columnName=create_time, value=2021-09-14 17:45:37.487), and availableTables [ainews_user_914, ainews_user_915, ainews_user_916]


-- 
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] zjcnb commented on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   @stephensuxun Hi, Which Sharding-JDBC version are you using.


-- 
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] stephensuxun commented on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   spring.shardingsphere.datasource.names=ds2021,ds2022
   spring.shardingsphere.sharding.default-data-source-name=ds2021
   
   spring.shardingsphere.datasource.ds2021.username=root
   spring.shardingsphere.datasource.ds2021.password=root
   spring.shardingsphere.datasource.ds2021.url=jdbc:mysql://localhost:3306/ims-inspect-2021?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
   spring.shardingsphere.datasource.ds2021.type=com.alibaba.druid.pool.DruidDataSource
   
   spring.shardingsphere.datasource.ds2022.username=root
   spring.shardingsphere.datasource.ds2022.password=root
   spring.shardingsphere.datasource.ds2022.url=jdbc:mysql://localhost:3306/ims-inspect-2022?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
   spring.shardingsphere.datasource.ds2022.type=com.alibaba.druid.pool.DruidDataSource
   
   
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.type=INTERVAL
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-pattern=yyyy-MM-dd HH:mm:ss
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-lower=2021-09-14 00:00:00
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-upper=2022-12-31 23:59:59
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-interval-amount=1
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-suffix-pattern=yyyy
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-datetime-interval-unit=YEARS
   spring.shardingsphere.rules.sharding.database.ims-inspect-.database-strategy.standard.sharding-column=create_time
   spring.shardingsphere.rules.sharding.database.ims-inspect-.database-strategy.standard.sharding-algorithm-name=year-sharding
   
   
   spring.shardingsphere.rules.sharding.sharding-algorithms.week-sharding.type=INTERVAL
   spring.shardingsphere.rules.sharding.sharding-algorithms.week-sharding.props.datetime-pattern=yyyy-MM-dd HH:mm:ss
   spring.shardingsphere.rules.sharding.sharding-algorithms.week-sharding.props.datetime-lower=2021-09-14 00:00:00
   spring.shardingsphere.rules.sharding.sharding-algorithms.week-sharding.props.datetime-upper=2022-12-31 23:59:59
   spring.shardingsphere.rules.sharding.sharding-algorithms.week-sharding.props.datetime-interval-amount=1
   spring.shardingsphere.rules.sharding.sharding-algorithms.week-sharding.props.sharding-suffix-pattern=MMdd
   
   
   spring.shardingsphere.rules.sharding.tables.ainews_user.actual-data-nodes=ds$->{2021..2022}.ainews_user_$->{914..916}
   spring.shardingsphere.rules.sharding.tables.ainews_user.table-strategy.standard.sharding-column=create_time
   spring.shardingsphere.rules.sharding.tables.ainews_user.table-strategy.standard.sharding-algorithm-name=week-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] zjcnb commented on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   You can try it with this config:
   
   
   ```
   spring.shardingsphere.datasource.names=ds2021,ds2022
   
   spring.shardingsphere.datasource.ds2021.username=root
   spring.shardingsphere.datasource.ds2021.password=123456
   spring.shardingsphere.datasource.ds2021.url=jdbc:mysql://localhost:3306/imsinspect_2021?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
   spring.shardingsphere.datasource.ds2021.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.ds2021.driver-class-name=com.mysql.jdbc.Driver
   
   spring.shardingsphere.datasource.ds2022.username=root
   spring.shardingsphere.datasource.ds2022.password=123456
   spring.shardingsphere.datasource.ds2022.url=jdbc:mysql://localhost:3306/imsinspect_2022?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
   spring.shardingsphere.datasource.ds2022.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.ds2022.driver-class-name=com.mysql.jdbc.Driver
   
   spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=create_time
   spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=year-sharding
   
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.type=INTERVAL
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-pattern=yyyy-MM-dd HH:mm:ss
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-lower=2021-09-14 00:00:00
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-upper=2022-12-31 23:59:59
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-interval-amount=1
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-suffix-pattern=yyyy
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-datetime-interval-unit=YEARS
   
   
   spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-column=create_time
   spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-algorithm-name=day-sharding
   
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.type=INTERVAL
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-pattern=yyyy-MM-dd HH:mm:ss
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-lower=2021-09-14 00:00:00
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-upper=2022-12-31 23:59:59
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-interval-amount=1
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.sharding-suffix-pattern=MMdd
   
   spring.shardingsphere.rules.sharding.tables.ainews_user_.actual-data-nodes=ds$->{2021..2022}.ainews_user_$->{20210914..20210916}
   ```
   


-- 
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] stephensuxun commented on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   5.0.0-beta


-- 
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] sandynz commented on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   Hi @stephensuxun , does it work with @zjcnb 's configuration?


-- 
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] zjcnb edited a comment on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   You should change table name ainews_user_914 to ainews_user_20210914, Otherwise, you need to customize the implementation. If you can change table name, you can try it with this config:
   
   
   ```
   spring.shardingsphere.datasource.names=ds2021,ds2022
   
   spring.shardingsphere.datasource.ds2021.username=root
   spring.shardingsphere.datasource.ds2021.password=123456
   spring.shardingsphere.datasource.ds2021.url=jdbc:mysql://localhost:3306/imsinspect_2021?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
   spring.shardingsphere.datasource.ds2021.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.ds2021.driver-class-name=com.mysql.jdbc.Driver
   
   spring.shardingsphere.datasource.ds2022.username=root
   spring.shardingsphere.datasource.ds2022.password=123456
   spring.shardingsphere.datasource.ds2022.url=jdbc:mysql://localhost:3306/imsinspect_2022?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
   spring.shardingsphere.datasource.ds2022.type=com.alibaba.druid.pool.DruidDataSource
   spring.shardingsphere.datasource.ds2022.driver-class-name=com.mysql.jdbc.Driver
   
   spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=create_time
   spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=year-sharding
   
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.type=INTERVAL
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-pattern=yyyy-MM-dd HH:mm:ss
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-lower=2021-09-14 00:00:00
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-upper=2022-12-31 23:59:59
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.datetime-interval-amount=1
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-suffix-pattern=yyyy
   spring.shardingsphere.rules.sharding.sharding-algorithms.year-sharding.props.sharding-datetime-interval-unit=YEARS
   
   
   spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-column=create_time
   spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-algorithm-name=day-sharding
   
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.type=INTERVAL
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-pattern=yyyy-MM-dd HH:mm:ss
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-lower=2021-09-14 00:00:00
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-upper=2022-12-31 23:59:59
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.datetime-interval-amount=1
   spring.shardingsphere.rules.sharding.sharding-algorithms.day-sharding.props.sharding-suffix-pattern=MMdd
   
   spring.shardingsphere.rules.sharding.tables.ainews_user_.actual-data-nodes=ds$->{2021..2022}.ainews_user_$->{20210914..20210916}
   ```
   


-- 
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] stephensuxun commented on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   SET NAMES utf8mb4;
   SET FOREIGN_KEY_CHECKS = 0;
   
   -- ----------------------------
   -- Table structure for ainews_user_914
   -- ----------------------------
   DROP TABLE IF EXISTS `ainews_user_914`;
   CREATE TABLE `ainews_user_914` (
     `user_id` bigint NOT NULL COMMENT '用户ID',
     `user_account` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '用户账号',
     `user_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '用户名',
     `nick_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '用户昵称',
     `user_password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '用户密码',
     `user_header_portrait` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '用户的头像',
     `user_email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '用户的邮箱地址',
     `user_used_amount` int DEFAULT '0' COMMENT '用户使用的数量',
     `user_total_usage` int DEFAULT '0' COMMENT '用户使用的总量',
     `user_salt` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL COMMENT '用户的盐值',
     `user_secret` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci COMMENT '用户的密文',
     `user_status` int DEFAULT '1' COMMENT '用户的状态 0代表冻结 1代表正常',
     `user_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT '0' COMMENT '用户的类型 -1测试 0普通用户 1付费用户 2普通企业 3付费企业',
     `is_authentication` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT '-1' COMMENT '是否通过认证 -1未认证 1个人认证 2企业认证 3代表审核中',
     `user_grade` int DEFAULT '1' COMMENT '用户的等级',
     `user_point` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT '0' COMMENT '用户的积分',
     `user_create_amount` int DEFAULT '0' COMMENT '用户创作的数量',
     `user_collect_amount` int DEFAULT '0' COMMENT '用户收藏的数量',
     `expiration_date` datetime DEFAULT NULL COMMENT '到期时间',
     `create_time` datetime DEFAULT NULL COMMENT '用户注册时间',
     `update_time` datetime DEFAULT NULL COMMENT '用户更新时间',
     `version` int DEFAULT '0' COMMENT '乐观锁',
     `deleted` int DEFAULT '0' COMMENT '逻辑删除',
     `token` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci COMMENT '用户的token',
     PRIMARY KEY (`user_id`) USING BTREE
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci COMMENT='';
   
   SET FOREIGN_KEY_CHECKS = 1;
   


-- 
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] sandynz commented on issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

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


   It will be closed now. Welcome to submit new issue if it still doesn't work.


-- 
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] sandynz closed issue #12426: According to the year-by-year database and according to the daily sub-data table, add data to report an error

Posted by GitBox <gi...@apache.org>.
sandynz closed issue #12426:
URL: https://github.com/apache/shardingsphere/issues/12426


   


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