You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by ms...@apache.org on 2019/03/09 03:06:54 UTC

[incubator-ratis] branch master updated: RATIS-496. notifyIndexUpdate should inform about the term as well. Contributed by Mukul Kumar Singh.

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

msingh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 04fd22f  RATIS-496. notifyIndexUpdate should inform about the term as well. Contributed by Mukul Kumar Singh.
04fd22f is described below

commit 04fd22f0ab357818853bbcfdf180f867dc1aa5c8
Author: Mukul Kumar Singh <ms...@apache.org>
AuthorDate: Sat Mar 9 08:35:33 2019 +0530

    RATIS-496. notifyIndexUpdate should inform about the term as well. Contributed by Mukul Kumar Singh.
---
 .../src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java     | 2 +-
 .../src/main/java/org/apache/ratis/statemachine/StateMachine.java      | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
index a9ba7b2..95cb50c 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
@@ -1093,7 +1093,7 @@ public class RaftServerImpl implements RaftServerProtocol, RaftServerAsynchronou
   CompletableFuture<Message> applyLogToStateMachine(LogEntryProto next) {
     final StateMachine stateMachine = getStateMachine();
     if (!next.hasStateMachineLogEntry()) {
-      stateMachine.notifyIndexUpdate(next.getIndex());
+      stateMachine.notifyIndexUpdate(next.getTerm(), next.getIndex());
     }
     if (next.hasConfigurationEntry()) {
       // the reply should have already been set. only need to record
diff --git a/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java b/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java
index 2f4f20b..2c51afb 100644
--- a/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java
+++ b/ratis-server/src/main/java/org/apache/ratis/statemachine/StateMachine.java
@@ -188,9 +188,10 @@ public interface StateMachine extends Closeable {
    * internally by Raft Server, this currently happens when conf entries are
    * processed in raft Server. This keep state machine to keep a track of index
    * updates.
+   * @param term term of the current log entry
    * @param index index which is being updated
    */
-  default void notifyIndexUpdate(long index) {
+  default void notifyIndexUpdate(long term, long index) {
 
   }