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: check local file existence before resume checkpoint #53072

Merged
merged 4 commits into from
May 7, 2024

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented May 7, 2024

What problem does this PR solve?

Issue Number: close #53009

Problem Summary:

What changed and how does it work?

  • use word "flushed"/"imported" to replace "local"/"global" to unify the terminology with lightning engine
  • rename some methods
  • remove FlushModeForceLocalAndCheckDiskQuota because it's not used
  • use ctx to detect the closing of CheckpointManager and let other goroutine communications check the context
  • add a tagged logger to CheckpointManager
  • remove updating field because only one goroutine calls updateCheckpoint

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

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot added release-note-none size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 7, 2024
@lance6716
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test label May 7, 2024
Signed-off-by: lance6716 <lance6716@gmail.com>
Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 87.14286% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 72.2304%. Comparing base (b6435d1) to head (c7075ee).
Report is 4 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53072        +/-   ##
================================================
+ Coverage   72.0130%   72.2304%   +0.2173%     
================================================
  Files          1499       1508         +9     
  Lines        431223     438282      +7059     
================================================
+ Hits         310537     316573      +6036     
- Misses       101378     102014       +636     
- Partials      19308      19695       +387     
Flag Coverage Δ
integration 25.0817% <87.1428%> (?)

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 38.0644% <ø> (-0.2834%) ⬇️

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 7, 2024
Copy link
Contributor

@D3Hunter D3Hunter 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

localCnt int
globalCnt int
minKeyFlushed kv.Key
minKeyImported kv.Key
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we call it maxKeyImported, it means all keys < it are imported

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ChatGPT still prefer the minXXX


You
How to name a variable which means "all keys less than it are flushed, but the keys larger than it can be flushed or not flushed". And it's calculated from the minimum value of some concurrency worker's progress.

ChatGPT
You might consider naming the variable something descriptive yet succinct, like "minFlushedKey" or "flushThreshold". This would indicate that it represents the minimum key value up to which all keys are flushed, but keys larger than it might or might not be flushed depending on their status. Alternatively, you could name it "minFlushedProgressKey" to be more explicit about its relationship to progress.

Here's a breakdown of each potential name:

minFlushedKey: This name clearly indicates that it represents the minimum key value that has been flushed. It suggests that any keys smaller than this value are flushed, while those larger than it may or may not be flushed.
flushThreshold: This name implies that it's a point or level that determines when flushing occurs. It's like a threshold that, once reached, triggers the flushing of keys. "FlushThreshold" conveys that keys below this threshold are flushed, while those above it may or may not be.
minFlushedProgressKey: This name explicitly links the variable to progress and flushing. It suggests that it represents the minimum key based on the progress made, and keys less than or equal to this value are considered flushed.
Choose the name that best fits the context and naming conventions of your project. The most important thing is that the name is clear and understandable to anyone reading your code.

Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think minFlushedKey suggests that any keys smaller than this value are flushed, it only states that it's the min key that have flushed and any key before or after it may or may not flushed

And it's calculated from the minimum value of some concurrency worker's progress.

from this description, we can only got a name like min key of on-going task

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about rename it to flushedKeyLowWatermark? I can do it in #52993

Copy link
Contributor

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 May 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, 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

Copy link

ti-chi-bot bot commented May 7, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-07 07:59:06.853770748 +0000 UTC m=+948900.610906315: ☑️ agreed by tangenta.
  • 2024-05-07 09:33:17.443170108 +0000 UTC m=+954551.200305679: ☑️ agreed by D3Hunter.

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot merged commit b1b0995 into pingcap:master May 7, 2024
21 checks passed
@lance6716
Copy link
Contributor Author

/cherry-pick release-8.1

@ti-chi-bot
Copy link
Member

@lance6716: new pull request created to branch release-8.1: #53083.

In response to this:

/cherry-pick release-8.1

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 ti-community-infra/tichi repository.

@wjhuang2016
Copy link
Member

/cherry-pick release-7.5

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 27, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

@wjhuang2016: new pull request created to branch release-7.5: #53577.

In response to this:

/cherry-pick release-7.5

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request could not be created: failed to create pull request against pingcap/tidb#release-7.5 from head ti-chi-bot:cherry-pick-53072-to-release-7.5: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for ti-chi-bot:cherry-pick-53072-to-release-7.5."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"}

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 27, 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 ok-to-test release-note-none size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fast reorg checkpoint has wrong prerequisite
5 participants