Skip to content

Seperately configure enabling CDC store for ClickHouse destination#4366

Closed
jgao54 wants to merge 3 commits into
mainfrom
cdc-store-clickhouse-destination-override
Closed

Seperately configure enabling CDC store for ClickHouse destination#4366
jgao54 wants to merge 3 commits into
mainfrom
cdc-store-clickhouse-destination-override

Conversation

@jgao54

@jgao54 jgao54 commented May 30, 2026

Copy link
Copy Markdown
Contributor
  • Introduce PEERDB_CLICKHOUSE_CDC_STORE_ENABLED to allow separating handling of cdc store enablement for ClickHouse (since other destinations like PG-to-PG and PG-to-Snowflake requires this to be enabled).
  • Still honor existing services with CDC store disabled, to avoid OOM issues resurfacing
  • Currently PEERDB_CLICKHOUSE_CDC_STORE_ENABLED is default to true, can be updated to false once we are ready to flip the switch (PR is currently a no-op)

UPDATE:

  • consolidated to just PEERDB_CDC_STORE_ENABLED, but with default value destination-specific.
  • PEERDB_CDC_STORE_ENABLED default to false for ClickHouse as destination. So we can hold off merging this PR for now until we are ready for this change.

@jgao54
jgao54 requested a review from a team as a code owner May 30, 2026 01:53
@claude

claude Bot commented May 30, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Comment thread flow/activities/flowable_core.go Outdated
return nil, err
}

dstPeerType, err := connectors.LoadPeerType(ctx, a.CatalogPool, config.DestinationName)

@jgao54 jgao54 May 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this introduces an additional query per batch, which is a bit wasteful given destination type does not change during the course of a CDCFlowWorkFlow. but the query is relatively cheap.

Alternatively we can pass in DestinationType to FlowConnectionConfigCore, but it is a bit redundant and we also have to worry about backward compatibility handling for existing workflows.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query per batch seems like a high cost to me for what it does (we're already hitting pool exhaustion on overloaded instances and #4256 is helping us counteract that). Maybe a flow env could be a place that can be set once then queried from pg connector creation and remembered as a connector field?

Overall my opinion is still that overriding the existing setting statically depending on the deployment is the lowest-code solution.

Comment thread flow/model/model.go Outdated
@jgao54
jgao54 force-pushed the cdc-store-clickhouse-destination-override branch from c474508 to 7b4078f Compare May 30, 2026 02:44
DefaultValue: "true",
ValueType: protos.DynconfValueType_BOOL,
ApplyMode: protos.DynconfApplyMode_APPLY_MODE_IMMEDIATE,
ApplyMode: protos.DynconfApplyMode_APPLY_MODE_AFTER_RESUME,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are fetching this value on the activity level, no need for apply immediate as it would not take effect anyways

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one would be fetched on the next batch? Although I'm all for moving it to activity-level

@jgao54 jgao54 Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMMEDIATE skips setting it in the env map so it would always fetch from db, but with AFTER_RESUME it will just return what's in the env (after it gets fetched/set the first time).

that env gets "reset" on a new activity, which can be achieved with pause/resume.

i guess another way to handle this is just directly populate it into config.Env ourselves, also a bit hacky

DefaultValue: "true",
ValueType: protos.DynconfValueType_BOOL,
ApplyMode: protos.DynconfApplyMode_APPLY_MODE_IMMEDIATE,
ApplyMode: protos.DynconfApplyMode_APPLY_MODE_AFTER_RESUME,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one would be fetched on the next batch? Although I'm all for moving it to activity-level

Comment thread flow/activities/flowable.go Outdated
return a.Alerter.LogFlowError(ctx, config.FlowJobName, fmt.Errorf("failed to load destination peer type: %w", err))
}

cdcStoreEnabled, err := internal.PeerDBCDCStoreEnabledForDestination(ctx, config.Env, destinationType)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something, but if the CDC store is PG-only concern, why not read the config on the connector construction and store as a field on the connector?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(both configs)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, taking a look..

@jgao54 jgao54 Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

