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

executor: in-txn statement read from MemBuffer's snapshot #59219

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

you06
Copy link
Contributor

@you06 you06 commented Jan 27, 2025

What problem does this PR solve?

Issue Number: close #56178, ref #58289

Problem Summary:

What changed and how does it work?

This PR checks the MemBuffer status and fetches a snapshot if necessary before the executors start. This prevents potential data-race operations during the execution of the running executors.

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 do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 27, 2025
Copy link

tiprow bot commented Jan 27, 2025

Hi @you06. 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-sigs/prow repository.

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 64.63415% with 29 lines in your changes missing coverage. Please review.

Project coverage is 73.3245%. Comparing base (b45a9e8) to head (7c98d0e).
Report is 6 commits behind head on master.

Current head 7c98d0e differs from pull request most recent head f0f2089

Please upload reports for the commit f0f2089 to get more accurate results.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59219        +/-   ##
================================================
+ Coverage   72.9779%   73.3245%   +0.3466%     
================================================
  Files          1694       1690         -4     
  Lines        468758     483685     +14927     
================================================
+ Hits         342090     354660     +12570     
- Misses       105596     107407      +1811     
- Partials      21072      21618       +546     
Flag Coverage Δ
integration 42.8088% <63.4146%> (?)
unit 72.2295% <64.6341%> (+0.0536%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 43.9438% <ø> (-1.1338%) ⬇️

@you06
Copy link
Contributor Author

you06 commented Jan 29, 2025

/retest

Copy link

tiprow bot commented Jan 29, 2025

@you06: 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-sigs/prow repository.

@@ -254,6 +254,9 @@ type TxnCtxNoNeedToRestore struct {
// Read results cannot be directly written into pessimisticLockCache because failed statement need to rollback
// its pessimistic locks.
CurrentStmtPessimisticLockCache map[string][]byte

// MemBufferSnapshot is a snapshot of the memory buffer, every in-txn read of the buffer should use the snapshot to bypass the mutations of current statement.
MemBufferSnapshot kv.MemBufferSnapshot
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems more like a statement-level information. Should it be placed in stmtCtx and initialized OnStmtStart?

@@ -195,6 +199,34 @@ func getTiDBKeyFlags(flag tikvstore.KeyFlags) kv.KeyFlags {
return v
}

type snapshot struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Or just name it MemBufferSnapshot since there are many snapshot like definitions in TiDB?

@you06 you06 force-pushed the membuffer-snapshot-interface branch from 7c98d0e to 56fdfbc Compare February 20, 2025 11:47
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 20, 2025
Signed-off-by: you06 <[email protected]>
Copy link

ti-chi-bot bot commented Feb 21, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign wjhuang2016, yudongusa for approval, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

ti-chi-bot bot commented Feb 21, 2025

@you06: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/mysql-test f0f2089 link true /test mysql-test
idc-jenkins-ci-tidb/unit-test f0f2089 link true /test unit-test
idc-jenkins-ci-tidb/check_dev_2 f0f2089 link true /test check-dev2
idc-jenkins-ci-tidb/build f0f2089 link true /test build

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DATA RACE github.com/tikv/client-go/v2/internal/unionstore/rbt.(*RBT)
2 participants