cockroachdb / cockroachdb/cockroach

kv: grow propBufArray on full, instead of flushing

Open
#128,313 1 comment 0 reactions 0 assignees View on GitHub
A-kv-replication C-cleanup T-kv
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.