test: add target-neutral CDC data-integrity oracle - #88
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b5976f7ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| run: > | ||
| go test -tags integration -short -v -timeout 8m | ||
| -run 'TestEndToEnd$|TestEndToEndUpdateDelete$|TestSchemaEvolution_AddColumn$|TestMutationModesDuckDBCorrectness/cow$' | ||
| -run 'TestEndToEnd$|TestEndToEndUpdateDelete$|TestSchemaEvolution_AddColumn$|TestMutationModesDuckDBCorrectness/cow$|TestCDCDataIntegrityOracle$' |
There was a problem hiding this comment.
Run the CDC oracle outside the slash-split regexp
In the inspected integration-smoke command, the new oracle is never selected. go help testflag states that -run expressions are split at each unbracketed /; consequently, TestCDCDataIntegrityOracle$ becomes part of the second, subtest-name expression, while the top-level test must match the first expression ending at TestMutationModesDuckDBCorrectness. Run the oracle separately or escape/bracket the slash so the complete expression is not split.
Useful? React with 👍 / 👎.
| decoder := json.NewDecoder(strings.NewReader(text)) | ||
| decoder.UseNumber() | ||
| var value any | ||
| if err := decoder.Decode(&value); err != nil { |
There was a problem hiding this comment.
Reject trailing data after the JSON value
When a target JSON string contains the expected value followed by additional data, such as {"a":1}null, this single Decode succeeds on the first value and the canonical result matches the source, allowing the data-integrity oracle to pass corrupted target data. After decoding the value, perform another decode and require io.EOF so the entire target string is validated.
Useful? React with 👍 / 👎.
Summary
Add an end-to-end CDC data-integrity oracle that compares source Postgres with Streambed's durable target while bypassing Streambed's pgwire query layer.
The same deterministic scenario runs against Iceberg and DuckLake. Destination data is read directly with embedded DuckDB using
iceberg_scan(...)or a read-only DuckLake catalog attachment.Closes #86.
Implementation
streambed syncprocess for each target.confirmed_flush_lsninstead of sleeping.last_flush_lsnat every checkpoint.float64;Scenario coverage
Three durable checkpoints cover:
Forced post-commit/pre-ack replay remains covered by the existing failpoint integration tests.
Validation
Started fresh Postgres and MinIO containers, created the bucket, built Streambed, and ran the oracle through both targets:
Result: PASS for all three checkpoints on Iceberg and DuckLake.
Also ran the complete PR integration-smoke command successfully:
And: