Skip to content

Fix/clickhouse normalize cursor skip - #4675

Open
matheusgr wants to merge 5 commits into
PeerDB-io:mainfrom
talismanai:fix/clickhouse-normalize-cursor-skip
Open

Fix/clickhouse normalize cursor skip#4675
matheusgr wants to merge 5 commits into
PeerDB-io:mainfrom
talismanai:fix/clickhouse-normalize-cursor-skip

Conversation

@matheusgr

Copy link
Copy Markdown

No description provided.

ilidemi and others added 2 commits June 29, 2026 14:30
… tables

When normalize finds no destination tables (connections=0) but the batch
range still has rows in the raw table or a non-empty avro stage, return an
error instead of calling UpdateNormalizeBatchID. This lets the normalize
loop retry and prevents permanently skipping CDC batches.

Empty CDC batches (zero avro records and zero raw rows) still advance the
cursor as before.

Co-authored-by: Cursor <cursoragent@cursor.com>
@matheusgr
matheusgr requested a review from a team as a code owner August 6, 2026 16:30
@matheusgr
matheusgr had a problem deploying to external-contributor August 6, 2026 16:30 — with GitHub Actions Failure
@matheusgr
matheusgr had a problem deploying to external-contributor August 6, 2026 16:30 — with GitHub Actions Failure
@CLAassistant

CLAassistant commented Aug 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@matheusgr
matheusgr had a problem deploying to external-contributor August 6, 2026 16:49 — with GitHub Actions Failure
@matheusgr
matheusgr had a problem deploying to external-contributor August 6, 2026 16:49 — with GitHub Actions Failure
…ze dropping rows

On the 3-replica prod cluster, normalize writes the raw table and then reads
it back via INSERT ... SELECT, potentially on a different replica. Raw inserts
were already synchronous (insert_distributed_sync/distributed_foreground_insert),
and select_sequential_consistency was set, but that setting only guarantees
visibility of quorum-inserted blocks -- with the default insert_quorum=0 it
enforces nothing, so the read could return zero rows, mark the batch normalized,
advance the cursor, and drop those rows permanently.

Write raw/normalize inserts with insert_quorum=auto and insert_quorum_parallel=0
on Replicated clusters, gated by PEERDB_CLICKHOUSE_ENABLE_REPLICATED_QUORUM
(default true here since prod is replicated and actively affected).

Ported from upstream PeerDB 053ba64 (v0.37.5),
kept as a fork patch to preserve the normalize-cursor guard and raw-table TTL
commits on this branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
@matheusgr
matheusgr requested a deployment to external-contributor September 4, 2026 17:56 — with GitHub Actions Waiting
@matheusgr
matheusgr requested a deployment to external-contributor September 4, 2026 17:56 — with GitHub Actions Waiting
Co-authored-by: Cursor <cursoragent@cursor.com>
@matheusgr
matheusgr requested a deployment to external-contributor September 4, 2026 18:11 — with GitHub Actions Waiting
@matheusgr
matheusgr requested a deployment to external-contributor September 4, 2026 18:11 — with GitHub Actions Waiting
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.

4 participants