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/05/14 07:43:18 UTC

[GitHub] [shardingsphere] wei442 opened a new issue #5596: Can not update sharding key,

wei442 opened a new issue #5596:
URL: https://github.com/apache/shardingsphere/issues/5596


   ## 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/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?
   
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   
   ### Expected behavior
   
   ### Actual behavior
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


----------------------------------------------------------------
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] terrymanu closed issue #5596: Can not update sharding key,

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


   


----------------------------------------------------------------
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] kimmking commented on issue #5596: Can not update sharding key,

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


   English only,
   And need more details.


----------------------------------------------------------------
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] wanghaichao2195 commented on issue #5596: Can not update sharding key,

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


   I use version 4.1.1 + springboot + hibernate


----------------------------------------------------------------
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] wanghaichao2195 commented on issue #5596: Can not update sharding key,

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


   I have this issue today, but I'm 100 percent sure the sharding key is the same (in my case is "uid"), but in ShardingUpdateStatementValidator, 
   the "shardingColumnSetAssignmentValue" is the correct value of uid,
   but in 
   ```java
   if (whereSegmentOptional.isPresent()) {
        shardingValue = getShardingValue(whereSegmentOptional.get(), parameters, shardingColumn);
   } 
   ```
   the getShardingValue will return empty because the identifier in it is "id" (which is the primary key, not shardingColumn in my table)
   ![Screen Shot 2020-10-01 at 9 32 09 PM](https://user-images.githubusercontent.com/24919562/94888326-92ed5980-042d-11eb-8a1d-55dd3e1dcf78.png)
   
   


----------------------------------------------------------------
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] wei442 edited a comment on issue #5596: Can not update sharding key,

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


   error
   Cause: org.apache.shardingsphere.core.exception.ShardingException: Can not update sharding key, logic table: [user_account], column: [org.apache.shardingsphere.sql.parser.sql.segment.dml.assignment.AssignmentSegment@dc9eb6e].
   This problem occurs when updating data
   sharding-jdbc-spring-boot-starter 4.0.0-RC2 is ok
   from 4.0.0 something wrong
   
   config
   spring.shardingsphere.sharding.tables.user_account.actual-data-nodes=master.user_account_$->{0..2}
   spring.shardingsphere.sharding.tables.user_account.table-strategy.inline.sharding-column=user_id
   spring.shardingsphere.sharding.tables.user_account.table-strategy.inline.algorithm-expression=user_account_$->{user_id % 3}
   
   
   How to deal with it ?


----------------------------------------------------------------
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] wanghaichao2195 commented on issue #5596: Can not update sharding key,

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


   yaml config:
   rules:
         sharding:
           default-table-strategy:
             standard:
               sharding-column: uid
               precise-algorithm-class-name: xxxxxxxxxxxxx
           tables:
             user_info_A:
               actual-data-nodes: xxxx.user_info_A_$->{0..${db.sharding.table.maxnumber}}
             user_info_B:
               actual-data-nodes: xxxx.user_info_B_$->{0..${db.sharding.table.maxnumber}}
   
   ```java
   @Table(name = "user_info_A")
   @Entity
   @NoArgsConstructor
   @AllArgsConstructor
   @Builder
   @Data
   public class UserInfo implements Serializable {
   
       @Id
       @GeneratedValue(strategy = GenerationType.AUTO)
       private Long id;
   
       @Column(name = "uid", nullable = false)
       private String uid;
   
       @Column(name = "out_uid", nullable = false)
       private String outUid = "";
       
       xxxxxxxxxxxxxxx
   
   ```
   
   I can save(insert) or query just fine, but I can't update. 
   I just query out a row and change just one attribute, and save(update) will throw "Can not update sharding key" Exception


----------------------------------------------------------------
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] terrymanu commented on issue #5596: Can not update sharding key,

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


   Just like you said, we do not support update sharding key


----------------------------------------------------------------
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] wei442 commented on issue #5596: Can not update sharding key,

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


   error
   Cause: org.apache.shardingsphere.core.exception.ShardingException: Can not update sharding key, logic table: [user_account], column: [org.apache.shardingsphere.sql.parser.sql.segment.dml.assignment.AssignmentSegment@dc9eb6e].
   
   config
   spring.shardingsphere.sharding.tables.user_account.actual-data-nodes=master.user_account_$->{0..2}
   spring.shardingsphere.sharding.tables.user_account.table-strategy.inline.sharding-column=user_id
   spring.shardingsphere.sharding.tables.user_account.table-strategy.inline.algorithm-expression=user_account_$->{user_id % 3}
   
   How to deal with it ?


----------------------------------------------------------------
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] wei442 edited a comment on issue #5596: Can not update sharding key,

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


   error
   Cause: org.apache.shardingsphere.core.exception.ShardingException: Can not update sharding key, logic table: [user_account], column: [org.apache.shardingsphere.sql.parser.sql.segment.dml.assignment.AssignmentSegment@dc9eb6e].
   This problem occurs when updating data
   
   config
   spring.shardingsphere.sharding.tables.user_account.actual-data-nodes=master.user_account_$->{0..2}
   spring.shardingsphere.sharding.tables.user_account.table-strategy.inline.sharding-column=user_id
   spring.shardingsphere.sharding.tables.user_account.table-strategy.inline.algorithm-expression=user_account_$->{user_id % 3}
   
   
   How to deal with it ?


----------------------------------------------------------------
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] 2602351188 commented on issue #5596: Can not update sharding key,

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


   I have the same err


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