-
Notifications
You must be signed in to change notification settings - Fork 562
improve: raft state machine should report error #2871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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())); |
Copilot
AI
Sep 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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