Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when doing global rollback ,may cause an endless loop #6561

Open
1 task
sixlei opened this issue May 20, 2024 · 7 comments
Open
1 task

when doing global rollback ,may cause an endless loop #6561

sixlei opened this issue May 20, 2024 · 7 comments
Assignees
Labels
good first issue Good for newcomers task: help-wanted Extra attention is needed

Comments

@sixlei
Copy link
Contributor

sixlei commented May 20, 2024

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

Ⅰ. Issue Description

if there is a table like
CREATE TABLEt_test(uridint NOT NULL,name varchar(64) DEFAULT NULL, PRIMARY KEY (urid), UNIQUE KEY t_test_name (name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
name is a uniquekey. and There is a piece of data in the table. (1,1)
1、global Transaction execute the sql "delete from t_test where id = 1", and this transaction need rollback
2、when rollbacking,other thread execute a sql like "insert into t_test values (2,1)"
3、that will cause the rollback thread endless loop.

Ⅱ. Describe what happened

that's because the range of the code "catch (SQLIntegrityConstraintViolationException e)" is too wide in AbstractUndoLogManager#undo
and rollback of business will be catched by this.
that should just catch "insertUndoLogWithGlobalFinished"

  • JDK version(e.g. java -version):
  • Seata client/server version: 1.6.X
  • Database version: mysql 8.X
  • OS(e.g. uname -a): centos7
  • Others: jdk8
@sixlei
Copy link
Contributor Author

sixlei commented May 20, 2024

If it is confirmed that it is not specially designed like this, I can mention pr to fix it.

@funky-eyes
Copy link
Contributor

When data needs to be restored to a state before deletion, and its unique index is being used by other rows, do you think this data is unrecoverable? Should such data be restored in an incomplete state?

@sixlei
Copy link
Contributor Author

sixlei commented May 21, 2024

It should be unrecoverable, at least from the point of view of seata. I think it can be treated as a dirty write operation, so that seata-server can keep the retry at a fixed frequency.

@funky-eyes
Copy link
Contributor

It should be unrecoverable, at least from the point of view of seata. I think it can be treated as a dirty write operation, so that seata-server can keep the retry at a fixed frequency.

I agree with this approach. In fact, it is unrecoverable.

@sixlei
Copy link
Contributor Author

sixlei commented May 21, 2024

It should be unrecoverable, at least from the point of view of seata. I think it can be treated as a dirty write operation, so that seata-server can keep the retry at a fixed frequency.

Then I'll mention a pr to fix it. Now this situation is an endless cycle because outside "for(;;)", and it should be possible to fix it.

@sixlei sixlei changed the title when doing global rollbacking ,may cause an endless loop when doing global rollback ,may cause an endless loop May 22, 2024
@funky-eyes funky-eyes added task: help-wanted Extra attention is needed good first issue Good for newcomers labels Jun 21, 2024
@LPBruce
Copy link

LPBruce commented Jul 1, 2024

@funky-eyes Please assign to me, I will fix it.

@funky-eyes
Copy link
Contributor

@funky-eyes Please assign to me, I will fix it.

ok

@funky-eyes funky-eyes assigned sixlei and unassigned LPBruce Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers task: help-wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants