-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #14078 +/- ##
=======================================
Coverage 75.22% 75.22%
=======================================
Files 452 452
Lines 36791 36791
=======================================
Hits 27675 27675
Misses 7379 7379
Partials 1737 1737
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
cc @serathius @ptabor @spzala another minor fix |
server/lease/lessor.go
Outdated
@@ -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{} |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm Thanks @ahrtr
Thanks @spzala . It's very minor change, and should be safe, so will merge it. |
Fix a minor issue, which was discovered during code review.