Repository navigation
skills/analyzing-schema-change-storage-risk: rewrite to match docs and code - #9
Merged
Merged
Conversation
…d code
The current skill is built around a "3× the largest range size" rule that
doesn't exist in CockroachDB. Engineers from the schema team flagged it as
inaccurate in [this Slack thread][thread].
Reviewing the CockroachDB source confirmed the skill's specifics are
fabricated:
- No "3× largest range" rule exists anywhere in the codebase.
- The claimed mechanism ("1× existing + 1× backfill + 1× MVCC") has no basis.
- The cited cluster setting `kv.range_split.by_load_enabled` controls
load-based range splitting, not disk-based backfill pausing. The real
mechanism is `kv.bulk_io_write.min_capacity_remaining_fraction` (default
5%), enforced on `AddSSTable` ingests; on rejection the schema change job
pauses itself via `jobs.MarkPauseRequestError`.
- The recommended SQL queries use `span_stats->>'approximate_disk_bytes'`
rather than the `range_size_mb` column the official docs recommend.
This rewrite:
- Mirrors the [official docs guidance][docs]: up to 3× the size of the
affected *table or index* as a conservative bound, not "3× the largest
range".
- Distinguishes CREATE INDEX (~1× the new index) from ALTER PRIMARY KEY
(where 3× the table is the right ballpark).
- Uses the docs-recommended `SHOW RANGES ... WITH DETAILS, KEYS, INDEXES`
query and `range_size_mb`.
- Documents the real disk-full mechanism.
- Drops `references/storage-calculations.md` entirely; its decision trees
and "common mistakes" all hinge on the removed framing.
[thread]: https://cockroachlabs.slack.com/archives/C04U1BTF8/p1777324688585579?thread_ts=1777323782.834359&cid=C04U1BTF8
[docs]: https://www.cockroachlabs.com/docs/stable/online-schema-changes#estimate-your-storage-capacity-before-performing-online-schema-changes
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current skill is built around a "3× the largest range size" rule that
doesn't exist in CockroachDB. Engineers from the schema team flagged it as
inaccurate in this Slack thread.
Reviewing the CockroachDB source confirmed the skill's specifics are
fabricated:
kv.range_split.by_load_enabledcontrolsload-based range splitting, not disk-based backfill pausing. The real
mechanism is
kv.bulk_io_write.min_capacity_remaining_fraction(default5%), enforced on
AddSSTableingests; on rejection the schema change jobpauses itself via
jobs.MarkPauseRequestError.span_stats->>'approximate_disk_bytes'rather than the
range_size_mbcolumn the official docs recommend.This rewrite:
affected table or index as a conservative bound, not "3× the largest
range".
(where 3× the table is the right ballpark).
SHOW RANGES ... WITH DETAILS, KEYS, INDEXESquery and
range_size_mb.references/storage-calculations.mdentirely; its decision treesand "common mistakes" all hinge on the removed framing.