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

Refactor: Remove redundant storage of last-quorum-acked-time in Leading.vote #1060

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Mar 17, 2024

Changelog

Refactor: Remove redundant storage of last-quorum-acked-time in Leading.vote

Previously, Leading.vote.utime() held the last timestamp acknowledged
by a quorum, marking the beginning of the leader lease. The Leading
struct updates and calculates this timestamp upon receiving an
AppendEntries reply (includes heartbeat) from a follower.

However, the leader's own timestamp was not being updated in this
process.

With this commit, we now update the leader's timestamp every time the
last-quorum-acked-time is accessed. This constant recalculation
makes storing the timestamp in Leading.vote unnecessary, hence it has
been removed to streamline the code.


This change is Reviewable

…ng.vote

Previously, `Leading.vote.utime()` held the last timestamp acknowledged
by a quorum, marking the beginning of the leader lease. The `Leading`
struct updates and calculates this timestamp upon receiving an
`AppendEntries` reply (includes heartbeat) from a follower.

However, the leader's own timestamp was not being updated in this
process.

With this commit, we now update the leader's timestamp every time the
**last-quorum-acked-time** is accessed. This constant recalculation
makes storing the timestamp in `Leading.vote` unnecessary, hence it has
been removed to streamline the code.
@drmingdrmer drmingdrmer merged commit fde9d05 into databendlabs:main Mar 17, 2024
30 of 31 checks passed
@drmingdrmer drmingdrmer deleted the 41-leader-vote branch March 17, 2024 04:19
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.

1 participant