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

Add test to cover the issue that check_txn_status being called on optimistic transaction may lead to transaction consistency issue #51666

Closed
MyonKeminta opened this issue Mar 11, 2024 · 0 comments · Fixed by #51667

Comments

@MyonKeminta
Copy link
Contributor

MyonKeminta commented Mar 11, 2024

The bug itself is tracked in: tikv/tikv#16620

Consider the test case added in #51667 . Without the fix to tikv, consider the checks at last:

assert.Error(t, err)
assert.Equal(t, errno.ErrWriteConflict, int(errors.Cause(err).(*errors.Error).Code()))
tk2.MustQuery("select * from t order by id").Check(testkit.Rows("1 11", "2 21"))
tk2.MustExec("admin check table t2")
tk2.MustQuery("select * from t2 order by id").Check(testkit.Rows("1 10", "2 11"))

  • No error will be received at line 529, where there is supposed to be.
  • Check fail at line 531:
                Error:          Not equal:
                                expected: "[1 11]\n[2 21]\n"
                                actual  : "[1 111]\n[2 21]\n"
    
    Which means that atomicity of transaction tk1 (adds 100 to both row 1 and row 2) is broken.
  • Data inconsistency will be found at line 532:
                Error:          Received unexpected error:
                                [admin:8223]data inconsistency in table: t2, index: v, handle: 1, index-values:"" != record-values:"handle: 1, values: [KindInt64 11]"
    
    Which is because tk1's write to table t2 (which should be a pair of row and index) is partially committed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant