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: only unregister backendCtx after deliver job worker for local mode #54177

Closed
wants to merge 1 commit into from

Conversation

tangenta
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #53910

Problem Summary:

The unregister() after delivery2Worker() may conflict with the executor of the DXF.

When DXF executor starts to import:

localEngine := local.engineMgr.lockEngine(engineUUID, importMutexStateImport)

And tidb receives SigKill, ddl workers exit first, calling unregister(), which removes all engines from engineManager.

As a result, import executor actually does nothing, but mistakenly thinks it is successful. And the state is saved to subtask table.

What changed and how does it work?

When we use DXF, backend ctx should be owned by DXF. Other goroutines should not modify backend ctx.

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 24, 2024
Copy link

tiprow bot commented Jun 24, 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-sigs/prow repository.

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 55.9390%. Comparing base (fd2b5e9) to head (e84c523).
Report is 21 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54177         +/-   ##
=================================================
- Coverage   72.8465%   55.9390%   -16.9075%     
=================================================
  Files          1520       1644        +124     
  Lines        435101     618593     +183492     
=================================================
+ Hits         316956     346035      +29079     
- Misses        98547     248476     +149929     
- Partials      19598      24082       +4484     
Flag Coverage Δ
integration 37.4538% <66.6666%> (?)

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

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.7690% <ø> (+6.6235%) ⬆️

@tangenta
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Jun 24, 2024

@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@tangenta
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Jun 25, 2024

@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

Copy link

ti-chi-bot bot commented Jun 25, 2024

@tangenta: The following tests 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/unit-test e84c523 link true /test unit-test
idc-jenkins-ci-tidb/check_dev_2 e84c523 link true /test check-dev2

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.

@@ -537,7 +537,9 @@ func (s *jobScheduler) delivery2Worker(wk *worker, pool *workerPool, job *model.
s.runningJobs.removeRunning(jobID, involvedSchemaInfos)
asyncNotify(s.ddlJobNotifyCh)
metrics.DDLRunningJobCount.WithLabelValues(pool.tp().String()).Dec()
if wk.ctx.Err() != nil && ingest.LitBackCtxMgr != nil {
if wk.ctx.Err() != nil && ingest.LitBackCtxMgr != nil &&
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 add some test cases?

Copy link
Collaborator

Choose a reason for hiding this comment

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

rest LGTM

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 26, 2024
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

Copy link

ti-chi-bot bot commented Jun 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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

ti-chi-bot bot commented Jun 26, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-06-26 03:44:55.777850887 +0000 UTC m=+777622.263339720: ☑️ agreed by D3Hunter.
  • 2024-06-26 06:01:20.715760482 +0000 UTC m=+785807.201249315: ☑️ agreed by Benjamin2037.

@tangenta
Copy link
Contributor Author

Closed by #54149

@tangenta tangenta closed this Jun 26, 2024
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
3 participants