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

[close #343]fix cdc residue metrics #342

Merged
merged 7 commits into from
Jun 2, 2023

Conversation

zeminzhou
Copy link
Contributor

@zeminzhou zeminzhou commented May 29, 2023

What problem does this PR solve?

Issue Number: close #343

Problem Description: TBD

What is changed and how does it work?

clean metrics againt

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

Check List for Tests

This PR has been tested by at least one of the following methods:

  • Unit test
  • Integration test

Side effects

  • No side effects

Related changes

  • No related changes

To reviewers

Please follow these principles to check this pull requests:

  • Concentration. One pull request should only do one thing. No matter how small it is, the change does exactly one thing and gets it right. Don't mix other changes into it.
  • Tests. A pull request should be test covered, whether the tests are unit tests, integration tests, or end-to-end tests. Tests should be sufficient, correct and don't slow down the CI pipeline largely.
  • Functionality. The pull request should implement what the author intends to do and fit well in the existing code base, resolve a real problem for TiDB/TiKV users. To get the author's intention and the pull request design, you could follow the discussions in the corresponding GitHub issue or internal.tidb.io topic.
  • Style. Code in the pull request should follow common programming style. (For Go, we have style checkers in CI). However, sometimes the existing code is inconsistent with the style guide, you should maintain consistency with the existing code or file a new issue to fix the existing code style first.
  • Documentation. If a pull request changes how users build, test, interact with, or release code, you must check whether it also updates the related documentation such as READMEs and any generated reference docs. Similarly, if a pull request deletes or deprecates code, you must check whether or not the corresponding documentation should also be deleted.
  • Performance. If you find the pull request may affect performance, you could ask the author to provide a benchmark result.

(The above text mainly refers to TiDB Development Guide. It's also highly recommended to read about Writing code review comments)

@zeminzhou
Copy link
Contributor Author

/unit_test_in_verify_ci

@zeminzhou zeminzhou changed the title fix cdc residue metrics [close #343]fix cdc residue metrics May 30, 2023
@@ -199,6 +199,14 @@ func (o *Owner) Tick(stdCtx context.Context, rawState orchestrator.ReactorState)
return state, nil
}

// Close try to close the owner when the owner is not running.
// Note: This method must not be called with `Tick`. Please be careful.
func (o *Owner) Close(ctx cdcContext.Context) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest to name as CloseAllCaptures, as we are not closing Owner here.

Here has similar code block, suggest to reuse this function.

(And maybe we also need the wrapper of context.)

At last, we need to double check about the thread-safety.

@@ -155,6 +155,14 @@ func (m *Manager) sendCommand(tp commandTp, payload interface{}) chan struct{} {
return cmd.done
}

// Close closes all processors.
// Note: This method must not be called with `Tick`. Please be careful.
func (m *Manager) Close() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest to name as SyncClose, and reuse in handling of commandTpClose command.

Copy link
Contributor

@haojinming haojinming left a comment

Choose a reason for hiding this comment

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

LGTM

zeminzhou added 2 commits May 31, 2023 17:59
Signed-off-by: zeminzhou <[email protected]>
Signed-off-by: zeminzhou <[email protected]>
@pingyu
Copy link
Collaborator

pingyu commented Jun 1, 2023

/run-unit-test

1 similar comment
@pingyu
Copy link
Collaborator

pingyu commented Jun 1, 2023

/run-unit-test

Signed-off-by: zeminzhou <[email protected]>
@pingyu
Copy link
Collaborator

pingyu commented Jun 1, 2023

/run-integration-test

@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Merging #342 (4ea2f59) into main (73d4378) will decrease coverage by 0.1521%.
The diff coverage is 20.0000%.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##               main       #342        +/-   ##
================================================
- Coverage   61.0648%   60.9127%   -0.1521%     
================================================
  Files           240        240                
  Lines         20285      20334        +49     
================================================
- Hits          12387      12386         -1     
- Misses         6778       6829        +51     
+ Partials       1120       1119         -1     
Flag Coverage Δ *Carryforward flag
br 60.5320% <ø> (ø) Carriedforward from 2638415
cdc 61.0887% <20.0000%> (-0.2233%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
cdc/cdc/capture/capture.go 0.0000% <0.0000%> (ø)
cdc/cdc/owner/owner.go 59.5890% <0.0000%> (-0.4110%) ⬇️
cdc/cdc/processor/manager.go 78.0219% <0.0000%> (-2.6599%) ⬇️
cdc/cdc/processor/processor.go 65.3562% <100.0000%> (+0.7523%) ⬆️

... and 11 files with indirect coverage changes

@pingyu
Copy link
Collaborator

pingyu commented Jun 1, 2023

/run-integration-test

2 similar comments
@pingyu
Copy link
Collaborator

pingyu commented Jun 2, 2023

/run-integration-test

@pingyu
Copy link
Collaborator

pingyu commented Jun 2, 2023

/run-integration-test

Signed-off-by: zeminzhou <[email protected]>
Copy link
Collaborator

@pingyu pingyu left a comment

Choose a reason for hiding this comment

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

LGTM~

@pingyu pingyu merged commit 37f5972 into tikv:main Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cdc: can't clean metrics when owner/processor quit unexpectedly
3 participants