improve: raft state machine should report error#2871
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2871 +/- ##
============================================
+ Coverage 40.91% 40.92% +0.01%
Complexity 333 333
============================================
Files 747 747
Lines 60168 60169 +1
Branches 7683 7683
============================================
+ Hits 24615 24623 +8
+ Misses 32975 32968 -7
Partials 2578 2578 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR improves error handling in Raft state machines by ensuring that errors are properly reported to the iterator when exceptions occur during state machine operations.
- Adds error reporting via
setErrorAndRollback()when exceptions are caught during state machine operations - Implements consistent error handling across both store and PD components
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| HgStoreStateMachine.java | Adds error reporting call when exceptions occur during state machine operations |
| RaftStateMachine.java | Adds error reporting call when exceptions occur during state machine operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if (done != null) { | ||
| done.run(new Status(RaftError.EINTERNAL, t.getMessage())); | ||
| } | ||
| iter.setErrorAndRollback(1, new Status(RaftError.ESTATEMACHINE, t.getMessage())); |
There was a problem hiding this comment.
[nitpick] The hardcoded rollback count '1' should be extracted as a named constant to improve code readability and maintainability. Consider defining a constant like 'ROLLBACK_COUNT = 1' to make the intent clearer.
|
Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label |
Purpose of the PR
Main Changes
Verifying these changes
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need