File tree Expand file tree Collapse file tree
ratis-server-api/src/main/java/org/apache/ratis/server/leader
ratis-server/src/main/java/org/apache/ratis/server/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,4 +112,10 @@ public interface FollowerInfo {
112112
113113 /** Update lastRpcResponseTime and LastRespondedAppendEntriesSendTime */
114114 void updateLastRespondedAppendEntriesSendTime (Timestamp sendTime );
115+
116+ /** Set the caughtUp flag to true. */
117+ void catchUp ();
118+
119+ /** @return true if this follower is caught up. */
120+ boolean isCaughtUp ();
115121}
Original file line number Diff line number Diff line change @@ -147,10 +147,10 @@ default SnapshotInfo shouldInstallSnapshot() {
147147 // 2. or the follower's next index is smaller than the log start index
148148 // 3. or the follower is bootstrapping and has not installed any snapshot yet
149149 final FollowerInfo follower = getFollower ();
150- final boolean isFollowerBootstrapping = getLeaderState (). isFollowerBootstrapping ( follower );
150+ final boolean isFollowerCaughtUp = follower . isCaughtUp ( );
151151 final SnapshotInfo snapshot = getServer ().getStateMachine ().getLatestSnapshot ();
152152
153- if (isFollowerBootstrapping && !follower .hasAttemptedToInstallSnapshot ()) {
153+ if (! isFollowerCaughtUp && !follower .hasAttemptedToInstallSnapshot ()) {
154154 if (snapshot == null ) {
155155 // Leader cannot send null snapshot to follower. Hence, acknowledge InstallSnapshot attempt (even though it
156156 // was not attempted) so that follower can come out of staging state after appending log entries.
Original file line number Diff line number Diff line change @@ -173,11 +173,13 @@ public String toString() {
173173 ", lastRpcResponseTime=" + lastRpcResponseTime .get ().elapsedTimeMs () + ")" ;
174174 }
175175
176- void catchUp () {
176+ @ Override
177+ public void catchUp () {
177178 caughtUp = true ;
178179 }
179180
180- boolean isCaughtUp () {
181+ @ Override
182+ public boolean isCaughtUp () {
181183 return caughtUp ;
182184 }
183185
You can’t perform that action at this time.
0 commit comments