fix(connectors): defer postgres source progress until ack - #3957
fix(connectors): defer postgres source progress until ack#3957rohankumardubey wants to merge 14 commits into
Conversation
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3957 +/- ##
=============================================
- Coverage 85.25% 59.06% -26.19%
Complexity 1402 1402
=============================================
Files 1236 1235 -1
Lines 182594 150607 -31987
Branches 148898 116913 -31985
=============================================
- Hits 155664 88956 -66708
- Misses 22886 57806 +34920
+ Partials 4044 3845 -199
🚀 New features to boost your workflow:
|
|
/ready |
|
/request-review @hubcio |
hubcio
left a comment
There was a problem hiding this comment.
a few things without diff lines to hang them on:
.claude/skills/connector-source/SKILL.mdstill teaches the pre-ack pattern this pr removes (the "matches poll_tables" snippet writes cursors during poll, "always return state in every ProducedMessages" no longer holds for empty polls, and state-serialization failure is now a hard poll error, lib.rs:288-296) and doesn't mentionon_batch_resultat all - needs an update to the new contract.mark_or_delete_processed_rowsmaps db errors toError::InvalidRecord(lib.rs:732, :751) - misleading now that these errors surface through the ack path;Error::Connectionlikeadvance_replication_slotuses would fit better.- README.md:15 still promises offset tracking "avoid duplicates" - at-least-once redelivery means duplicates are possible; and README.md:57 documents the
poll_intervaldefault as1swhile the code fallback is10s(lib.rs:180).
|
@rohankumardubey please write |
|
/ready |
|
looks like CI is failing. |
|
The failure came from a merge-resolution type mismatch in the TLS connection-string branch. Thanks @hubcio |
|
/ready |
hubcio
left a comment
There was a problem hiding this comment.
the staging model is right and closes the old send-failure hole. two things block: 55006 isn't transient, so any slot collision at ack time stops the source for good, and an empty cdc peek never advances the slot, so an idle database retains wal without bound. the tracking <= boundary guard also regresses custom_query, null and numeric tracking users, and the new cdc test races the connector on the slot.
outside this diff, two pre-existing bugs in build_polling_query worth their own issue: $now is replaced before $now_unix so $now_unix never expands, and $offset is substituted raw into custom_query from row data.
|
@hubcio Agreed, I’ll track staged-operation persistence and replay, along with the two pre-existing |
|
@rohankumardubey sure thing. if you plan to do that, please fill-in the TODOs in code so that it won't be forgotten (in relevant places). |
|
/ready |

Which issue does this PR address?
Closes #3635
Rationale
The PostgreSQL source advanced tracking offsets, deleted or marked rows, and consumed CDC changes before Iggy confirmed delivery. A failed send could therefore permanently skip source records.
What changed?
PostgreSQL polling now stages cursor updates and row operations until the runtime reports a successful batch acknowledgment. NACK discards the staged work, while ACK commits the state and performs the pending delete or mark operations.
CDC now peeks logical-slot changes and advances the slot only after acknowledgment. A deterministic regression test stops Iggy during delivery and verifies that the PostgreSQL rows are redelivered after restart.
Local Execution
cargo fmt --all -- --checkcargo clippy -p iggy_connector_postgres_source -p integration --all-features --all-targets -- -D warningsgit diff --check