kvserver: request option to prevent splitting rows in responses #73618
Labels
A-kv-server
Relating to the KV-level RPC server
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
SQL rows can be split across multiple KV pairs. During range splits, we take this into account at the MVCC level to prevent splitting a row across multiple ranges by decoding the KV pairs:
cockroach/pkg/storage/mvcc.go
Lines 3881 to 3892 in 2e038a1
However, when doing limited scans (with
MaxSpanRequestKeys
orTargetBytes
limits), the response can end up returning a partial row, causing the client to either have to discard it or run another request to complete the row. This is particularly relevant for the streaming client API in #68430.We should add a
Header
parameter that prevents these limits from splitting rows. Since these limits are now strict limits (i.e. we will discard the last value that exceedsTargetBytes
), this implies that we'll discard these partial rows to keep below the limits unless it is the first row in the result. This needs to be plumbed down into MVCC where the limits are applied:cockroach/pkg/storage/pebble_mvcc_scanner.go
Lines 714 to 719 in 0ee3bbd
Note that even though this option will currently only apply to
Scan
andReverseScan
requests, we add it toHeader
since that is where the related limits are configured.The text was updated successfully, but these errors were encountered: