-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv: scan empty right-hand side of split for stats
See conversation in https://cockroachlabs.slack.com/archives/C0KB9Q03D/p1647551964065369. Bulk ingestion operations like IMPORT and index backfills have a fast-path for in-order ingestion where they periodically manually split and scatter the empty head of the keyspace being ingested into. In tests, we've seen that this split-and-scatter step can be expensive. This appears to be due in part to the stats recomputation we perform during range splits. Currently, this stats computation always scans the left hand side of the split. This is unfortunate for bulk-issued manual splits, because those manual splits are intentionally performed on the right border of the range, meaning that their left hand side contains the entire ~500MB range and their right hand side is empty. This commit extends the range split logic by adding a heuristic that chooses to scan the right side of the split first computing stats in cases where the right side is entirely empty. The "scan first" part is subtle, because there are cases where a split needs to scan both sides when computing stats. Specifically, it needs to do so in cases where the range has estimates in its MVCCStats. For an explanation, see `split_stats_helper.go`. It's not clear to me whether this commit is sufficient to help bulk ingestion or whether we'll need to do something about these stats estimates as well.
- Loading branch information
1 parent
e02793d
commit aa43bb4
Showing
2 changed files
with
128 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters