Skip to content

insert on duplicate语句在无唯一索引且主键自增的情况下,前置镜像和后置镜像构造出现问题 #5007

@renliangyu857

Description

@renliangyu857
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

1、当前的前置镜像SQL语句查询条件是通过在插入语句中找出唯一索引或主键值构造的,当主键自增且无唯一索引的情况下,就没有查询条件了,导致查询出了所有数据,实际前置镜像应该为空
eg:
CREATE TABLE t_nounique (
id int auto_increment,
a int DEFAULT NULL,
b int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
insert into t_nounique(id,a,b) values(3,3) on duplicate key update b = 5
2、当前后置镜像SQL语句查询条件是通过前置镜像SQL语句加上前置镜像结果中的主键值来构造的,没有考虑主键自增且无前置镜像的情况。建议后置镜像的查询条件逻辑修改为:先通过前置镜像SQL找到的主键值+前置镜像主键值去重组合,若组合的列表为空,再查找到插入后的自增主键值

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version :
  • Seata version:
  • OS :
  • Others:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions