JNSimba opened a new pull request, #71047:
URL: https://github.com/apache/doris/pull/71047

   ### Background
   
   CDC streaming jobs using `cdc_stream` read table snapshots in splits before 
switching to incremental consumption. In storage-compute separation mode, Meta 
Service retains the latest streaming job attachment, so that attachment must be 
sufficient to resume the snapshot.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #61826 (introduced streaming CDC TVF)
   PR Type: Bugfix
   
   Problem Summary:
   
   A large CDC TVF snapshot can fail to commit when the cumulative per-split 
watermarks exceed the 100 KB single-value limit in the metadata store. For TVF 
snapshots that skip backfill, this PR persists the first batch's minimum source 
watermark with the last committed split ID. The attachment stays bounded as 
later batches complete, and FE uses the persisted split definitions to restore 
progress.
   
   ### Details
   
   - **Change map:** 194 changed lines of production code and 753 lines of 
tests. FE selects the attachment format and restores compact progress (161 
changed lines). CDC Client places the first batch's minimum watermark first 
using the source comparator (33 lines).
   - **Frequency:** The old attachment grows on each committed snapshot batch 
in storage-compute separation mode. A commit encounters the limit once its 
serialized value exceeds 100 KB.
   - **Root cause:** 
`JdbcTvfSourceOffsetProvider.buildCumulativeSnapshotOffset` folds all committed 
snapshot split watermarks into a single offset. Meta Service writes that offset 
with the job's other metadata in one KV value.
   - **Why existing tests missed it:** `JdbcTvfSourceOffsetProviderTest` and 
`StreamingInsertJobOffsetPersistenceTest` covered recovery with small per-split 
offsets. `test_streaming_job_cdc_stream_postgres_restart_fe` exercised FE 
restart without asserting constant-size progress across a large snapshot.
   - **Fix:** CDC Client compares the first batch's watermarks with the source 
connector's comparator. FE persists the minimum with the end of the contiguous 
committed prefix, keeps the watermark fixed across later batches, and restores 
split watermarks before the incremental reader starts.
   - **Other paths and branches:** Both deployment modes use compact progress 
for eligible TVF jobs. Incremental attachments and FROM TO jobs keep their 
existing paths. New FE can replay legacy per-split progress, and snapshots that 
already have legacy progress keep writing that format. Release branches were 
outside this validation.
   - **Configs and defaults:** Streaming CDC TVF jobs default to 
`skip_snapshot_backfill=true` when the option is omitted. Setting it to `false` 
uses per-split offsets. Changing it to `false` after compact snapshot progress 
has been committed is rejected while that progress is active.
   - **Behavior change:** Skipping backfill provides at-least-once delivery, so 
the snapshot-to-incremental transition can replay events. Compact progress 
requires an updated CDC Client for the first batch and an FE that understands 
the committed prefix for recovery.
   
   ### Testing
   
   - FE targeted unit tests: 36 passed across `JdbcTvfSourceOffsetProviderTest` 
and `StreamingInsertJobOffsetPersistenceTest`, including legacy progress and 
compact snapshot recovery.
   - CDC Client targeted unit tests: 6 passed across 
`PipelineCoordinatorSnapshotProgressTest` and 
`PipelineCoordinatorSchemaChangeTest`.
   - `test_streaming_job_cdc_stream_postgres_compact_offset` passed in Docker 
in both `cloud` and `not_cloud` modes. The case uses a 1,500-row snapshot, 
checks at least 1,200 split definitions and a single fixed watermark, restarts 
FE with unfinished splits, and checks the final rows after an update, delete, 
and insert. The cloud run used MinIO.
   - The old attachment growth was verified from the write path. The Docker 
suite was run on the candidate.
   
   ### Release note
   
   Large CDC TVF snapshots that skip backfill persist a bounded offset in both 
deployment modes. Streaming CDC TVF jobs now skip snapshot backfill by default.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: Yes. Document the CDC TVF default and the 
explicit `skip_snapshot_backfill=false` opt-out in the streaming job 
documentation.
   - Pre-submission status: Partially verified: PostgreSQL passed in both 
deployment modes. MySQL and mixed-version upgrade and downgrade were outside 
end-to-end validation.
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex
   - Generated: Implementation, tests, and PR description
   - Human review: The author reviewed the offset format, recovery flow, and 
regression assertions during development.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to