Skip to content

examples: add changefeed_health collection + integration tests - #294

Merged
sravotto merged 3 commits into
mainfrom
sr8/cdc-query
Oct 14, 2026
Merged

sravotto merged 3 commits into
mainfrom
sr8/cdc-query

Conversation

@sravotto

@sravotto sravotto commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Monitors changefeed lag and orphaned protected timestamp records.

Add integration test running every examples/ collection.

Also fixes schema-drift bugs the new test caught:

  • examples/intents.yaml: crdb_internal.ranges_no_leases no longer has a table_id column as of v25.3+, so the table id is now parsed out of start_pretty.
  • examples/sqlefficiency.yaml: CockroachDB v26.3 removed crdb_internal.node_statement_statistics.implicit_txn with no replacement (sqlstats: remove implicit as part of stmt fingerprint id cockroachdb/cockroach#141862), so the "explicitlio" bucket is dropped.
  • examples/cluster_sqlactivity.yaml: v26.3 added a native database column to crdb_internal.statement_statistics, which collided with the query's metadata->'db' as database alias and broke GROUP BY; renamed the intermediate alias to db_name.

Co-Authored-By: roachdev-claude roachdev-claude-bot@cockroachlabs.com

Monitors changefeed lag and orphaned protected timestamp records.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@sravotto sravotto changed the title examples: add changefeed_health collection examples: add changefeed_health collection + integration tests Sep 25, 2026
Runs each examples/*.yaml collection against a real CockroachDB
cluster, catching query/schema drift (label or metric counts drifting
from a query's actual columns).

Also fixes schema-drift bugs the new test caught:
- examples/intents.yaml: crdb_internal.ranges_no_leases no longer has
  a table_id column as of v25.3+, so the table id is now parsed out of
  start_pretty. The test itself only checks the query runs, since
  CockroachDB v26.3's write buffering can keep an open write from
  showing up as a replicated intent.
- examples/sqlefficiency.yaml: CockroachDB v26.3 removed
  crdb_internal.node_statement_statistics.implicit_txn with no
  replacement (cockroachdb/cockroach#141862), so the "explicitlio"
  bucket is dropped.
- examples/cluster_sqlactivity.yaml: v26.3 added a native database
  column to crdb_internal.statement_statistics, which collided with
  the query's metadata->'db' as database alias and broke GROUP BY;
  renamed the intermediate alias to db_name.

Adds testutil.SupportsAllowUnsafeInternals, which checks
CRDB_TEST_SERIES against a v25.1 floor so the new test runs on
CockroachDB v24.3 instead of failing when allow_unsafe_internals is
unrecognized there.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@sravotto
sravotto marked this pull request as ready for review September 28, 2026 19:04
The examples integration test ran as root, which hid the privileges an
operator actually has to grant. Each case now runs as a role holding only
what "visus init" provisions (VIEWACTIVITY), plus the extras declared by a
new setupPermission hook, and every examples/*.yaml states those extras in
a comment at the top.

Running restricted surfaced two gaps on CockroachDB v24.3:
crdb_internal.tables and cluster_contended_tables omit rows for tables the
role can't read, so contended_tables.yaml and index_usage.yaml returned no
samples. v25.4 and later don't filter.

Also drops the orphaned gauge from changefeed_health.yaml. Its CTE flagged
protected timestamp records from any job type, so a paused backup read as
an orphaned changefeed, and the reconciler already clears records whose job
is missing or terminal. protected_ts.yaml covers protected timestamp age
cluster-wide. lag_seconds now converts the high-water mark with
hlc_to_timestamp; the old division truncated to whole seconds and could
report a negative lag.

Raises the SupportsAllowUnsafeInternals floor from v25.1 to v25.4, the
series that actually introduced allow_unsafe_internals.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@sravotto
sravotto merged commit 20b0a34 into main Oct 14, 2026
10 checks passed
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