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/03/02 10:39:08 UTC

[GitHub] [incubator-shardingsphere] kimmking commented on issue #4306: Why do distributed primary keys need to be retrieved in reverse order in ShardingGeneratedKeyInsertValueParameterRewriter.rewrite

kimmking commented on issue #4306: Why do distributed primary keys need to be retrieved in reverse order in ShardingGeneratedKeyInsertValueParameterRewriter.rewrite
URL: https://github.com/apache/incubator-shardingsphere/issues/4306#issuecomment-593337142
 
 
   Hi, @saboluo 
   I have reprodeced your case:
   ```
   ..ds_0 ::: insert into user1(`name`,`age`, id) values (?, ?, ?) ::: [name-0, 0, 441306093067436035] 
   ..ds_1 ::: insert into user2(`name`,`age`, id) values (?, ?, ?) ::: [name-1, 1, 441306093067436034] 
   ..ds_0 ::: insert into user0(`name`,`age`, id) values (?, ?, ?) ::: [name-2, 2, 441306093067436033] 
   ..ds_1 ::: insert into user1(`name`,`age`, id) values (?, ?, ?) ::: [name-3, 3, 441306093067436032] 
   ```
   
   Two points:
   1. descendingIterator id;
   2. wrong mod lead to wrong sharding table.
   
   Row 2, 441306093067436034 % 3 == 0, but inserted into user2 not user0.
   

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


With regards,
Apache Git Services