This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new cbf3129 RATIS-1548. use stateMachine#lastAppliedIndex instead of
stateMachinUpdater#lastAppliedIndex when checking snapshot should be taken
(#618)
cbf3129 is described below
commit cbf31291ba113a8ea437a5c92c6987fa14b9604d
Author: Jackson Yao <[email protected]>
AuthorDate: Mon Mar 7 18:29:14 2022 +0800
RATIS-1548. use stateMachine#lastAppliedIndex instead of
stateMachinUpdater#lastAppliedIndex when checking snapshot should be taken
(#618)
---
.../main/java/org/apache/ratis/server/impl/StateMachineUpdater.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 efd9316..056f614 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
@@ -316,7 +316,8 @@ class StateMachineUpdater implements Runnable {
} else if (shouldStop()) {
return getLastAppliedIndex() - snapshotIndex.get() > 0;
}
- return state == State.RUNNING && getLastAppliedIndex() -
snapshotIndex.get() >= autoSnapshotThreshold;
+ return state == State.RUNNING &&
+ getStateMachineLastAppliedIndex() - snapshotIndex.get() >=
autoSnapshotThreshold;
}
private long getLastAppliedIndex() {