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 03:06:45 UTC
(ratis) 01/02: 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 3255448c4abc76c5fea2a5d718056e08ff2c41a3
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;
}