Skip to content

Support limiting prefixes probed for MySQL to constrain runtime - #38164

Open
peterdukelarsen wants to merge 1 commit into
pl/mysql-pk-partitioner-testsfrom
pl/mysql-partition-request-budget
Open

Support limiting prefixes probed for MySQL to constrain runtime#38164
peterdukelarsen wants to merge 1 commit into
pl/mysql-pk-partitioner-testsfrom
pl/mysql-partition-request-budget

Conversation

@peterdukelarsen

@peterdukelarsen peterdukelarsen commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Motivation

Part of SS-97.

In degenerate cases with high cardinality of first characters, many short prefixes (i.e. "a", "aa", "aaa", "aaaa"...), or unexpected bugs, we want to ensure partitioning terminates in a reasonable amount of time.

Description

Bounds the partitioner's probe traffic with a request budget derived from the table's estimated row count, via the new mysql_source_snapshot_partition_requests_per_billion_rows dyncfg (floored at 256 requests). When the budget runs out the walk stops splitting and emits coarser partitions, so cost is capped without losing correctness. The budget also serves as the hard bound on the walk for degenerate key spaces.

Adds mock tests for budget-bounded probing and for termination on non-advancing prefixes.

🤖 Generated with Claude Code

@peterdukelarsen
peterdukelarsen deleted the pl/mysql-partition-request-budget branch August 11, 2026 17:01
@peterdukelarsen
peterdukelarsen restored the pl/mysql-partition-request-budget branch August 11, 2026 17:03
@peterdukelarsen peterdukelarsen changed the title pl/mysql partition request budget storage: budget MySQL snapshot partition probing by table size Aug 11, 2026
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from f3a2461 to 90dc1b3 Compare August 11, 2026 17:26
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from 90dc1b3 to f3a000c Compare August 11, 2026 17:38
@linear-code

linear-code Bot commented Aug 11, 2026

Copy link
Copy Markdown

SS-97

@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch 8 times, most recently from 48cfbb4 to f071ccd Compare August 11, 2026 19:40
@peterdukelarsen
peterdukelarsen requested a review from a team August 11, 2026 19:40
@peterdukelarsen peterdukelarsen changed the title storage: budget MySQL snapshot partition probing by table size Support limiting prefixes probed for MySQL to constrain runtime Aug 11, 2026
@peterdukelarsen
peterdukelarsen marked this pull request as ready for review August 11, 2026 19:48
@peterdukelarsen
peterdukelarsen requested a review from a team as a code owner August 11, 2026 19:48
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from f071ccd to 1d68e03 Compare August 11, 2026 20:15
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from 1d68e03 to ecefb45 Compare August 11, 2026 22:41
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from ecefb45 to f5d757b Compare August 11, 2026 23:02
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from f5d757b to 9304f11 Compare August 11, 2026 23:35
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from 9304f11 to bcc67c6 Compare August 11, 2026 23:42
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from bcc67c6 to 1b0861e Compare August 12, 2026 00:12
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from 1b0861e to a097f1c Compare August 12, 2026 01:07
Bound the prefix partitioner to a per-table probe query budget scaled
to the estimated row count, 2500 requests per billion rows by default
via the mysql_source_snapshot_partition_requests_per_billion_rows
dyncfg, with a floor of 256 so small tables can afford their handful
of splits. Probes run sequentially, so this caps the wall-clock that
partitioning can add to snapshot start in proportion to the snapshot
work it optimizes. An exhausted budget stops splitting early and
leaves coarser buckets, never incorrect ones.

Adds a mock test asserting the partitioner never exceeds its budget
and still returns a valid ordered boundary list when truncated.
@peterdukelarsen
peterdukelarsen force-pushed the pl/mysql-partition-request-budget branch from a097f1c to c33afc9 Compare August 12, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant