Skip to content

sql: add descriptors.json and schema_changes.txt to stmtbundle#170622

Open
virajchogle wants to merge 1 commit into
cockroachdb:masterfrom
virajchogle:stmtbundle-descriptors-170491
Open

sql: add descriptors.json and schema_changes.txt to stmtbundle#170622
virajchogle wants to merge 1 commit into
cockroachdb:masterfrom
virajchogle:stmtbundle-descriptors-170491

Conversation

@virajchogle
Copy link
Copy Markdown

When investigating optimizer surprises, the bundle reviewer often needs to rule out schema-state interactions. Two new files help: descriptors.json with the pretty-printed JSON for each descriptor used by the statement, and schema_changes.txt with the recent schema-change job history for those descriptors.

The declarative schema changer drains payload.DescriptorIDs as targets complete, so completed declarative jobs have an empty descriptorIds field. PrintSchemaChanges therefore also matches the descriptor's fully-qualified name against the job's description text.

Verified manually on a single-node demo cluster:

  • ALTER TABLE ... ADD COLUMN and CREATE INDEX (declarative schema changer) both appear in schema_changes.txt with status, timestamp, and description.
  • descriptors.json shows the table descriptor with the new column and secondary index.
  • EXPLAIN ANALYZE (DEBUG, REDACT) replaces both files with the omitted-in-redacted-bundle placeholder and does not emit errors.txt.
  • EXPLAIN ANALYZE (DEBUG) SELECT count(*) FROM pg_catalog.pg_class produces clean empty-state placeholders (no errors.txt).

Fixes: #170491
Epic: None
Release note (general change): Statement bundles produced by EXPLAIN ANALYZE (DEBUG) now include descriptors.json (pretty-printed descriptor JSON for each object used by the statement) and schema_changes.txt (recent schema-change history for those descriptors).

@michae2

When investigating optimizer surprises, the bundle reviewer often
needs to rule out schema-state interactions. Two new files help:
descriptors.json with the pretty-printed JSON for each descriptor
used by the statement, and schema_changes.txt with the recent
schema-change job history for those descriptors.

The declarative schema changer drains payload.DescriptorIDs as
targets complete, so completed declarative jobs have an empty
descriptorIds field. PrintSchemaChanges therefore also matches the
descriptor's fully-qualified name against the job's description
text.

Fixes: cockroachdb#170491
Epic: None
Release note (general change): Statement bundles produced by EXPLAIN
ANALYZE (DEBUG) now include descriptors.json (pretty-printed
descriptor JSON for each object used by the statement) and
schema_changes.txt (recent schema-change history for those
descriptors).
@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented May 20, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@blathers-crl
Copy link
Copy Markdown

blathers-crl Bot commented May 20, 2026

Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

I have added a few people who may be able to assist in reviewing:

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl Bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels May 20, 2026
@blathers-crl blathers-crl Bot requested a review from michae2 May 20, 2026 07:53
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-community Originated from the community X-blathers-triaged blathers was able to find an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stmtbundle: add recent schema changes and descriptor JSON

2 participants