lbj812 opened a new issue, #8005: URL: https://github.com/apache/incubator-seata/issues/8005
### Check Ahead - [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. - [x] I am willing to try to fix this bug myself. ### Ⅰ. Issue Description 测试的表结构如下: CREATE TABLE `test`.`device` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, PRIMARY KEY (`id`, `code`) USING BTREE, UNIQUE INDEX `id`(`id`) USING BTREE, UNIQUE INDEX `code`(`code`) USING BTREE ) 复合主键:id 和 code id 也是唯一键 为何要这个设计?因为要通过code分区,code字段必须包含在主键里面。 新增记录的时候,undo_log表中生成了记录,进行如下查询: SELECT CONVERT(rollback_info USING utf8mb4) FROM undo_log; 结果如下: { "@class": "io.seata.rm.datasource.undo.BranchUndoLog", "xid": "192.168.1.112:8091:2423690571745198677", "branchId": 2423690571745198686, "sqlUndoLogs": [ "java.util.ArrayList", [ { "@class": "io.seata.rm.datasource.undo.SQLUndoLog", "sqlType": "INSERT", "tableName": "device", "beforeImage": { "@class": "io.seata.rm.datasource.sql.struct.TableRecords$EmptyTableRecords", "tableName": "device", "rows": [ "java.util.ArrayList", [] ] }, "afterImage": { "@class": "io.seata.rm.datasource.sql.struct.TableRecords", "tableName": "device", "rows": [ "java.util.ArrayList", [ { "@class": "io.seata.rm.datasource.sql.struct.Row", "fields": [ "java.util.ArrayList", [ { "@class": "io.seata.rm.datasource.sql.struct.Field", "name": "code", "keyType": "PRIMARY_KEY", "type": 12, "value": "1000" }, { "@class": "io.seata.rm.datasource.sql.struct.Field", "name": "id", "keyType": "PRIMARY_KEY", "type": 4, "value": 8 }, { "@class": "io.seata.rm.datasource.sql.struct.Field", "name": "code", "keyType": "PRIMARY_KEY", "type": 12, "value": "1000" }, { "@class": "io.seata.rm.datasource.sql.struct.Field", "name": "name", "keyType": "NULL", "type": 12, "value": "联想笔记本电脑" } ] ] } ] ] } } ] ] } 发现里面的数据 { "@class": "io.seata.rm.datasource.sql.struct.Field", "name": "code", "keyType": "PRIMARY_KEY", "type": 12, "value": "1000" } 是重复的。导致回滚失败。 经过测试,这个问题在 1.7.1和1.8.0版本中存在。1.7.0没有测试。 1.7.0-SNAPSHOT 版本没有问题 依赖如下: <dependency> <groupId>io.seata</groupId> <artifactId>seata-spring-boot-starter</artifactId> <version>1.7.0-SNAPSHOT</version> </dependency> ### Ⅱ. Describe what happened _No response_ ### Ⅲ. Describe what you expected to happen _No response_ ### Ⅳ. How to reproduce it (as minimally and precisely as possible) _No response_ ### Ⅴ. Anything else we need to know? _No response_ ### Ⅵ. Environment _No response_ -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
