Skip to content

raft: use term cache for leader commit term check#143424

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
hakuuww:useTermCacheInLeaderCommitCheck
Mar 26, 2025
Merged

raft: use term cache for leader commit term check#143424
craig[bot] merged 2 commits intocockroachdb:masterfrom
hakuuww:useTermCacheInLeaderCommitCheck

Conversation

@hakuuww
Copy link
Copy Markdown
Contributor

@hakuuww hakuuww commented Mar 25, 2025

Previously, we avoided calling term(index) for leader commit term check by keeping the first entry index for the current leader term in memory, and comparing against that index. (see #137826)

Now, since we have implemented term cache
(which stores info of the current leader term's first entryID in this case), the term cache is used for that check to reduce the complexity of our code. (see #142239 )

Part of #136296
Fixes: #143362
Epic: None
Release note: None

Previously, we avoided calling term(index) for leader commit term check
by keeping the first entry index for the current leader term in memory,
and comparing against that index. (see cockroachdb#137826)

Now, since we have implemented term cache
(which stores info of the current leader term's first entryID in this
case), the term cache is used for that check to reduce the complexity
of our code. (see cockroachdb#142239 )

Part of cockroachdb#136296
Fixes: cockroachdb#143362
Epic: None
Release note: None
@hakuuww hakuuww requested a review from pav-kv March 25, 2025 15:44
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@hakuuww hakuuww marked this pull request as ready for review March 25, 2025 17:19
@hakuuww hakuuww requested a review from a team as a code owner March 25, 2025 17:19
@hakuuww hakuuww force-pushed the useTermCacheInLeaderCommitCheck branch from 2bab00d to eee2d2f Compare March 25, 2025 17:47
@hakuuww
Copy link
Copy Markdown
Contributor Author

hakuuww commented Mar 26, 2025

tyfr!

bors r=pav-kv

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 26, 2025

@craig craig bot merged commit f66151f into cockroachdb:master Mar 26, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

raft: use term cache for leader commit term check

3 participants