Skip to content

RATIS-2045. SnapshotInstallationHandler doesn't notify follower when snapshotIndex is -1 and firstAvailableLogIndex is 0#1053

Merged
szetszwo merged 4 commits intoapache:masterfrom
hemantk-12:RATIS-2045
Mar 20, 2024
Merged

RATIS-2045. SnapshotInstallationHandler doesn't notify follower when snapshotIndex is -1 and firstAvailableLogIndex is 0#1053
szetszwo merged 4 commits intoapache:masterfrom
hemantk-12:RATIS-2045

Conversation

@hemantk-12
Copy link
Copy Markdown
Contributor

@hemantk-12 hemantk-12 commented Mar 19, 2024

What changes were proposed in this pull request?

When the leader has firstAvailableLogIndex 0 and the follower node is bootstrapping and doesn't have any snapshot, the leader doesn't notify the follower to install the snapshot because the current condition is always true if snapshotIndex is -1 (default value) and firstAvailableLogIndex is 0 (when the leader has logs form 0th index).
As part of this change, we are changing the condition to notify when snapshotIndex is -1. If snapshotIndex is not -1, then continue with snapshotIndex + 1 >= firstAvailableLogIndex && firstAvailableLogIndex > INVALID_LOG_INDEX.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/RATIS-2045

How was this patch tested?

Existing unit tests for now.

@szetszwo
Copy link
Copy Markdown
Contributor

@duongkame , there are some test failures related to IllegalState allLeaks.size = 2; see https://github.com/apache/ratis/actions/runs/8350541481/job/22857177939?pr=1053#step:6:1096

@duongkame
Copy link
Copy Markdown
Contributor

@duongkame , there are some test failures related to IllegalState allLeaks.size = 2; see https://github.com/apache/ratis/actions/runs/8350541481/job/22857177939?pr=1053#step:6:1096

I created a custom build with advance detection here: https://github.com/duongkame/ratis/actions/runs/8351812136

Looks like this is because the retained log entries in SimpleStateMachine4Testing cache are not released. Probably because the state machine is not closed. Filed RATIS-2046.

Comment on lines +356 to +357
} No newline at end of file
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hemantk-12 , could you revert this whitespace change? I tried to do in on the GitHub web ui but it did not work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Copy link
Copy Markdown
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@szetszwo szetszwo merged commit 72c060d into apache:master Mar 20, 2024
symious pushed a commit to symious/ratis that referenced this pull request Apr 11, 2024
…snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)
szetszwo added a commit to szetszwo/ratis that referenced this pull request Apr 11, 2024
…er when snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)"

This reverts commit 72c060d.
szetszwo added a commit to szetszwo/ratis that referenced this pull request Apr 15, 2024
…er when snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)"

This reverts commit 72c060d.
duongkame added a commit to duongkame/ratis that referenced this pull request Apr 17, 2024
…er when snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)"

This reverts commit 72c060d.
szetszwo added a commit to szetszwo/ratis that referenced this pull request Apr 17, 2024
…er when snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)"

This reverts commit 72c060d.
whbing pushed a commit to whbing/ratis that referenced this pull request Apr 20, 2024
…er when snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)"

This reverts commit 72c060d.
SzyWilliam pushed a commit to SzyWilliam/ratis that referenced this pull request Jun 12, 2024
…snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request Jun 16, 2024
…snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)
slfan1989 pushed a commit to slfan1989/ratis that referenced this pull request May 6, 2026
…snapshotIndex is -1 and firstAvailableLogIndex is 0 (apache#1053)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants