cockroachdb / cockroachdb/cockroach
kvserver: use termCache for term lookup after raftLog compaction
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
After implementing "`termCache`" , #136296
we can also make [this term lookup](https://github.com/cockroachdb/cockroach/blob/e87c8bdbce0486f00c3adcdffc850ea2becfd0dc/pkg/kv/kvserver/batcheval/cmd_truncate_log.go#L80) go through the term cache first.
Currently LogSnapshot() operates when both `Replica.mu` and `Replica.raftMu `are held. While GetTerm only holds `Replica.mu`.
Something to consider when implementing. May not be doable, needs investigation.
Contributor guide
Research direction
Start in pkg/kv/kvserver/batcheval/cmd_truncate_log.go at the linked term lookup, then read the termCache implementation from issue #136296 and inspect GetTerm and LogSnapshot lock requirements. Determine whether the lookup can safely consult termCache after raft log compaction; done means the safe cache-first path is implemented, or the investigation establishes why it cannot be used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases, distributed-systems
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100