Skip to content

feat(connectors): add source batch acknowledgments - #3855

Merged
hubcio merged 14 commits into
apache:masterfrom
rohankumardubey:fix/connectors-source-ack
Aug 18, 2026
Merged

feat(connectors): add source batch acknowledgments#3855
hubcio merged 14 commits into
apache:masterfrom
rohankumardubey:fix/connectors-source-ack

Conversation

@rohankumardubey

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Relates to #3635

Rationale

Establishes the generic source acknowledgment contract before migrating PostgreSQL source behavior and adding the kill-server regression test in a follow-up PR.

What changed?

Source plugins could poll another batch without knowing whether the previous batch was delivered, allowing cursors and persisted state to advance after failed sends.

The source FFI now carries batch IDs and supports ACK/NACK results. The SDK permits one in-flight batch, while the runtime ACKs only after both the Iggy send and state persistence succeed. Send failures, timeouts, and state-save failures produce a NACK.

Local Execution

  • Passed cargo fmt --all
  • Passed clippy with warnings denied for the connector SDK, runtime, and all source plugins
  • Passed all connector SDK, runtime, and source-plugin tests
  • Built the runtime and all source dynamic libraries successfully
  • Confirmed the new iggy_source_batch_result symbol is exported
  • cargo-sort, markdownlint, and taplo were not available locally
  • Pre-commit hooks did not run because no hook was installed

@github-actions

Copy link
Copy Markdown

Thanks for the PR. It is labeled S-waiting-on-review and queued for review.

Slash commands (own line, regular comment) move it around the queue:

  • /ready - back to S-waiting-on-review after addressing feedback
  • /author - flip to S-waiting-on-author while you finish changes
  • /request-review @user-or-team - request a reviewer

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Aug 10, 2026
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.62115% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.90%. Comparing base (e71e3c6) to head (74ea47d).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
core/connectors/sdk/src/source.rs 92.69% 44 Missing ⚠️
core/connectors/runtime/src/source.rs 92.65% 15 Missing and 3 partials ⚠️
core/connectors/sources/random_source/src/lib.rs 92.85% 3 Missing ⚠️
core/connectors/runtime/src/manager/source.rs 84.61% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #3855       +/-   ##
=============================================
- Coverage     83.67%   68.90%   -14.77%     
+ Complexity     1358     1339       -19     
=============================================
  Files          1212     1209        -3     
  Lines        165138   139252    -25886     
  Branches     132612   107565    -25047     
=============================================
- Hits         138181    95957    -42224     
- Misses        23308    39625    +16317     
- Partials       3649     3670       +21     
Components Coverage Δ
Rust Core 65.10% <92.62%> (-19.34%) ⬇️
Java SDK 66.55% <ø> (-0.13%) ⬇️
C# SDK 76.43% <ø> (+0.35%) ⬆️
Python SDK 90.00% <ø> (ø)
PHP SDK 84.48% <ø> (ø)
Node SDK 95.68% <ø> (-0.17%) ⬇️
Go SDK 69.04% <ø> (+0.72%) ⬆️
Files with missing lines Coverage Δ
core/connectors/runtime/src/main.rs 85.81% <100.00%> (+0.10%) ⬆️
core/connectors/sdk/src/lib.rs 57.14% <100.00%> (+0.96%) ⬆️
core/connectors/runtime/src/manager/source.rs 93.58% <84.61%> (+0.11%) ⬆️
core/connectors/sources/random_source/src/lib.rs 96.81% <92.85%> (-1.52%) ⬇️
core/connectors/runtime/src/source.rs 77.99% <92.65%> (+4.57%) ⬆️
core/connectors/sdk/src/source.rs 90.52% <92.69%> (+6.85%) ⬆️

... and 388 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rohankumardubey

Copy link
Copy Markdown
Contributor Author

/ready

@rohankumardubey

Copy link
Copy Markdown
Contributor Author

@hubcio This PR is ready for review.

@hubcio hubcio left a comment

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.

i actually had comments ready yesterday, just as pending, forgot to post them. here a few things that don't sit on changed lines:

  • no test exercises the failure path - nothing forces a send or state-save failure and checks that the nack arrives and the state file stays put. and no integration test ever waits for a second batch, so a handshake that wedges after batch 1 still passes the suite.
  • manager/source.rs:150 comment "close FFI (stops callbacks)" is stale now - close doesn't stop the runtime->plugin result callback, it guarantees it fails.
  • the connector authoring docs and templates don't mention on_batch_result, so the next source written from them lands with the no-op default too.

Comment thread core/connectors/runtime/src/source.rs
Comment thread core/connectors/runtime/src/source.rs
Comment thread core/connectors/runtime/src/source.rs
Comment thread core/connectors/runtime/src/source.rs
Comment thread core/connectors/sdk/src/source.rs Outdated
Comment thread core/connectors/sdk/src/source.rs Outdated
Comment thread core/connectors/sdk/src/source.rs Outdated
Comment thread core/connectors/sdk/src/lib.rs
Comment thread core/connectors/sdk/README.md Outdated
Comment thread core/connectors/sdk/README.md
@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Aug 12, 2026
@hubcio

hubcio commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

ignore failing java examples, we'll check it

@rohankumardubey

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review. I agree with the issues you identified and will address the ABI mismatch, shutdown and timeout handling, callback error propagation, NACK backoff, docs/templates, and missing regression tests.

For processing failures, I propose NACK with capped backoff, eventually stopping the connector without ACKing instead of losing data. For partial producer failures, I’ll report committed/failed counts and retry only the failed tail before NACKing.

As agreed in #3635, I’ll keep PostgreSQL migration in the follow-up PR, use a small generic source to test this contract, and narrow the README claims until PostgreSQL is migrated. Does this look good?

@hubcio

hubcio commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@rohankumardubey looks good.

@rohankumardubey
rohankumardubey requested a review from hubcio August 14, 2026 13:07
@hubcio

hubcio commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

looks like test is failing @rohankumardubey

TRY 4 FAIL [  16.782s] (553/692) integration::mod connectors::random::random_source::send_failure_preserves_state_and_source_recovers

https://github.com/apache/iggy/actions/runs/31840994243/job/94897663656?pr=3855

@rohankumardubey

Copy link
Copy Markdown
Contributor Author

looks like test is failing @rohankumardubey

TRY 4 FAIL [  16.782s] (553/692) integration::mod connectors::random::random_source::send_failure_preserves_state_and_source_recovers

https://github.com/apache/iggy/actions/runs/31840994243/job/94897663656?pr=3855

The test was stopping only node 0 while running against a three-node cluster. After the first failure, the producer failed over to another node, so the test timed out waiting for a second failure. I’ve changed this regression to use a single-node cluster, which keeps the outage deterministic. I’ll push the fix after the local checks are complete.

@hubcio

hubcio commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@rohankumardubey looks good, we'll merge this once github will start working properly again

@rohankumardubey

Copy link
Copy Markdown
Contributor Author

@rohankumardubey looks good, we'll merge this once github will start working properly again

Thanks for the review! I’ve already started working on the PostgreSQL follow-up from #3635, including the staged cursor changes and deterministic kill-server regression test we discussed.

@hubcio
hubcio merged commit af9ce95 into apache:master Aug 18, 2026
103 of 105 checks passed
@github-actions github-actions Bot removed the S-waiting-on-author PR is waiting on author response label Aug 18, 2026
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.

3 participants