I also adjusted the code to determine the destination type and update the config.Env in the SyncFlow itself, such that the default value is destination-specific, but explicitly setting the env can still be honored. This is also given PG-to-PG and PG-to-CH will be different services so a single env is cleaner than having a separate one for PG-to-CH.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, let's go with that, it's got a bit less magic which seems like a good thing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgao54
jgao54 force-pushed the cdc-store-clickhouse-destination-override branch 3 times, most recently from 8e9dad4 to bc84902 Compare June 3, 2026 03:05
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ Test Failure

Analysis: A deterministic compile error — postgres_source.go:277 references a non-existent field CDCStoreEnabled on PostgresCDCConfig, so the test binary never built (not a flaky test).
Confidence: 0.99

⚠️ This appears to be a real bug - manual intervention needed

View workflow run

@jgao54
jgao54 force-pushed the cdc-store-clickhouse-destination-override branch from bc84902 to 1c917b5 Compare June 3, 2026 03:12
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ Test Failure

Analysis: Not flaky — a deterministic Go compile error (unknown field CDCStoreEnabled in PostgresCDCConfig at postgres_source.go:277) failed the build before any tests ran.
Confidence: 0.99

⚠️ This appears to be a real bug - manual intervention needed

View workflow run

@jgao54
jgao54 force-pushed the cdc-store-clickhouse-destination-override branch from 1c917b5 to ba32dab Compare June 3, 2026 03:18
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ Test Failure

Analysis: A deterministic Go compilation error ("declared and not used: cdcStoreEnabled" in connectors/postgres/postgres_source.go:255) prevented the test binary from building, so this is a real code bug, not a flaky test.
Confidence: 0.99

⚠️ This appears to be a real bug - manual intervention needed

View workflow run

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ Test Failure

Analysis: All three flow_test matrix jobs hit the same 20-minute e2e timeout with every CDC test across every destination hanging on un-normalized data, a deterministic regression matching PR #4366's change to the shared CDC store rather than a flaky failure.
Confidence: 0.9

⚠️ This appears to be a real bug - manual intervention needed

View workflow run

@jgao54
jgao54 force-pushed the cdc-store-clickhouse-destination-override branch from ba32dab to 0ede60e Compare June 3, 2026 03:34
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ Test Failure

Analysis: All three e2e shards hit the 20-minute package timeout with ClickHouse-destination tests stuck, matching this PR's change to ClickHouse CDC-store behavior, indicating a real regression that hangs CDC mirrors rather than a flaky failure.
Confidence: 0.85

⚠️ This appears to be a real bug - manual intervention needed

View workflow run

@jgao54
jgao54 force-pushed the cdc-store-clickhouse-destination-override branch from 0ede60e to a9efd94 Compare June 3, 2026 04:06
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

❌ Test Failure

Analysis: Not flaky: Test_Kafka's TestSimple/TestDefault/TestMessage deterministically fail with empty output (actual "") across all three matrix shards, indicating the PR's CDC-store enablement change stopped data reaching the Kafka destination, with the 20m package timeout being a downstream symptom.
Confidence: 0.9

⚠️ This appears to be a real bug - manual intervention needed

View workflow run

@jgao54
jgao54 force-pushed the cdc-store-clickhouse-destination-override branch from a9efd94 to cd71e2d Compare June 3, 2026 21:19
@jgao54 jgao54 closed this Jun 16, 2026
ilidemi added a commit that referenced this pull request Jun 17, 2026
Building on #4366
- Introduce `PEERDB_CLICKHOUSE_CDC_STORE_ENABLED` to allow separating
handling of cdc store enablement for ClickHouse (since other
destinations like PG-to-PG and PG-to-Snowflake requires this to be
enabled).
- Still honor existing services with CDC store disabled, to avoid OOM
issues resurfacing
- Currently `PEERDB_CLICKHOUSE_CDC_STORE_ENABLED` is default to `true`,
can be updated to `false` once we are ready to flip the switch (PR is
currently a no-op)

---------

Co-authored-by: Joy Gao <[email protected]>
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.

2 participants