cockroachdb / cockroachdb/cockroach

sql: minor overestimate of leaf txn reads set

Open
#151,852 1 comment 0 reactions 1 assignee Claimed by @ZhouXing19 View on GitHub
C-bug E-quick-win O-qa T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

When building the interval tree describing the set of reads a leaf txn may do, we currently use `PrefixEnd()` to obtain the exclusive end bound for a table reader's `GetRequest`: https://github.com/cockroachdb/cockroach/blob/73df2d948c126c07732e1632cdcc753bc22ef439/pkg/sql/distsql_leaf_txn.go#L81-L83
We should be using `key.Next()` instead, and include only the start key in the interval instead of all keys beginning with the start key as a prefix.

This is not a correctness bug, but may result in tracking more writes than needed for leaf transactions.

Jira issue: CRDB-53492

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.