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

import into: precheck and register to pd #44313

Merged
merged 8 commits into from
Jun 7, 2023
Merged

Conversation

D3Hunter
Copy link
Contributor

What problem does this PR solve?

Issue Number: ref #42930

Problem Summary:

What is changed and how it works?

  • register import task to pd
  • precheck whether CDC or PiTR tasks exists

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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
Copy link

ti-chi-bot bot commented May 31, 2023

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added 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. labels May 31, 2023
@D3Hunter D3Hunter requested review from lance6716 and GMHDBJD June 1, 2023 02:07
} else {
// if the task is run distributively, like IMPORT INTO, we should refresh the lease ID,
// in case the owner changed during the registration, and the new owner create the key.
tr.curLeaseID = clientv3.LeaseID(resp.Kvs[0].Lease)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it want to prevent that, the new leader overwrites the key, but some peers are still keepalive for the overwritten key?

Copy link
Contributor Author

@D3Hunter D3Hunter Jun 2, 2023

Choose a reason for hiding this comment

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

yes, other tidb might keeps a stale lease id, although this case seems ok to report err

disttask/loaddata/dispatcher.go Outdated Show resolved Hide resolved
type flowHandle struct {
mu sync.RWMutex
// the last time we switch TiKV into IMPORT mode, this is a global operation, do it for one task makes
// no difference to do it for all tasks. So we do not need to record the switch time for each task.
lastSwitchTime atomic.Time

// taskInfoMap is a map from taskID to taskInfo
taskInfoMap sync.Map
}

var _ dispatcher.TaskFlowHandle = (*flowHandle)(nil)

func (h *flowHandle) OnTicker(ctx context.Context, task *proto.Task) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this callback function be called concurrently by framework 🤔 Maybe no need to use sync.Map

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, there's one detect routine for each task in framework(detectTask

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am considering to remove all sync, since we only allow 1 load task right now.

info.register(ctx)
}

func (h *flowHandle) unregisterTask(ctx context.Context, task *proto.Task) {
Copy link
Contributor

Choose a reason for hiding this comment

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

will the framework make sure no registerTask is called after unregisterTask is returned? And will they be concurrently called?

Copy link
Contributor Author

@D3Hunter D3Hunter Jun 2, 2023

Choose a reason for hiding this comment

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

yes, unregisterTask is called when task finished or met error, registerTask when not finished and no error

same task no, different task yes.

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 6, 2023
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 7, 2023
@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jun 7, 2023

/run-integration-br-test

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 7, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jun 7, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 7, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-06-07 08:27:52.60951859 +0000 UTC m=+79564.454153188: ☑️ agreed by GMHDBJD.
  • 2023-06-07 09:58:27.983098081 +0000 UTC m=+84999.827732665: ☑️ agreed by lance6716.

@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jun 7, 2023

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2023
@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jun 7, 2023

/run-integration-br-test

@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jun 7, 2023

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2023
@D3Hunter
Copy link
Contributor Author

D3Hunter commented Jun 7, 2023

run-integration-br-test is not part of this pr test, so can be skipped

@ti-chi-bot ti-chi-bot bot merged commit 20a442f into master Jun 7, 2023
@ti-chi-bot ti-chi-bot bot deleted the precheck-import-into branch June 7, 2023 12:19
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants