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

[hadoop] branch ozone-0.4 updated: HDDS-1241. Update ozone to latest ratis snapshot build (0.4.0-5680cf5-SNAPSHOT). Contributed by Mukul Kumar Singh.

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

msingh pushed a commit to branch ozone-0.4
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/ozone-0.4 by this push:
     new f38a8a9  HDDS-1241. Update ozone to latest ratis snapshot build (0.4.0-5680cf5-SNAPSHOT). Contributed by Mukul Kumar Singh.
f38a8a9 is described below

commit f38a8a96304ab9a170370bf1b22367ccbe0a1689
Author: Mukul Kumar Singh <ms...@apache.org>
AuthorDate: Thu Mar 14 15:18:06 2019 +0530

    HDDS-1241. Update ozone to latest ratis snapshot build (0.4.0-5680cf5-SNAPSHOT). Contributed by Mukul Kumar Singh.
    
    (cherry picked from commit ea9fb07fd22417ab22d231531277d9ffe07814a2)
---
 .../server/ratis/ContainerStateMachine.java        | 25 +++++++++++-----------
 hadoop-hdds/pom.xml                                |  2 +-
 hadoop-ozone/pom.xml                               |  2 +-
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
index 7caf0c2..694985a 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
@@ -142,7 +142,6 @@ public class ContainerStateMachine extends BaseStateMachine {
   private ExecutorService[] executors;
   private final int numExecutors;
   private final Map<Long, Long> applyTransactionCompletionMap;
-  private long lastIndex;
   private final Cache<Long, ByteString> stateMachineDataCache;
   private final boolean isBlockTokenEnabled;
   private final TokenVerifier tokenVerifier;
@@ -165,7 +164,6 @@ public class ContainerStateMachine extends BaseStateMachine {
     this.executors = executors.toArray(new ExecutorService[numExecutors]);
     this.writeChunkFutureMap = new ConcurrentHashMap<>();
     applyTransactionCompletionMap = new ConcurrentHashMap<>();
-    this.lastIndex = RaftServerConstants.INVALID_LOG_INDEX;
     stateMachineDataCache = CacheBuilder.newBuilder()
         .expireAfterAccess(expiryInterval, TimeUnit.MILLISECONDS)
         // set the limit on no of cached entries equal to no of max threads
@@ -204,7 +202,6 @@ public class ContainerStateMachine extends BaseStateMachine {
           "The snapshot info is null." + "Setting the last applied index to:"
               + empty);
       setLastAppliedTermIndex(empty);
-      lastIndex = RaftServerConstants.INVALID_LOG_INDEX;
       return RaftServerConstants.INVALID_LOG_INDEX;
     }
 
@@ -213,7 +210,6 @@ public class ContainerStateMachine extends BaseStateMachine {
         SimpleStateMachineStorage.getTermIndexFromSnapshotFile(snapshotFile);
     LOG.info("Setting the last applied index to " + last);
     setLastAppliedTermIndex(last);
-    lastIndex = last.getIndex();
 
     // initialize the dispatcher with snapshot so that it build the missing
     // container list
@@ -575,6 +571,18 @@ public class ContainerStateMachine extends BaseStateMachine {
     }
   }
 
+  /**
+   * Notifies the state machine about index updates because of entries
+   * which do not cause state machine update, i.e. conf entries, metadata
+   * entries
+   * @param term term of the log entry
+   * @param index index of the log entry
+   */
+  @Override
+  public void notifyIndexUpdate(long term, long index) {
+    applyTransactionCompletionMap.put(index, term);
+  }
+
   /*
    * ApplyTransaction calls in Ratis are sequential.
    */
@@ -586,14 +594,6 @@ public class ContainerStateMachine extends BaseStateMachine {
             .setTerm(trx.getLogEntry().getTerm())
             .setLogIndex(index);
 
-    // ApplyTransaction call can come with an entryIndex much greater than
-    // lastIndex updated because in between entries in the raft log can be
-    // appended because raft config persistence. Just add a dummy entry
-    // for those.
-    for (long i = lastIndex + 1; i < index; i++) {
-      LOG.info("Gap in indexes at:{} detected, adding dummy entries ", i);
-      applyTransactionCompletionMap.put(i, trx.getLogEntry().getTerm());
-    }
     try {
       metrics.incNumApplyTransactionsOps();
       ContainerCommandRequestProto requestProto =
@@ -616,7 +616,6 @@ public class ContainerStateMachine extends BaseStateMachine {
           .supplyAsync(() -> runCommand(requestProto, builder.build()),
               getCommandExecutor(requestProto));
 
-      lastIndex = index;
       future.thenAccept(m -> {
         final Long previous =
             applyTransactionCompletionMap
diff --git a/hadoop-hdds/pom.xml b/hadoop-hdds/pom.xml
index e7cced8..6f95547 100644
--- a/hadoop-hdds/pom.xml
+++ b/hadoop-hdds/pom.xml
@@ -46,7 +46,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <hdds.version>0.4.0-SNAPSHOT</hdds.version>
 
     <!-- Apache Ratis version -->
-    <ratis.version>0.4.0-f283ffa-SNAPSHOT</ratis.version>
+    <ratis.version>0.4.0-5680cf5-SNAPSHOT</ratis.version>
 
     <bouncycastle.version>1.60</bouncycastle.version>
 
diff --git a/hadoop-ozone/pom.xml b/hadoop-ozone/pom.xml
index 375adb9..ae17655 100644
--- a/hadoop-ozone/pom.xml
+++ b/hadoop-ozone/pom.xml
@@ -29,7 +29,7 @@
     <hadoop.version>3.2.0</hadoop.version>
     <hdds.version>0.4.0-SNAPSHOT</hdds.version>
     <ozone.version>0.4.0-SNAPSHOT</ozone.version>
-    <ratis.version>0.4.0-f283ffa-SNAPSHOT</ratis.version>
+    <ratis.version>0.4.0-5680cf5-SNAPSHOT</ratis.version>
     <bouncycastle.version>1.60</bouncycastle.version>
     <ozone.release>Badlands</ozone.release>
     <declared.ozone.version>${ozone.version}</declared.ozone.version>


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org