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: remove mock.Context usage in addIndexIngestWorker #53479

Merged
merged 1 commit into from
May 28, 2024

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #53388

Problem Summary:

see description in issue.

What changed and how does it work?

  • remove the usage of mock.Context in addIndexIngestWorker
  • separate some codes into several functions in initSessCtx

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 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 May 22, 2024
Copy link

tiprow bot commented May 22, 2024

Hi @lcwangchao. 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-sigs/prow repository.

Comment on lines -475 to -512
sessCtx, err := newSessCtx(reorgInfo.d.store, reorgInfo.ReorgMeta.SQLMode, reorgInfo.ReorgMeta.Location, reorgInfo.ReorgMeta.ResourceGroupName)
if err != nil {
b.sendResult(&backfillResult{err: err})
return nil
}
Copy link
Collaborator Author

@lcwangchao lcwangchao May 22, 2024

Choose a reason for hiding this comment

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

newAddIndexIngestWorker is only called by createWorker, so we moved the context construction to newAddIndexIngestWorker.

One difference is that if it fails to construct the context, the previous code will always call b.sendResult but the current code will check writerMaxID:

if b.writerMaxID == 0 {
	b.sendResult(&backfillResult{err: err})
	return nil
}

Maybe the previous code lost it? PTAL @tangenta

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, LGTM

@lcwangchao lcwangchao force-pushed the addindexingestworkermockctx branch from 3b92ef4 to 0ae6ac4 Compare May 22, 2024 07:34
@lcwangchao lcwangchao force-pushed the addindexingestworkermockctx branch 3 times, most recently from 616d4fe to ea942ff Compare May 22, 2024 07:49
Copy link

codecov bot commented May 22, 2024

Codecov Report

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

Project coverage is 74.6694%. Comparing base (4a51974) to head (ac4ec62).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53479        +/-   ##
================================================
+ Coverage   70.8824%   74.6694%   +3.7869%     
================================================
  Files          1506       1506                
  Lines        412222     431723     +19501     
================================================
+ Hits         292193     322365     +30172     
+ Misses       100640      89512     -11128     
- Partials      19389      19846       +457     
Flag Coverage Δ
integration 49.2671% <83.8709%> (?)
unit 71.6683% <83.8709%> (+1.8572%) ⬆️

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

Components Coverage Δ
dumpling 53.9957% <ø> (-2.3014%) ⬇️
parser ∅ <ø> (∅)
br 50.4606% <ø> (+6.9078%) ⬆️

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

@YangKeao YangKeao 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 May 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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 May 28, 2024
Copy link

ti-chi-bot bot commented May 28, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-28 07:54:08.018980709 +0000 UTC m=+2763001.776116276: ☑️ agreed by tangenta.
  • 2024-05-28 10:49:17.735612375 +0000 UTC m=+2773511.492747971: ☑️ agreed by YangKeao.

@lcwangchao lcwangchao force-pushed the addindexingestworkermockctx branch from ea942ff to ac4ec62 Compare May 28, 2024 14:05
@ti-chi-bot ti-chi-bot bot merged commit e560d03 into pingcap:master May 28, 2024
21 checks passed
@lcwangchao lcwangchao deleted the addindexingestworkermockctx branch May 29, 2024 01:14
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. 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.

remove mock.Context usage in production code
3 participants