fix(connectors): prevent state loss on source connector restart#2743
Merged
fix(connectors): prevent state loss on source connector restart#2743
Conversation
Source handler tasks were fire-and-forget (JoinHandle dropped), so the tokio runtime could cancel them mid-state-save during shutdown. FileStateProvider::save() uses a non-atomic truncate then write sequence — cancellation between the two left the state file empty. On restart the connector loaded no tracking offsets and re-polled all rows from the source database. Retain handler JoinHandles and await them (with timeout) after dropping flume senders but before shutting down Iggy clients. Also add sync_all() after write_all() in save() to ensure data reaches disk before returning.
mmodzelewski
approved these changes
Feb 16, 2026
spetz
approved these changes
Feb 16, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2743 +/- ##
============================================
+ Coverage 68.96% 68.97% +0.01%
Complexity 641 641
============================================
Files 736 736
Lines 60898 60910 +12
Branches 57311 57323 +12
============================================
+ Hits 41996 42011 +15
+ Misses 16858 16853 -5
- Partials 2044 2046 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Source handler tasks were fire-and-forget (JoinHandle dropped),
so the tokio runtime could cancel them mid-state-save during
shutdown. FileStateProvider::save() uses a non-atomic truncate
then write sequence - cancellation between the two left the
state file empty. On restart the connector loaded no tracking
offsets and re-polled all rows from the source database.
Retain handler JoinHandles and await them (with timeout) after
dropping flume senders but before shutting down Iggy clients.
Also add sync_all() after write_all() in save() to ensure
data reaches disk before returning.