Skip to content

test: Add integration tests for CDC table metadata#743

Open
dkropachev wants to merge 1 commit intomasterfrom
dk/cdc-table-metadata-tests
Open

test: Add integration tests for CDC table metadata#743
dkropachev wants to merge 1 commit intomasterfrom
dk/cdc-table-metadata-tests

Conversation

@dkropachev
Copy link
Copy Markdown
Collaborator

Summary

  • Add comprehensive integration tests for ScyllaDB CDC table metadata in scylla_cdc_test.go
  • 12 test scenarios covering CDC lifecycle: creation, ALTER enable/disable, options (preimage, postimage, TTL), drop propagation, cache staleness, and cold cache discovery
  • The cdc_log_table_discoverable_without_cache test subscribes to schema change events and proves ScyllaDB does send CREATED events for CDC log tables — the issue is a race with the 1s event debouncer window

Test scenarios

Test What it verifies
create_table_with_cdc_enabled CDC extension + log table appear in metadata
create_table_without_cdc No CDC extension or log table
enable_cdc_via_alter_table ALTER TABLE adds CDC extension + log table
disable_cdc_via_alter_table ALTER TABLE disabling CDC behavior
cdc_with_preimage_and_ttl CDC options reflected in metadata
alter_cdc_options Changing CDC options updates extension
cdc_log_table_discoverable_without_cache Cold cache lookup with event logging + retry
cdc_log_table_has_expected_columns CDC log columns (cdc$stream_id, cdc$time, cdc$operation)
drop_base_table_removes_cdc_log DROP removes both base + log table
drop_base_table_cdc_log_not_stale_in_cache Schema events clear cache (no manual invalidation)
scyllaIsCdcTable_detection scyllaIsCdcTable() correctly identifies CDC vs base tables
cdc_with_postimage Postimage option creates valid CDC setup

Key finding

The cdc_log_table_discoverable_without_cache test demonstrates that:

  1. ScyllaDB sends schema change events for CDC log tables
  2. ~48% of the time, the event hasn't been processed by the debouncer when GetTable is called immediately after CREATE TABLE
  3. A 1s retry always resolves it

Test plan

  • All 12 tests pass against ScyllaDB cluster (make scylla-start)
  • 100/100 runs pass with retry logic
  • Tests skip on Cassandra (CDC is a ScyllaDB-specific feature)

🤖 Generated with Claude Code

Add comprehensive integration tests for ScyllaDB CDC (Change Data
Capture) table metadata handling. Tests cover:

- CDC log table creation when base table has CDC enabled
- Table creation without CDC (negative case)
- Enabling/disabling CDC via ALTER TABLE
- CDC options: preimage, postimage, TTL
- Altering CDC options
- CDC log table column structure (cdc$stream_id, cdc$time, cdc$operation)
- Base table drop removes CDC log table
- Cache staleness after drop (schema event propagation)
- scyllaIsCdcTable detection
- Cold cache discovery of CDC log tables with event logging

The cold cache test (cdc_log_table_discoverable_without_cache)
subscribes to schema change events and logs them, proving that
ScyllaDB sends CREATED events for CDC log tables. It uses retry
with backoff to handle the event debouncer's 1s processing window.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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