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 2020/04/22 07:44:31 UTC
[GitHub] [shardingsphere] nevereverever opened a new issue #5259: Do not specify split columns will be inserted into all nodes
nevereverever opened a new issue #5259:
URL: https://github.com/apache/shardingsphere/issues/5259
## Bug Report
**For English only**, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed [GitHub issues](https://github.com/apache/incubator-shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
Please pay attention on issues you submitted, because we maybe need more details.
If no response **more than 7 days** and we cannot reproduce it on current information, we will **close it**.
Please answer these questions before submitting your issue. Thanks!
### Which version of ShardingSphere did you use?
`5.0.0-RC1-SNAPSHOT`
### Which project did you use? Sharding-JDBC or Sharding-Proxy?
`Sharding-Proxy`
### describe
#### my config-sharding.yaml:
```yaml
schemaName: sharding_db
dataSources:
ds_0:
url: jdbc:mysql://172.18.30.14:3310/db01?serverTimezone=UTC&useSSL=false
username: hotdb_root
password: hotdb_root
connectionTimeoutMilliseconds: 300000
idleTimeoutMilliseconds: 600000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 500
ds_1:
url: jdbc:mysql://172.18.30.15:3310/db01?serverTimezone=UTC&useSSL=false
username: hotdb_root
password: hotdb_root
connectionTimeoutMilliseconds: 300000
idleTimeoutMilliseconds: 600000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 500
shardingRule:
tables:
ns_card:
actualDataNodes: ds_${0..1}.ns_card_${0..4}
databaseStrategy:
standard:
shardingColumn: divided_column
shardingAlgorithm:
type: SIMPLEHASH
tableStrategy:
standard:
shardingColumn: last_price_update_time
shardingAlgorithm:
type: YYYYMM
keyGenerator:
type: SNOWFLAKE
column: id
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
```
`First level split`:`divided_column`,it determines which actual database to insert,it is a precise hash algorithm.
`Second level split`: `last_price_update_time`,it determines which actual table to insert, it is a range hash algorithm,different month will insert to different tables.
#### table
```sql
create table ns_card(
id bigint(20) primary key comment '主键',
card_name varchar(32) comment '卡带名称',
card_type char(1) comment '卡带类型,N(nitendo),S(sega),O(others)',
card_price double comment '卡带价格',
sell_num bigint(20) comment '销售额',
last_price_update_time date comment '上次价格调节时间',
divided_column varchar(10) comment '拆分列',
index(card_type),
index(card_price),
index(last_price_update_time)
)comment 'switch卡带价格';
```
#### behavior
```sql
insert into ns_card (card_name,card_type,card_price,sell_num,last_price_update_time)
values('勇者斗恶龙','N',220,500000,now());
insert into ns_card (card_name,card_type,card_price,sell_num,last_price_update_time)
values('勇者斗恶龙','N',220,500000,now())
> Affected rows: 2
> 时间: 0.598s
```
<font size="10"><b> I do not specify split columns (divided_column) will be inserted into all database nodes</b></font>
And what I want to say is that my question is not repeated:
```sql
insert into ns_card (card_name,card_type,card_price,sell_num,last_price_update_time,divided_column)
values('健身环大冒险','N',1000,12045000,'2019-03-02 05:00:00',null)
> 10002 - 2Unknown exception: [Insert clause sharding column can't be null.]
> 时间: 2.804s
```
I know this bug is fixed in #3895 .
I think this bug should be handled in the same way as this one.
----------------------------------------------------------------
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
[GitHub] [shardingsphere] nevereverever commented on issue #5259: Do not specify split columns will be inserted into all nodes
Posted by GitBox <gi...@apache.org>.
nevereverever commented on issue #5259:
URL: https://github.com/apache/shardingsphere/issues/5259#issuecomment-617659636
I fixed this.
----------------------------------------------------------------
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