Skip to content

*: remove ExtraPidCol and replace it with ExtraPhysTblIDCol#53974

Merged
ti-chi-bot[bot] merged 6 commits intopingcap:masterfrom
Defined2014:fix-53929
Jun 18, 2024
Merged

*: remove ExtraPidCol and replace it with ExtraPhysTblIDCol#53974
ti-chi-bot[bot] merged 6 commits intopingcap:masterfrom
Defined2014:fix-53929

Conversation

@Defined2014
Copy link
Contributor

@Defined2014 Defined2014 commented Jun 12, 2024

What problem does this PR solve?

Issue Number: close #53929

Problem Summary:

The problem is we added ExtraPhysTblID to DataSource's schema for get the partition id. But it returns table id instead of partition id when using indexReader executor working with global index, because we decode index key to get it. After deep into the code, I found it's hard to fix it elegantly. In logical plan builder phase, we can't determined it will select a global index path or not which means we can't addExtraPidColID column into DataSource in this phase.

Then I think maybe we could combine two columns, let it gets return values from different place(Seems ExtraPhysTblID is useless for global index, always return table ID for every records). When it is a global index, we could decode pid by index value, otherwise we could decode table id by index/row key. Also it could reduce potential errors, no need to select to use ExtraPhysTblID or ExtraPidColID when we write the code.

Related PR in TiKV side tikv/tikv#17141

What changed and how does it work?

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
Copy link

ti-chi-bot bot commented Jun 12, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 12, 2024
@tiprow
Copy link

tiprow bot commented Jun 12, 2024

Hi @Defined2014. 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.

Details

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.

@Defined2014 Defined2014 marked this pull request as ready for review June 13, 2024 02:08
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 13, 2024
@codecov
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Project coverage is 56.2551%. Comparing base (7a18952) to head (44d9a31).
Report is 45 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #53974         +/-   ##
=================================================
- Coverage   72.5434%   56.2551%   -16.2884%     
=================================================
  Files          1508       1638        +130     
  Lines        431744     616321     +184577     
=================================================
+ Hits         313202     346712      +33510     
- Misses        99141     246330     +147189     
- Partials      19401      23279       +3878     
Flag Coverage Δ
integration 36.3879% <92.5925%> (?)
unit 71.7910% <88.8888%> (+0.2613%) ⬆️

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

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

@Defined2014 Defined2014 requested a review from mjonss June 14, 2024 06:21
@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 Jun 17, 2024
@Defined2014
Copy link
Contributor Author

/retest

@tiprow
Copy link

tiprow bot commented Jun 18, 2024

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

Details

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.

@Defined2014 Defined2014 requested a review from tangenta June 18, 2024 02:28
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 18, 2024
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

Rest LGTM

// Assumes it is always last!
if e.columnInfos[len(e.columnInfos)-1].ColumnId == model.ExtraPhysTblID {
tblID := tablecodec.DecodeTableID(key)
if e.columnInfos[len(e.columnInfos)-1].ColumnId == model.ExtraPhysTblID && min(len(e.fieldTps), len(values)) < len(e.columnInfos) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this min func usage should be added with comments

tblID := tablecodec.DecodeTableID(key)

// when *e.physTblIDColIdx < min(len(e.fieldTypes), len(values)), pid is included in values and already filled in e.chk
if e.physTblIDColIdx != nil && *e.physTblIDColIdx >= min(len(e.fieldTypes), len(values)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here,better add a small case?

Copy link
Contributor

Choose a reason for hiding this comment

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

what the main reason for mismatch of len(e.fieldTypes) and len(values)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made some mistakes and updated.

Copy link
Contributor

@mjonss mjonss left a comment

Choose a reason for hiding this comment

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

LGTM, with some minor questions.

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

ti-chi-bot bot commented Jun 18, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-18 06:57:53.810150864 +0000 UTC m=+98000.295639696: ☑️ agreed by tangenta.
  • 2024-06-18 08:10:26.994172935 +0000 UTC m=+102353.479661767: ☑️ agreed by mjonss.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 18, 2024
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 18, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, mjonss, tangenta, XuHuaiyu

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

The pull request process is described here

Details 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 Jun 18, 2024
@ti-chi-bot ti-chi-bot bot merged commit 9008d23 into pingcap:master Jun 18, 2024
@Defined2014 Defined2014 deleted the fix-53929 branch June 18, 2024 09:59
RidRisR pushed a commit to RidRisR/tidb that referenced this pull request Jun 18, 2024
budney pushed a commit to budney/tidb that referenced this pull request May 18, 2025
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. sig/planner SIG: Planner 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.

select for update can't work with global index

5 participants