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

cluster: no more redundant etcd writes when ReportMinResolvedTS is called #5966

Merged
merged 7 commits into from
Feb 13, 2023

Conversation

HunDunDM
Copy link
Member

@HunDunDM HunDunDM commented Feb 10, 2023

Signed-off-by: HunDunDM hundundm@gmail.com

What problem does this PR solve?

Issue Number: Close #5965

What is changed and how does it work?

no more redundant etcd writes when SetMinResolvedTS is called

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
    • This PR is based on c64be1f
    • Make putStoreLocked called by SetMinResolvedTS slower 7a47041
    • tiup playground v6.5.0 --kv=15 --db=1 --pd=1 --tiflash=0 --pd.binpath=bin/pd-server
    • The problem can be reproduced in grafana
      • image
      • image
    • putStoreLocked was removed in this PR and replaced with c.core.PutStore(newStore), so it can be considered fixed.

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch

Release note

Fixed an issue where ETCD write delay could cause PD OOM.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 10, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lhy1024
  • nolouch

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 needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 10, 2023
@HunDunDM HunDunDM requested review from nolouch and removed request for disksing and rleungx February 10, 2023 20:48
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 11, 2023
@lhy1024
Copy link
Contributor

lhy1024 commented Feb 11, 2023

do we need to pick to 6.6?

@codecov
Copy link

codecov bot commented Feb 11, 2023

Codecov Report

Base: 75.22% // Head: 75.19% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (cf30954) compared to base (5a8f93d).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head cf30954 differs from pull request most recent head 8bbf837. Consider uploading reports for the commit 8bbf837 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5966      +/-   ##
==========================================
- Coverage   75.22%   75.19%   -0.03%     
==========================================
  Files         362      362              
  Lines       36232    36231       -1     
==========================================
- Hits        27255    27244      -11     
- Misses       6601     6615      +14     
+ Partials     2376     2372       -4     
Flag Coverage Δ
unittests 75.19% <100.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
server/cluster/cluster.go 81.72% <100.00%> (+0.23%) ⬆️
pkg/dashboard/keyvisual/input/core.go 0.00% <0.00%> (-33.34%) ⬇️
pkg/election/leadership.go 75.25% <0.00%> (-5.16%) ⬇️
server/schedule/labeler/rules.go 87.50% <0.00%> (-2.28%) ⬇️
pkg/tso/allocator_manager.go 64.35% <0.00%> (-1.62%) ⬇️
pkg/member/member.go 65.78% <0.00%> (-1.58%) ⬇️
pkg/tso/tso.go 68.53% <0.00%> (-1.13%) ⬇️
server/schedule/operator/step.go 76.62% <0.00%> (-0.68%) ⬇️
server/server.go 74.24% <0.00%> (-0.63%) ⬇️
server/cluster/coordinator.go 71.78% <0.00%> (-0.57%) ⬇️
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

better to add a test. could you add a test or post the manual test result.

@HunDunDM
Copy link
Member Author

Adding unit tests to the removed code was difficult, I added a manual test to prove that the original code was buggy.

@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 Feb 13, 2023
@nolouch
Copy link
Contributor

nolouch commented Feb 13, 2023

/merge

@ti-chi-bot
Copy link
Member

@nolouch: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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.

@ti-chi-bot
Copy link
Member

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

Commit hash: cf30954

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 13, 2023
@CabinfeverB
Copy link
Member

It seems that we don't need to persist store in SetMinResolvedTS, and persist it only in heartbeat?
What happens if the PD goes down after SetMinResolvedTS?

@lhy1024
Copy link
Contributor

lhy1024 commented Feb 13, 2023

It seems that we don't need to persist store in SetMinResolvedTS, and persist it only in heartbeat? What happens if the PD goes down after SetMinResolvedTS?

we persist min-resolved-ts of the cluster in another goroutine

@lhy1024
Copy link
Contributor

lhy1024 commented Feb 13, 2023

/run-all-tests

@ti-chi-bot
Copy link
Member

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

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.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #5978.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #5979.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.6: #5980.

ti-chi-bot added a commit that referenced this pull request Feb 14, 2023
…called (#5966) (#5978)

close #5965, ref #5966

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot added a commit that referenced this pull request Feb 14, 2023
…called (#5966) (#5979)

close #5965, ref #5966

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
ti-chi-bot added a commit that referenced this pull request Feb 14, 2023
…called (#5966) (#5980)

close #5965, ref #5966

Signed-off-by: HunDunDM <hundundm@gmail.com>

Co-authored-by: HunDunDM <hundundm@gmail.com>
Co-authored-by: ShuNing <nolouch@gmail.com>
@nolouch nolouch deleted the fix-5965 branch February 14, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-6.6 release-note Denotes a PR that will be considered when it comes time to generate release notes. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Frequent ReportMinResolvedTS can cause PD OOM
5 participants