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

txn: implement staging for Pipelined DML #51832

Merged
merged 9 commits into from
Mar 18, 2024

Conversation

ekexium
Copy link
Contributor

@ekexium ekexium commented Mar 15, 2024

What problem does this PR solve?

Issue Number: ref #50215

Problem Summary:

The lack of support for staging interface leads to incorrect behavior when part of the stmt can fail but the whole stmt succeeds.

What changed and how does it work?

Implement the staging interface for pipelined DML. Its correctness is guaranteed by that no stage can exist when a Flush() is called. Every stage lives inside a flush batch, which means the modifications all goes to the mutable memdb. Thus the staging of the whole PipeliendMemDB can be directly implemented by the memdb.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 15, 2024
Copy link

tiprow bot commented Mar 15, 2024

Hi @ekexium. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ekexium ekexium requested review from you06 and cfzjywxk March 15, 2024 12:56
ekexium added 2 commits March 15, 2024 20:56
Signed-off-by: ekexium <[email protected]>
Signed-off-by: ekexium <[email protected]>
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Merging #51832 (2b09d85) into master (7056209) will decrease coverage by 15.8710%.
Report is 3 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #51832         +/-   ##
=================================================
- Coverage   70.6586%   54.7876%   -15.8710%     
=================================================
  Files          1477       1588        +111     
  Lines        438466     609031     +170565     
=================================================
+ Hits         309814     333674      +23860     
- Misses       109184     252210     +143026     
- Partials      19468      23147       +3679     
Flag Coverage Δ
integration 36.7585% <76.9230%> (?)
unit 70.5843% <100.0000%> (+0.1354%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 52.3714% <ø> (+6.5630%) ⬆️

@ekexium
Copy link
Contributor Author

ekexium commented Mar 15, 2024

/retest

Copy link

tiprow bot commented Mar 15, 2024

@ekexium: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

@you06 you06 left a comment

Choose a reason for hiding this comment

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

There is a similar but simpler test in pipelineddml_test package, can you uncomment the result check code, rest LGTM

func TestInsertIgnoreOnDuplicateKeyUpdate(t *testing.T) {
store := realtikvtest.CreateMockStoreAndSetup(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("set session tidb_dml_type = bulk")
tk.MustExec("use test")
tk.MustExec("drop table if exists t1")
tk.MustExec("create table t1(a int, b int, unique index u1(a, b), unique index u2(a))")
tk.MustExec("insert into t1 values(0, 0), (1, 1)")
tk.MustExecToErr("insert ignore into t1 values (0, 2) ,(1, 3) on duplicate key update b = 5, a = 0")
// if the statement execute successful, the following check should pass.
// tk.MustQuery("select * from t1").Sort().Check(testkit.Rows("0 5", "1 1"))
}

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Mar 18, 2024
Copy link

ti-chi-bot bot commented Mar 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, you06

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 18, 2024
Copy link

ti-chi-bot bot commented Mar 18, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-18 07:11:27.991745224 +0000 UTC m=+1274315.013991612: ☑️ agreed by you06.
  • 2024-03-18 09:02:16.01691234 +0000 UTC m=+1280963.039158728: ☑️ agreed by cfzjywxk.

@ekexium
Copy link
Contributor Author

ekexium commented Mar 18, 2024

/retest

Copy link

tiprow bot commented Mar 18, 2024

@ekexium: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit af89779 into pingcap:master Mar 18, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants