Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.2k
Propagate snapshot load failure during IoTConsensus AddPeer#17935
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
Merged
CRZbulabula
merged 7 commits into
master
from
fix_v2_987_snapshot_load_failed_false_successJun 16, 2026
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
98246ce
Propagate snapshot load failure during IoTConsensus AddPeer
CRZbulabula 1c96b5b
Address review: don't fail AddPeer on receive folders missing the sna…
CRZbulabula 7fe8e9c
Propagate ConfigRegion snapshot load failure to the boolean contract
CRZbulabula 7e8514b
Use a meaningful status code and fail fast on snapshot load
CRZbulabula f86d5aa
Don't fail ConfigRegion snapshot load on best-effort pipe-listener error
CRZbulabula edf5971
Treat an empty snapshot as a successful load in IoTConsensus AddPeer
CRZbulabula ddeb9f8
Propagate SchemaRegion snapshot load failure to the boolean contract
CRZbulabula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
10 changes: 8 additions & 2 deletions
10 ...ain/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
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
7 changes: 5 additions & 2 deletions
7 ...de/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
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
5 changes: 4 additions & 1 deletion
5 iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/IStateMachine.java
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
31 changes: 23 additions & 8 deletions
31 ...b-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
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
12 changes: 11 additions & 1 deletion
12 ...src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCServiceProcessor.java
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
13 changes: 10 additions & 3 deletions
13 ...onsensus/src/main/java/org/apache/iotdb/consensus/ratis/ApplicationStateMachineProxy.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -98,7 +98,7 @@ public void initialize(RaftServer raftServer, RaftGroupId raftGroupId, RaftStora | ||
| } | ||
| @Override | ||
| public void reinitialize() { | ||
| public void reinitialize() throws IOException { | ||
| setLastAppliedTermIndex(null); | ||
| loadSnapshot(snapshotStorage.findLatestSnapshotDir()); | ||
| if (getLifeCycleState() == LifeCycle.State.PAUSED) { | ||
| @@ -261,14 +261,21 @@ private void deleteIncompleteSnapshot(File snapshotDir) throws IOException { | ||
| } | ||
| } | ||
| private void loadSnapshot(File latestSnapshotDir) { | ||
| private void loadSnapshot(File latestSnapshotDir) throws IOException { | ||
| snapshotStorage.updateSnapshotCache(); | ||
| if (latestSnapshotDir == null) { | ||
| return; | ||
| } | ||
| // require the application statemachine to load the latest snapshot | ||
| applicationStateMachine.loadSnapshot(latestSnapshotDir); | ||
| if (!applicationStateMachine.loadSnapshot(latestSnapshotDir)) { | ||
| // The application state machine rejected this snapshot. Do not advance lastAppliedTermIndex: | ||
| // claiming the snapshot as applied would let Ratis proceed as if it were installed and run on | ||
| // incomplete data (silent data loss). Fail (re)initialization instead so the snapshot install | ||
| // is treated as failed and can be retried. | ||
| throw new IOException( | ||
| String.format("%s: failed to load snapshot from %s", this, latestSnapshotDir)); | ||
| } | ||
| TermIndex snapshotTermIndex = Utils.getTermIndexFromDir(latestSnapshotDir); | ||
| updateLastAppliedTermIndex(snapshotTermIndex.getTerm(), snapshotTermIndex.getIndex()); | ||
CRZbulabula marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
4 changes: 2 additions & 2 deletions
4 .../consensus/src/main/java/org/apache/iotdb/consensus/simple/SimpleConsensusServerImpl.java
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
4 changes: 3 additions & 1 deletion
4 iotdb-core/consensus/src/test/java/org/apache/iotdb/consensus/EmptyStateMachine.java
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.