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: skip getting actual end key for each range in ingest mode (#54143) #56748

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #54143

What problem does this PR solve?

Issue Number: close #45847, close #54147

Problem Summary: See #54147 (comment)

What changed and how does it work?

It is slow to get the actual end key of a range.

Previously, we introduce this for the reason that there may be mass writes during adding index, and the txn backfill workers cannot catch up with newly written row records. As a result, adding index never complete.

However, this can hardly happen in ingest mode:

  1. in write&ingest step, we use coprocessor instead of kv.scan to read table data, backfill workers are 10X speeded up.
  2. in merge temp-index step, index records are relatively small, and we have double-write mechanism to avoid temp index data grow infinitely.

This PR skips getting actual end key for each range in ingest mode.

Other changes include:

  • Refine the usage of splitTableRanges.
  • Extract getActualEndKey to a function.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    mysql> alter table usertable add index test_idx(FIELD0);
    Query OK, 0 rows affected (2 min 32.11 sec)
    
    mysql> alter table usertable add index test_idx(FIELD0);
    Query OK, 0 rows affected (2 min 28.35 sec)
    
    mysql> alter table usertable add index test_idx(FIELD0);
    Query OK, 0 rows affected (2 min 33.82 sec)
    
    mysql> alter table usertable add index test_idx(FIELD0);
    Query OK, 0 rows affected (2 min 29.74 sec)
    
  • 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 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. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR. labels Oct 21, 2024
@tangenta tangenta force-pushed the cherry-pick-54143-to-release-7.5 branch from 3ad39e8 to bd8d83e Compare December 6, 2024 03:55
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 6, 2024
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 79.65368% with 47 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-7.5@4b4b177). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-7.5     #56748   +/-   ##
================================================
  Coverage               ?   72.6202%           
================================================
  Files                  ?       1415           
  Lines                  ?     416790           
  Branches               ?          0           
================================================
  Hits                   ?     302674           
  Misses                 ?      94263           
  Partials               ?      19853           
Flag Coverage Δ
unit 72.6202% <79.6536%> (?)

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

Components Coverage Δ
dumpling 52.9400% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 54.5113% <0.0000%> (?)

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 6, 2024
Copy link

ti-chi-bot bot commented Dec 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, tangenta

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 Dec 10, 2024
Copy link

ti-chi-bot bot commented Dec 10, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-06 07:50:24.771595433 +0000 UTC m=+1400412.391249949: ☑️ agreed by tangenta.
  • 2024-12-10 10:20:04.537537929 +0000 UTC m=+347394.626340474: ☑️ agreed by lance6716.

@tangenta
Copy link
Contributor

/retest

Copy link

ti-chi-bot bot commented Dec 11, 2024

@ti-chi-bot: The following test 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 bd8d83e link unknown /test mysql-test

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

@tangenta
Copy link
Contributor

/retest

@ti-chi-bot ti-chi-bot bot merged commit 0b7ed62 into pingcap:release-7.5 Dec 11, 2024
14 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants