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

table: introduce RowIDShardGenerator and ReservedRowIDAlloc to alloc auto row id #54789

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: ref #54397

What changed and how does it work?

This PR introduced two more methods to MutateContext to reduce the usage of GetSessionVars:

  • GetRowIDShardGenerator() to return a RowIDShardGenerator to generate shard for auto-random columns.
  • GetReservedRowIDAlloc() to return a ReservedRowIDAlloc to reserve row id locally.

This PR does not change any code logic.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 22, 2024
Copy link

tiprow bot commented Jul 22, 2024

Hi @lcwangchao. 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 Jul 22, 2024

Codecov Report

Attention: Patch coverage is 96.82540% with 2 lines in your changes missing coverage. Please review.

Project coverage is 56.2650%. Comparing base (d67421d) to head (c6dfd4b).
Report is 3 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54789         +/-   ##
=================================================
- Coverage   72.7078%   56.2650%   -16.4429%     
=================================================
  Files          1557       1681        +124     
  Lines        438108     613294     +175186     
=================================================
+ Hits         318539     345070      +26531     
- Misses        99847     244707     +144860     
- Partials      19722      23517       +3795     
Flag Coverage Δ
integration 37.7644% <92.0634%> (?)
unit 71.7264% <96.8254%> (+0.0082%) ⬆️

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

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.5836% <ø> (+6.7649%) ⬆️

Comment on lines -206 to -209
// ShardStep indicates the max size of continuous rowid shard in one transaction.
ShardStep int
shardRemain int
currentShard int64
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR removed those lines because all states are moved to SessionVars. And every time the txn active, the inner shardStep and shardRemain will be reset

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Jul 22, 2024

@lcwangchao: 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.

@lcwangchao lcwangchao force-pushed the mutatectx_autoid branch 2 times, most recently from 08ca7e2 to fdc1b28 Compare July 22, 2024 08:15
Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 22, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 22, 2024
Copy link

ti-chi-bot bot commented Jul 22, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-22 08:34:21.694032641 +0000 UTC m=+861283.684974111: ☑️ agreed by YangKeao.
  • 2024-07-22 09:01:29.343519625 +0000 UTC m=+862911.334461095: ☑️ agreed by tiancaiamao.

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2024
@easonn7
Copy link

easonn7 commented Jul 24, 2024

/approve

Copy link

ti-chi-bot bot commented Jul 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, tangenta, tiancaiamao, YangKeao

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 the approved label Jul 24, 2024
@ti-chi-bot ti-chi-bot bot merged commit 47179ae into pingcap:master Jul 24, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants