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

ddl: fix add index's merge with multi-schema optimization #51747

Merged
merged 7 commits into from
Mar 14, 2024

Conversation

tangenta
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #51746

Problem Summary:

The bug is introduced by #47135: when merging temp index records from multiple indexes, I didn't set reorgInfo's StartKey and EndKey correctly. As a result, only one temp index get merged.

What changed and how does it work?

This PR initializes reorgInfo.Start and reorgInfo.End with keys encoded by the first index ID and the last index ID.

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-triage-completed 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 Mar 13, 2024
Copy link

tiprow bot commented Mar 13, 2024

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

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

Merging #51747 (414d03d) into master (47a990e) will increase coverage by 2.0356%.
Report is 24 commits behind head on master.
The diff coverage is 69.7247%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #51747        +/-   ##
================================================
+ Coverage   70.7663%   72.8020%   +2.0356%     
================================================
  Files          1475       1476         +1     
  Lines        437315     442228      +4913     
================================================
+ Hits         309472     321951     +12479     
+ Misses       108511     100117      -8394     
- Partials      19332      20160       +828     
Flag Coverage Δ
integration 48.9651% <46.7889%> (?)
unit 70.4798% <69.7247%> (-0.1078%) ⬇️

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

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

}
txn.SetOption(kv.ResourceGroupName, w.jobContext.resourceGroupName)

tmpIdxRecords, nextKey, taskDone, err := w.fetchTempIndexVals(txn, taskRange)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we move the skip tempIndex or switch this logic
if len(w.currentTempIndexPrefix) == 0 || !bytes.HasPrefix(indexKey, w.currentTempIndexPrefix) { skip, err := w.updateCurrentIndexInfo(indexKey) if err != nil || skip { return skip, err } }
out of fetchTempIndexVals func and do it in taskRange level ?
This could reduce compare and switch prefix logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@Benjamin2037 Benjamin2037 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 approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 14, 2024
Copy link

ti-chi-bot bot commented Mar 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, wjhuang2016

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 14, 2024
Copy link

ti-chi-bot bot commented Mar 14, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-14 13:49:43.804626475 +0000 UTC m=+952610.826872863: ☑️ agreed by Benjamin2037.
  • 2024-03-14 17:42:02.64398057 +0000 UTC m=+966549.666226951: ☑️ agreed by wjhuang2016.

@ti-chi-bot ti-chi-bot bot merged commit c1e3dae into pingcap:master Mar 14, 2024
23 checks passed
@tangenta tangenta added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Mar 15, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #51798.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Mar 15, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. 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.

Data inconsistency after adding indexes with multi-schema optimization
4 participants