Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions tests/realtikvtest/pessimistictest/pessimistic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2763,7 +2763,7 @@ func TestLazyUniquenessCheck(t *testing.T) {
if kerneltype.IsClassic() {
require.ErrorContains(t, err, "reason=LazyUniquenessCheck")
} else {
require.ErrorContains(t, err, "reason=NotLockedKeyConflict")
requireNextGenLazyUniquenessConflictReason(t, err)
}

// case: DML returns error => abort txn
Expand Down Expand Up @@ -3090,10 +3090,23 @@ func TestLazyUniquenessCheckWithInconsistentReadResult(t *testing.T) {
if kerneltype.IsClassic() {
require.ErrorContains(t, err, "reason=LazyUniquenessCheck")
} else {
require.ErrorContains(t, err, "reason=NotLockedKeyConflict")
requireNextGenLazyUniquenessConflictReason(t, err)
}
}

// Different next-gen engine families currently surface different write-conflict reasons
// for lazy uniqueness checks, so the TiDB-side assertion should accept both.
func requireNextGenLazyUniquenessConflictReason(t *testing.T, err error) {
t.Helper()
errMsg := err.Error()
require.Truef(
t,
strings.Contains(errMsg, "reason=LazyUniquenessCheck") || strings.Contains(errMsg, "reason=NotLockedKeyConflict"),
"expected next-gen lazy uniqueness conflict reason, got %s",
Comment on lines +3104 to +3105

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use different msg depends on kernel type to be exact

if kerneltype.IsNextGen() {...}
else ...

or better, let's wait tikv side fix this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't guess if tikv changes the behavior intentionally. If not, tikv should fix it, I agree.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a mistake by AI in CSE PR#4440. I will fix it in tikv side.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think I can close this PR now.

errMsg,
)
}

func TestLazyUniquenessCheckWithSavepoint(t *testing.T) {
store := realtikvtest.CreateMockStoreAndSetup(t)
tk := testkit.NewTestKit(t, store)
Expand Down
Loading