chengyonghu opened a new issue, #21195:
URL: https://github.com/apache/shardingsphere/issues/21195

   Sharding with other fields causes Seata to roll back all tables;
   rules:
   sharding:
   tables: # 数据分片规则配置
   icloud_user_picture: # 逻辑表名称
   actualDataNodes: ds-0.icloud_user_picture_$->{0..1} # 由数据源名 + 表名组成(参考 Inline 
语法规则)
   tableStrategy: # 分表策略,同分库策略
   standard:
   shardingColumn: user_id
   sharding-algorithm-name: icloud_user_picture_inline
   keyGenerateStrategy: # 分布式序列策略
   column: picture_id # 自增列名称,缺省表示不使用自增主键生成器
   keyGeneratorName: SNOWFLAKE # 分布式序列算法名称
   t: # 逻辑表名称
   actualDataNodes: ds-0.t_$->{0..1} # 由数据源名 + 表名组成(参考 Inline 语法规则)
   tableStrategy: # 分表策略,同分库策略
   standard:
   shardingColumn: id
   sharding-algorithm-name: t_inline
   keyGenerateStrategy: # 分布式序列策略
   column: id # 自增列名称,缺省表示不使用自增主键生成器
   keyGeneratorName: SNOWFLAKE # 分布式序列算法名称
   sharding-algorithms:
   icloud_user_picture_inline:
   type: INLINE
   props:
   algorithm-expression: icloud_user_picture_$->{user_id % 2}
   t_inline:
   type: INLINE
   props:
   algorithm-expression: t_$->{id % 2}
   ##这是我的执行SQL;
   update icloud_user_picture set picture_name='12打撒多jpg' where 
picture_id=68816112 and user_id=3457303
   
   ##事物回滚打印的SQL
   2022-09-23 15:48:40,624 INFO ShardingSphere-SQL 74 - Logic SQL: SELECT 
picture_id, picture_name FROM icloud_user_picture WHERE picture_id = 68816112 
AND user_id = 3457303 FOR UPDATE
   2022-09-23 15:48:40,624 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, 
lock=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.LockSegment@15829fbe],
 window=Optional.empty)
   2022-09-23 15:48:40,625 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
SELECT picture_id, picture_name FROM icloud_user_picture_1 WHERE picture_id = 
68816112 AND user_id = 3457303 FOR UPDATE
   2022-09-23 15:48:40,628 INFO ShardingSphere-SQL 74 - Logic SQL: update 
icloud_user_picture set picture_name='12打撒多jpg' where picture_id=68816112 and 
user_id=3457303
   2022-09-23 15:48:40,628 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLUpdateStatement(orderBy=Optional.empty, limit=Optional.empty)
   2022-09-23 15:48:40,628 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
update icloud_user_picture_1 set picture_name='12打撒多jpg' where 
picture_id=68816112 and user_id=3457303
   2022-09-23 15:48:40,630 INFO ShardingSphere-SQL 74 - Logic SQL: SELECT 
picture_id, picture_name FROM icloud_user_picture WHERE (picture_id ) in ( (?) )
   2022-09-23 15:48:40,631 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, 
lock=Optional.empty, window=Optional.empty)
   2022-09-23 15:48:40,631 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
SELECT picture_id, picture_name FROM icloud_user_picture_0 WHERE (picture_id ) 
in ( (?) ) UNION ALL SELECT picture_id, picture_name FROM icloud_user_picture_1 
WHERE (picture_id ) in ( (?) ) ::: [68816112, 68816112]
   2022-09-23 15:48:40,635 INFO ShardingSphere-SQL 74 - Logic SQL: INSERT INTO 
undo_log (branch_id, xid, context, rollback_info, log_status, log_created, 
log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6))
   2022-09-23 15:48:40,635 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLInsertStatement(setAssignment=Optional.empty, 
onDuplicateKeyColumns=Optional.empty)
   2022-09-23 15:48:40,635 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
INSERT INTO undo_log (branch_id, xid, context, rollback_info, log_status, 
log_created, log_modified) VALUES (?, ?, ?, ?, ?, now(6), now(6)) ::: 
[8620198519969607748, 192.168.0.206:8091:8620198519969607747, serializer=kryo, 
javax.sql.rowset.serial.SerialBlob@6405c56c, 0]
   2022-09-23 15:48:40,687 INFO i.s.c.r.p.c.RmBranchRollbackProcessor 56 - rm 
handle branch rollback 
process:xid=192.168.0.206:8091:8620198519969607747,branchId=8620198519969607748,branchType=AT,resourceId=jdbc:mysql://192.168.0.12:3307/camera_icloud,applicationData=null
   2022-09-23 15:48:40,687 INFO io.seata.rm.AbstractRMHandler 123 - Branch 
Rollbacking: 192.168.0.206:8091:8620198519969607747 8620198519969607748 
jdbc:mysql://192.168.0.12:3307/camera_icloud
   2022-09-23 15:48:40,688 INFO ShardingSphere-SQL 74 - Logic SQL: SELECT * 
FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE
   2022-09-23 15:48:40,688 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, 
lock=Optional[org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.LockSegment@438088be],
 window=Optional.empty)
   2022-09-23 15:48:40,688 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
SELECT * FROM undo_log WHERE branch_id = ? AND xid = ? FOR UPDATE ::: 
[8620198519969607748, 192.168.0.206:8091:8620198519969607747]
   2022-09-23 15:48:40,694 INFO ShardingSphere-SQL 74 - Logic SQL: SELECT * 
FROM icloud_user_picture WHERE (picture_id ) in ( (?) )
   2022-09-23 15:48:40,694 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLSelectStatement(table=Optional.empty, limit=Optional.empty, 
lock=Optional.empty, window=Optional.empty)
   2022-09-23 15:48:40,694 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
SELECT * FROM icloud_user_picture_0 WHERE (picture_id ) in ( (?) ) UNION ALL 
SELECT * FROM icloud_user_picture_1 WHERE (picture_id ) in ( (?) ) ::: 
[68816112, 68816112]
   2022-09-23 15:48:40,699 INFO ShardingSphere-SQL 74 - Logic SQL: UPDATE 
icloud_user_picture SET picture_name = ? WHERE picture_id = ?
   2022-09-23 15:48:40,700 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLUpdateStatement(orderBy=Optional.empty, limit=Optional.empty)
   2022-09-23 15:48:40,700 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
UPDATE icloud_user_picture_0 SET picture_name = ? WHERE picture_id = ? ::: 
[2222, 68816112]
   2022-09-23 15:48:40,700 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
UPDATE icloud_user_picture_1 SET picture_name = ? WHERE picture_id = ? ::: 
[2222, 68816112]
   2022-09-23 15:48:40,703 INFO ShardingSphere-SQL 74 - Logic SQL: DELETE FROM 
undo_log WHERE branch_id = ? AND xid = ?
   2022-09-23 15:48:40,703 INFO ShardingSphere-SQL 74 - SQLStatement: 
MySQLDeleteStatement(orderBy=Optional.empty, limit=Optional.empty)
   2022-09-23 15:48:40,703 INFO ShardingSphere-SQL 74 - Actual SQL: ds-0 ::: 
DELETE FROM undo_log WHERE branch_id = ? AND xid = ? ::: [8620198519969607748, 
192.168.0.206:8091:8620198519969607747]
   2022-09-23 15:48:40,724 INFO i.s.r.d.undo.AbstractUndoLogManager 312 - xid 
192.168.0.206:8091:8620198519969607747 branch 8620198519969607748, undo_log 
deleted with GlobalFinished
   2022-09-23 15:48:40,725 INFO io.seata.rm.AbstractRMHandler 131 - Branch 
Rollbacked result: PhaseTwo_Rollbacked
   
   ##When I use a T-table with ID as the primary key, the printed SQL is 
automatically sharded successfully and not executed multiple times
   
   JDK version : 1.8
   Seata version: 1.4.2
   OS :
   Others:


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to