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

jobmaster(engine/dm): fix empty worker status for OnWorkerOnline/OnWorkerOffline #7689

Merged
merged 7 commits into from
Nov 23, 2022

Conversation

GMHDBJD
Copy link
Contributor

@GMHDBJD GMHDBJD commented Nov 22, 2022

What problem does this PR solve?

Issue Number: close #7691

What is changed and how it works?

  • ignore nil extra status bytes for OnWorkerOnline

Check List

Tests

  • Unit test
  • Integration test

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 22, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei
  • lance6716

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 added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 22, 2022
@amyangfei
Copy link
Contributor

/run-engine-integration-test

@GMHDBJD GMHDBJD added status/ptal Could you please take a look? area/engine Issues or PRs related to Dataflow Engine. labels Nov 22, 2022
@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Nov 22, 2022

/run-engine-integration-test

@amyangfei
Copy link
Contributor

/run-engine-integration-test

@@ -189,9 +189,14 @@ func (jm *JobMaster) OnWorkerOnline(worker framework.WorkerHandle) error {

// handleOnlineStatus is used by OnWorkerOnline and OnWorkerStatusUpdated.
func (jm *JobMaster) handleOnlineStatus(worker framework.WorkerHandle) error {
extBytes := worker.Status().ExtBytes
if len(extBytes) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can remove the usage of OnWorkerOnline callback, only use OnWorkerStatusUpdated? That is to say, because DM needs bussiness online message with worker bound information, plain framework online is no use

Copy link
Contributor

Choose a reason for hiding this comment

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

What if OnWorkerStatusUpdated is not called because the message is discarded for some reasons, like buffer full?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

worker will be regard as offline after 2*HeartbeatInterval.

} else if worker.CreateFailed() {

@@ -201,24 +206,28 @@ func (jm *JobMaster) handleOnlineStatus(worker framework.WorkerHandle) error {

// OnWorkerOffline implements JobMasterImpl.OnWorkerOffline
func (jm *JobMaster) OnWorkerOffline(worker framework.WorkerHandle, reason error) error {
extBytes := worker.Status().ExtBytes
if len(extBytes) == 0 {
jm.Logger().Warn("worker status extBytes is empty", zap.String(logutil.ConstFieldWorkerKey, worker.ID()))
Copy link
Contributor

@lance6716 lance6716 Nov 23, 2022

Choose a reason for hiding this comment

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

it should not happen, otherwise we have no chance to UpdateClient. Maybe we can use DPanic level and let the logger turn on Development for DPanic

Development: inDev,

Copy link
Contributor

@amyangfei amyangfei Nov 23, 2022

Choose a reason for hiding this comment

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

Let me check whether OnWorkerOffline can happen without receiving OnWorkerOnline

Copy link
Contributor

Choose a reason for hiding this comment

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

I left a function comment as

// Only after OnWorkerOnline, OnWorkerOffline of the same worker may be called.

Please help modify it if's no longer correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may happen when we receive OnWorkerOnline, OnWorkerOffline but not receiving OnWorkerStatusUpdate

Copy link
Contributor

@amyangfei amyangfei Nov 23, 2022

Choose a reason for hiding this comment

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

Have confirmed, the comment needs to be updated.

  • OnWorkerOnline -> OnWorkerOffline
  • OnWorkerOffline, without OnWorkerOnline
  • OnWorkerOffline -> OnWorkerOnline, can't happen
  • OnWorkerOnline, without OnWorkerOffline, can't happen.

err := json.Unmarshal(workerHandle.Status().ExtBytes, &taskStatus)
extBytes := workerHandle.Status().ExtBytes
if len(extBytes) == 0 {
return nil, nil, errors.Errorf("extBytes of %d is empty", workerHandle.ID())
Copy link
Contributor

Choose a reason for hiding this comment

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

we can continue to waiting worker's UpdateStatus?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

restart and recover until worker's UpdateStatusEvent

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 23, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 23, 2022
@amyangfei
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 9700119

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 23, 2022
@ti-chi-bot
Copy link
Member

@GMHDBJD: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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.

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2022

Codecov Report

Merging #7689 (7e2e6be) into master (bf9e9ad) will increase coverage by 0.0145%.
The diff coverage is 26.7281%.

Additional details and impacted files
Flag Coverage Δ
dm 52.1552% <ø> (-0.0075%) ⬇️
engine 64.0328% <38.0000%> (+0.0104%) ⬆️

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

@@               Coverage Diff                @@
##             master      #7689        +/-   ##
================================================
+ Coverage   59.9132%   59.9277%   +0.0145%     
================================================
  Files           810        809         -1     
  Lines         93098      93052        -46     
================================================
- Hits          55778      55764        -14     
+ Misses        32472      32427        -45     
- Partials       4848       4861        +13     

@ti-chi-bot ti-chi-bot merged commit 7c67feb into pingcap:master Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engine Issues or PRs related to Dataflow Engine. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. status/ptal Could you please take a look?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DM job master meets unexpected end of JSON input error can't recover
6 participants