Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
73786: kvserver: document writeStats semantics r=nvanbenschoten a=tbg Because they're weird. We are summing up these two: https://github.com/cockroachdb/cockroach/blob/afb50d6227e78daa72ac8fa08222bc58a5767648/pkg/kv/kvserver/replica_application_state_machine.go#L929-L928 https://github.com/cockroachdb/cockroach/blob/afb50d6227e78daa72ac8fa08222bc58a5767648/pkg/kv/kvserver/replica_application_state_machine.go#L644-L646 Oddness: - the first and the second often measure the same thing, so we're double counting: a `Put(x)` will result in a mutation but may also result in a key being added, so we're recording that effect twice. - a `Put(x)` on an existing key will only be counted in `b.mutations` so it counts only once. - AddSSTable is only reflected in the second one, but the `KeyCount` could be an estimate (or so I believe; not 100% sure). - `b.mutations` also contains update to `RangeAppliedState`, so it's counting at least one mutation per batch. Overall, the writes per second have to be taken with the grain of salt that they will in practice over-count by a factor of anywhere between one and three, the extreme case being a `Put` that creates a new key, which will have a contribution of one `RangeAppliedState` write, one `KeyCount`, and the actual mutation in the batch. Touches cockroachdb#73731. Touches cockroachdb#42277. Release note: None Co-authored-by: Tobias Grieger <[email protected]>
- Loading branch information