feat: Attempt to sync all streams instead of crashing on the first error - #3614
Open
edgarrmondragon wants to merge 22 commits into
Open
edgarrmondragon wants to merge 22 commits into
edgarrmondragon wants to merge 22 commits into
Conversation
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
…ing" This reverts commit 5dc0393.
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Signed-off-by: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideImplements per-stream sync outcome tracking so taps continue syncing remaining streams after individual stream failures, aggregates results into a process exit code, and tightens state advancement and logging behavior around stream sync errors. Sequence diagram for Tap.sync_all aggregating per-stream SyncResultsequenceDiagram
actor CLI
participant Tap
participant Stream1 as Stream_success
participant Stream2 as Stream_failure
participant Stream3 as Stream_skipped
participant StateMgr1 as StreamStateManager_success
participant StateMgr2 as StreamStateManager_failure
participant StateMgr3 as StreamStateManager_skipped
CLI->>Tap: sync_all()
Tap->>Stream1: sync()
Stream1->>StateMgr1: load_state()
StateMgr1-->>Stream1: state_loaded
Stream1->>StateMgr1: advance_bookmark(partition_state)
Stream1->>StateMgr1: finalize_state()
Stream1-->>Tap: SyncResult.SUCCESS
Tap->>Tap: combined_result = SUCCESS.combine(SUCCESS)
Tap->>Stream2: sync()
Stream2->>StateMgr2: load_state()
StateMgr2-->>Stream2: state_loaded
Stream2->>Stream2: unexpected_exception
Stream2-->>Tap: SyncResult.FAILURE
Tap->>Tap: combined_result = combined_result.combine(FAILURE)
Tap->>Stream3: sync()
Stream3->>StateMgr3: load_state()
StateMgr3-->>Stream3: state_loaded
Stream3-->>Tap: SyncResult.SKIPPED
Tap->>Tap: combined_result = combined_result.combine(SKIPPED)
Tap->>Tap: log per-stream outcomes
Tap-->>CLI: exit_code = combined_result.to_exit_code()
Class diagram for per-stream SyncResult tracking and state managementclassDiagram
class SyncResult {
<<enum>>
SUCCESS
FAILURE
SKIPPED
ABORTED
+SyncResult combine(SyncResult other)
+int to_exit_code()
+bool is_success()
+bool is_failure()
+bool is_aborted()
+bool is_skipped()
+str log_level()
}
class StreamStateManager {
+str tap_name
+str stream_name
+dict tap_state
+list state_partitioning_keys
+advance_bookmark(dict partition_state)
+finalize_state()
+load_state()
}
class Stream {
+str name
+Tap tap
+dict _tap_state
+list _state_partitioning_keys
+list child_streams
+SyncResult sync_result
+StreamStateManager _state_manager
+SyncResult sync()
+sync_child_streams()
+sync_incremental()
+sync_full_table()
}
class Tap {
+str name
+list streams
+dict state
+SyncResult sync_all()
+int get_exit_code(SyncResult result)
}
Tap "1" o-- "many" Stream : owns
Stream "1" o-- "many" Stream : child_streams
Stream "1" *-- "1" StreamStateManager : uses_state_manager
Stream ..> SyncResult : returns
Tap ..> SyncResult : aggregates
Tap ..> StreamStateManager : finalizes_successful_state
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Documentation build overview
17 files changed ·
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/safely-ignore-errors #3614 +/- ##
=============================================================
- Coverage 93.86% 93.78% -0.09%
=============================================================
Files 74 74
Lines 5965 5966 +1
Branches 735 735
=============================================================
- Hits 5599 5595 -4
- Misses 274 278 +4
- Partials 92 93 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Passing
self._tap_stateintoStreamStateManagerat construction time may lead to divergence if the tap state is later mutated elsewhere; consider passing a reference or accessor so the manager always sees the latest state. - If
StreamStateManagerhas any expensive initialization or external dependencies, consider lazy initialization or injecting a shared manager to avoid overhead when many streams are created concurrently.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Passing `self._tap_state` into `StreamStateManager` at construction time may lead to divergence if the tap state is later mutated elsewhere; consider passing a reference or accessor so the manager always sees the latest state.
- If `StreamStateManager` has any expensive initialization or external dependencies, consider lazy initialization or injecting a shared manager to avoid overhead when many streams are created concurrently.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This branch has not been deployed
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.
Summary by Sourcery
Enhancements: