cockroachdb / cockroachdb/cockroach
kv: grow propBufArray on full, instead of flushing
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
The Raft `propBuf` currently has logic to flush into the `RawNode` when it reaches its buffer capacity. This is unfortunate, as it mutates the `RawNode` without holding the `RaftMu`, which is a pattern that we'd like to avoid.
An alternative implementation would be to resize the buffer when it becomes full, instead of flushing. This would require a rework of some of the locking and blocking in `propBuf.allocateIndex`, which is complicated by the atomic access to `allocatedIdx`. Still, it seems possible and would likely leave the code in a cleaner state.
If we do this, we'll probably want to remove `propBufArrayMaxSize`.
Jira issue: CRDB-40943
Contributor guide
Assessment
This issue has not been assessed yet.