Skip to content

feat(connectors): let sinks control when offsets are committed - #3954

Open
kriti-sc wants to merge 1 commit into
apache:masterfrom
kriti-sc:manual-offset-commit
Open

feat(connectors): let sinks control when offsets are committed#3954
kriti-sc wants to merge 1 commit into
apache:masterfrom
kriti-sc:manual-offset-commit

Conversation

@kriti-sc

Copy link
Copy Markdown
Contributor

Closes #2928, #2927
Related: #3203

Rationale

Sinks must have an option to decide exactly when it is safe to advance the offset, as only the sink knows when a write is truly durable from the target's perspective.

What changed?

This PR adds an offset_commit setting to sink configs:

  • after_polling (default) - existing behaviour of offset being committed when messages are polled. Nothing changes for existing configs.
  • after_consuming - the offset is stored only once the sink reports that it wrote the batch.

The offset commit decision hinges upon the i32 returned by the sink.

This also required binding the i32 returned by the sink, which was previous discarded. Now, the sink exits if i32 != 0, regardless of offset commit configuration, which is the correct behaviour as a sink returns error for failures lying outside its purview.

This PR also introduces integration tests that inject failures into a running sink and verify the desired commit behaviour.

@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 22, 2026
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.98246% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.76%. Comparing base (cc269ef) to head (3b2a144).

Files with missing lines Patch % Lines
core/connectors/runtime/src/sink.rs 85.71% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3954      +/-   ##
============================================
- Coverage     83.85%   83.76%   -0.10%     
  Complexity     1358     1358              
============================================
  Files          1212     1212              
  Lines        166843   166900      +57     
  Branches     134304   134487     +183     
============================================
- Hits         139905   139800     -105     
- Misses        23298    23305       +7     
- Partials       3640     3795     +155     
Components Coverage Δ
Rust Core 84.60% <92.98%> (-0.03%) ⬇️
Java SDK 66.67% <ø> (ø)
C# SDK 74.92% <ø> (-1.61%) ⬇️
Python SDK 90.13% <ø> (ø)
PHP SDK 84.48% <ø> (ø)
Node SDK 95.94% <ø> (+0.09%) ⬆️
Go SDK 68.37% <ø> (ø)
Files with missing lines Coverage Δ
core/connectors/runtime/src/configs/connectors.rs 63.57% <100.00%> (+22.50%) ⬆️
core/connectors/runtime/src/error.rs 28.57% <ø> (ø)
core/connectors/runtime/src/main.rs 85.81% <ø> (ø)
core/connectors/runtime/src/manager/sink.rs 94.17% <100.00%> (+0.01%) ⬆️
core/connectors/runtime/src/sink.rs 77.53% <85.71%> (-1.37%) ⬇️

... and 69 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(connectors): PollingMessages auto-commit commits offsets before sink processing

1 participant