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 reorg info end key after resuming from checkpoint (#52447) #52458

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #52447

What problem does this PR solve?

Issue Number: close #52411

Problem Summary:

mysql> select count(1) from sbtest1 use index ();
+----------+
| count(1) |
+----------+
|  5000000 |
+----------+
1 row in set (0.58 sec)

mysql> select count(1) from sbtest1 use index (idxc);
+----------+
| count(1) |
+----------+
|  4999999 |
+----------+
1 row in set (0.85 sec)
[2024/04/09 09:53:12.953 +08:00] [ERROR] [reporter.go:274] ["admin check found data inconsistency"] [conn=3848273922] [session_alias=] [table_name=sbtest2] [index_name=idxc] [row_id=5134965]
mysql> select tidb_decode_key('7480000000000000e85f7280000000004e5a75');
+-----------------------------------------------------------+
| tidb_decode_key('7480000000000000e85f7280000000004e5a75') |
+-----------------------------------------------------------+
| {"_tidb_rowid":5134965,"table_id":"232"}                  |
+-----------------------------------------------------------+
1 row in set (0.00 sec)
[2024/04/09 09:40:33.541 +08:00] [INFO] [reorg.go:742] ["[ddl] job get table range"] [jobID=257] [physicalTableID=232] [startKey=7480000000000000e85f728000000000000001] [endKey=7480000000000000e85f7280000000004e5a75]
[2024/04/09 09:40:33.611 +08:00] [INFO] [backfilling.go:398] ["[ddl] split table range from PD"] [physicalTableID=232] ["start key"=7480000000000000e85f728000000000000001] ["end key"=7480000000000000e85f7280000000004e5a75]
[2024/04/09 09:40:33.611 +08:00] [INFO] [backfilling.go:724] ["[ddl] start backfill workers to reorg record"] [type="add index"] [workerCnt=4] [regionCnt=12] [startKey=7480000000000000e85f728000000000000001] [endKey=7480000000000000e85f7280000000004e5a75]
[2024/04/09 09:40:33.658 +08:00] [INFO] [backfilling.go:566] ["[ddl] get backfill range task, change end key"] [id=9] [pTbl=232] ["end key"=7480000000000000e85f72800000000039e153] ["current end key"=7480000000000000e85f72800000000039e153]
...
[2024/04/09 09:40:33.674 +08:00] [INFO] [backfilling.go:566] ["[ddl] get backfill range task, change end key"] [id=12] [pTbl=232] ["end key"=7480000000000000e85f7280000000004e5a75] ["current end key"=7480000000000000e85f7280000000004e5a75]
[2024/04/09 09:40:50.042 +08:00] [INFO] [checkpoint.go:376] ["[ddl-ingest] update checkpoint"] ["job ID"=257] ["index ID"=1] ["local checkpoint"=7480000000000000e85f7280000000004e5a75] ["global checkpoint"=] ["global physical ID"=232] []

-- upgrade and ddl owner switches to new tidb

[2024/04/09 09:42:28.303 +08:00] [INFO] [checkpoint.go:326] ["resume checkpoint"] [category=ddl-ingest] ["job ID"=257] ["index IDs"="[1]"] ["local checkpoint"=] ["global checkpoint"=] ["physical table ID"=232] ["previous instance"=tidb-3-peer:4000:/tmp/tidb] ["current instance"=tidb-1-peer:4000:/tmp/tidb]
[2024/04/09 09:42:28.352 +08:00] [INFO] [backfilling.go:396] ["split table range from PD"] [category=ddl] [physicalTableID=232] ["start key"=7480000000000000e85f728000000000000001] ["end key"=7480000000000000e85f7280000000004e5a75]
[2024/04/09 09:42:28.352 +08:00] [INFO] [backfilling.go:723] ["start backfill workers to reorg record"] [category=ddl] [type="add index"] [workerCnt=4] [regionCnt=12] [startKey=7480000000000000e85f728000000000000001] [endKey=7480000000000000e85f7280000000004e5a75]
[2024/04/09 09:42:28.362 +08:00] [INFO] [backfilling.go:575] ["get backfill range task, change end key"] [category=ddl] [id=1] [pTbl=232] ["end key"=7480000000000000e85f728000000000066aa0] ["current end key"=7480000000000000e85f728000000000066a9f00]
...
[2024/04/09 09:42:28.464 +08:00] [INFO] [backfilling.go:575] ["get backfill range task, change end key"] [category=ddl] [id=12] [pTbl=232] ["end key"=7480000000000000e85f7280000000004e5a75] ["current end key"=7480000000000000e85f7280000000004e5a7400]

Same as #47818, the end key is not considered included. #47818 does not fix this because the end key of reorg info is overwritten in overwriteReorgInfoFromGlobalCheckpoint.

What changed and how does it work?

Adjust end key of reorg info after resuming from checkpoint.

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 added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 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 Apr 9, 2024
Copy link

codecov bot commented Apr 9, 2024

Codecov Report

❗ No coverage uploaded for pull request base (release-7.5@428670a). Click here to learn what that means.
The diff coverage is 100.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-7.5     #52458   +/-   ##
================================================
  Coverage               ?   71.9935%           
================================================
  Files                  ?       1410           
  Lines                  ?     409434           
  Branches               ?          0           
================================================
  Hits                   ?     294766           
  Misses                 ?      94847           
  Partials               ?      19821           
Flag Coverage Δ
unit 71.9935% <100.0000%> (?)

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

Components Coverage Δ
dumpling 53.9913% <0.0000%> (?)
parser ∅ <0.0000%> (?)
br 53.3668% <0.0000%> (?)

@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Apr 9, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 10, 2024
Copy link

ti-chi-bot bot commented Apr 10, 2024

@wjhuang2016: Your lgtm message is repeated, so it is ignored.

In response to this:

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
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Apr 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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

ti-chi-bot bot commented Apr 10, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-10 06:02:38.987674785 +0000 UTC m=+1028620.515215331: ☑️ agreed by wjhuang2016.
  • 2024-04-10 06:34:03.046567284 +0000 UTC m=+1030504.574107815: ☑️ agreed by zimulala.

@ti-chi-bot ti-chi-bot bot merged commit 2ecc47d into pingcap:release-7.5 Apr 10, 2024
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/S Denotes a PR that changes 10-29 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.

4 participants