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

Clean up the local variable cps so that it will not continue to schedule checkpoint #14078

Merged
merged 1 commit into from
May 30, 2022

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented May 27, 2022

Fix a minor issue, which was discovered during code review.

// Clean up the cps, otherwise it will continue to schedule
// checkpoints even after it steps down the leader position.

@codecov-commenter
Copy link

codecov-commenter commented May 27, 2022

Codecov Report

Merging #14078 (ce77d83) into main (ce77d83) will not change coverage.
The diff coverage is n/a.

❗ Current head ce77d83 differs from pull request most recent head 1d482bf. Consider uploading reports for the commit 1d482bf to get more accurate results

@@           Coverage Diff           @@
##             main   #14078   +/-   ##
=======================================
  Coverage   75.22%   75.22%           
=======================================
  Files         452      452           
  Lines       36791    36791           
=======================================
  Hits        27675    27675           
  Misses       7379     7379           
  Partials     1737     1737           
Flag Coverage Δ
all 75.22% <0.00%> (ø)

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


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce77d83...1d482bf. Read the comment docs.

@ahrtr
Copy link
Member Author

ahrtr commented May 27, 2022

cc @serathius @ptabor @spzala another minor fix

@@ -669,6 +669,9 @@ func (le *lessor) checkpointScheduledLeases() {
if len(cps) < maxLeaseCheckpointBatchSize {
return
}
// Clean up the cps, otherwise it will continue to schedule
// checkpoints even after it steps down the leader position.
cps = []*pb.LeaseCheckpoint{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to not make cps a local variable within the loop, so declare it in line 660 instead of 656 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah:), good catch. Thanks & resolved.

…e to schedule checkpoints after it steps down the leader
Copy link
Member

@spzala spzala left a comment

Choose a reason for hiding this comment

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

lgtm Thanks @ahrtr

@ahrtr
Copy link
Member Author

ahrtr commented May 30, 2022

Thanks @spzala . It's very minor change, and should be safe, so will merge it.

@ahrtr ahrtr merged commit 08f4c34 into etcd-io:main May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants