You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by wi...@apache.org on 2025/01/09 11:16:36 UTC

(ratis) 14/14: RATIS-2236 Fixed bug where manual triggerSnapshot would never finish (#1207)

This is an automated email from the ASF dual-hosted git repository.

williamsong pushed a commit to branch release-3.1.3
in repository https://gitbox.apache.org/repos/asf/ratis.git

commit f3353f6e3845374f3bf3192a8f9cb2ff2396c006
Author: Potato <ta...@apache.org>
AuthorDate: Thu Jan 9 01:17:10 2025 +0800

    RATIS-2236 Fixed bug where manual triggerSnapshot would never finish (#1207)
---
 .../main/java/org/apache/ratis/server/impl/StateMachineUpdater.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/StateMachineUpdater.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/StateMachineUpdater.java
index c1db1fd3c..a919ca732 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/impl/StateMachineUpdater.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/StateMachineUpdater.java
@@ -216,6 +216,9 @@ class StateMachineUpdater implements Runnable {
     // Thus it is possible to have applied > committed initially.
     final long applied = getLastAppliedIndex();
     for(; applied >= raftLog.getLastCommittedIndex() && state == State.RUNNING && !shouldStop(); ) {
+      if (server.getSnapshotRequestHandler().shouldTriggerTakingSnapshot()) {
+        takeSnapshot();
+      }
       if (awaitForSignal.await(100, TimeUnit.MILLISECONDS)) {
         return;
       }