You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by dr...@apache.org on 2022/10/03 13:32:10 UTC

[ratis] branch release-2.4.0 created (now d6e99b118)

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

dragonyliu pushed a change to branch release-2.4.0
in repository https://gitbox.apache.org/repos/asf/ratis.git


      at d6e99b118 Change version for the version 2.4.0 -rc3

This branch includes the following new commits:

     new f78197815 RATIS-1707. Fix corner case when getPrevious in LogAppenderBase (#745)
     new 6e22fb008 RATIS-1674. In GrpcLogAppender, disable retry and add minWait. (#752)
     new 03f3f7c2b RATIS-1713. Fix TakeSnapshotCommand's usage info (#753)
     new d6e99b118 Change version for the version 2.4.0 -rc3

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[ratis] 02/04: RATIS-1674. In GrpcLogAppender, disable retry and add minWait. (#752)

Posted by dr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6e22fb008297f27067100ff9b5758ad52a03f910
Author: William Song <48...@users.noreply.github.com>
AuthorDate: Thu Sep 29 23:14:50 2022 +0800

    RATIS-1674. In GrpcLogAppender, disable retry and add minWait. (#752)
    
    (cherry picked from commit 16ba152c7e45a0c3b3c96e3d400837408c69e921)
---
 .../java/org/apache/ratis/grpc/server/GrpcLogAppender.java | 14 ++++++++++++--
 .../apache/ratis/grpc/server/GrpcServerProtocolClient.java |  1 +
 .../java/org/apache/ratis/server/RaftServerConfigKeys.java | 10 ++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
index e87edac5e..125dd7dfa 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
@@ -48,6 +48,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
 
 import com.codahale.metrics.Timer;
 
@@ -73,6 +74,9 @@ public class GrpcLogAppender extends LogAppenderBase {
   private final TimeDuration requestTimeoutDuration;
   private final TimeoutExecutor scheduler = TimeoutExecutor.getInstance();
 
+  private final long waitTimeMinMs;
+  private final AtomicReference<Timestamp> lastAppendEntries;
+
   private volatile StreamObservers appendLogRequestObserver;
   private final boolean useSeparateHBChannel;
 
@@ -92,6 +96,10 @@ public class GrpcLogAppender extends LogAppenderBase {
     this.installSnapshotEnabled = RaftServerConfigKeys.Log.Appender.installSnapshotEnabled(properties);
     this.useSeparateHBChannel = GrpcConfigKeys.Server.heartbeatChannel(properties);
 
+    final TimeDuration waitTimeMin = RaftServerConfigKeys.Log.Appender.waitTimeMin(properties);
+    this.waitTimeMinMs = waitTimeMin.toLong(TimeUnit.MILLISECONDS);
+    this.lastAppendEntries = new AtomicReference<>(Timestamp.currentTime().addTime(waitTimeMin.negate()));
+
     grpcServerMetrics = new GrpcServerMetrics(server.getMemberId().toString());
     grpcServerMetrics.addPendingRequestsCount(getFollowerId().toString(), pendingRequests::logRequestsSize);
 
@@ -173,9 +181,10 @@ public class GrpcLogAppender extends LogAppenderBase {
       // For normal nodes, new entries should be sent ASAP
       // however for slow followers (especially when the follower is down),
       // keep sending without any wait time only ends up in high CPU load
-      return 0L;
+      final long min = waitTimeMinMs - lastAppendEntries.get().elapsedTimeMs();
+      return Math.max(0L, min);
     }
-    return Math.min(10L, getHeartbeatWaitTimeMs());
+    return Math.min(waitTimeMinMs, getHeartbeatWaitTimeMs());
   }
 
   private boolean isSlowFollower() {
@@ -285,6 +294,7 @@ public class GrpcLogAppender extends LogAppenderBase {
     final boolean sent = Optional.ofNullable(appendLogRequestObserver)
         .map(observer -> {
           observer.onNext(proto);
+          lastAppendEntries.set(Timestamp.currentTime());
           return true;
         }).isPresent();
 
diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolClient.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolClient.java
index 6f5d06c2e..d9aefbf0d 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolClient.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcServerProtocolClient.java
@@ -102,6 +102,7 @@ public class GrpcServerProtocolClient implements Closeable {
     } else {
       channelBuilder.negotiationType(NegotiationType.PLAINTEXT);
     }
+    channelBuilder.disableRetry();
     return channelBuilder.flowControlWindow(flowControlWindow).build();
   }
 
diff --git a/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java b/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
index e24631378..f75ddae46 100644
--- a/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
+++ b/ratis-server-api/src/main/java/org/apache/ratis/server/RaftServerConfigKeys.java
@@ -507,6 +507,16 @@ public interface RaftServerConfigKeys {
       static void setInstallSnapshotEnabled(RaftProperties properties, boolean shouldInstallSnapshot) {
         setBoolean(properties::setBoolean, INSTALL_SNAPSHOT_ENABLED_KEY, shouldInstallSnapshot);
       }
+
+      String WAIT_TIME_MIN_KEY = PREFIX + ".wait-time.min";
+      TimeDuration WAIT_TIME_MIN_DEFAULT = TimeDuration.valueOf(10, TimeUnit.MILLISECONDS);
+      static TimeDuration waitTimeMin(RaftProperties properties) {
+        return getTimeDuration(properties.getTimeDuration(WAIT_TIME_MIN_DEFAULT.getUnit()),
+            WAIT_TIME_MIN_KEY, WAIT_TIME_MIN_DEFAULT, getDefaultLog());
+      }
+      static void setWaitTimeMin(RaftProperties properties, TimeDuration minDuration) {
+        setTimeDuration(properties::setTimeDuration, WAIT_TIME_MIN_KEY, minDuration);
+      }
     }
   }
 


[ratis] 01/04: RATIS-1707. Fix corner case when getPrevious in LogAppenderBase (#745)

Posted by dr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f78197815c5901bb73557e6a7b27fbd2b6a9f30c
Author: Nibiru <ax...@qq.com>
AuthorDate: Thu Sep 22 17:14:06 2022 +0800

    RATIS-1707. Fix corner case when getPrevious in LogAppenderBase (#745)
    
    (cherry picked from commit 89853ea72bf8357d1a6983b8b52419d0ec6ccf1e)
---
 .../apache/ratis/server/impl/RaftServerImpl.java    | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 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 2aa14cbed..3d6fb517b 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
@@ -1259,15 +1259,18 @@ class RaftServerImpl implements RaftServer.Division,
       List<LogEntryProto> entries) {
     if (entries != null && !entries.isEmpty()) {
       final long index0 = entries.get(0).getIndex();
-
-      if (previous == null || previous.getTerm() == 0) {
-        Preconditions.assertTrue(index0 == 0,
-            "Unexpected Index: previous is null but entries[%s].getIndex()=%s",
-            0, index0);
-      } else {
-        Preconditions.assertTrue(previous.getIndex() == index0 - 1,
-            "Unexpected Index: previous is %s but entries[%s].getIndex()=%s",
-            previous, 0, index0);
+      // Check if next entry's index is 1 greater than the snapshotIndex. If yes, then
+      // we do not have to check for the existence of previous.
+      if (index0 != state.getSnapshotIndex() + 1) {
+        if (previous == null || previous.getTerm() == 0) {
+          Preconditions.assertTrue(index0 == 0,
+              "Unexpected Index: previous is null but entries[%s].getIndex()=%s",
+              0, index0);
+        } else {
+          Preconditions.assertTrue(previous.getIndex() == index0 - 1,
+              "Unexpected Index: previous is %s but entries[%s].getIndex()=%s",
+              previous, 0, index0);
+        }
       }
 
       for (int i = 0; i < entries.size(); i++) {


[ratis] 03/04: RATIS-1713. Fix TakeSnapshotCommand's usage info (#753)

Posted by dr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 03f3f7c2be7c996d96a83775b3ab968465f5f493
Author: tison <wa...@gmail.com>
AuthorDate: Sun Oct 2 17:24:28 2022 +0800

    RATIS-1713. Fix TakeSnapshotCommand's usage info (#753)
    
    (cherry picked from commit 3bc72c6f383b723f545c52c25e3ea2ea5be0aac1)
---
 .../org/apache/ratis/shell/cli/sh/snapshot/TakeSnapshotCommand.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/snapshot/TakeSnapshotCommand.java b/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/snapshot/TakeSnapshotCommand.java
index e3c6740ec..10bac3497 100644
--- a/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/snapshot/TakeSnapshotCommand.java
+++ b/ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/snapshot/TakeSnapshotCommand.java
@@ -79,7 +79,11 @@ public class TakeSnapshotCommand extends AbstractRatisCommand {
             + " [-%s <RAFT_GROUP_ID>]"
             + " [-%s <timeoutInMs>]"
             + " [-%s <raftPeerId>]",
-        getCommandName(), PEER_OPTION_NAME, GROUPID_OPTION_NAME, TAKE_SNAPSHOT_TIMEOUT_OPTION_NAME);
+        getCommandName(),
+        PEER_OPTION_NAME,
+        GROUPID_OPTION_NAME,
+        TAKE_SNAPSHOT_TIMEOUT_OPTION_NAME,
+        PEER_ID_OPTION_NAME);
   }
 
   @Override


[ratis] 04/04: Change version for the version 2.4.0 -rc3

Posted by dr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d6e99b118510fa7c16ae3e3f3d96665e9b50132b
Author: Yaolong Liu <ly...@163.com>
AuthorDate: Mon Oct 3 10:54:22 2022 +0800

    Change version for the version 2.4.0 -rc3
---
 pom.xml                       | 2 +-
 ratis-assembly/pom.xml        | 2 +-
 ratis-client/pom.xml          | 2 +-
 ratis-common/pom.xml          | 2 +-
 ratis-docs/pom.xml            | 2 +-
 ratis-examples/pom.xml        | 2 +-
 ratis-experiments/pom.xml     | 2 +-
 ratis-grpc/pom.xml            | 2 +-
 ratis-metrics/pom.xml         | 2 +-
 ratis-netty/pom.xml           | 2 +-
 ratis-proto/pom.xml           | 2 +-
 ratis-replicated-map/pom.xml  | 2 +-
 ratis-resource-bundle/pom.xml | 2 +-
 ratis-server-api/pom.xml      | 2 +-
 ratis-server/pom.xml          | 2 +-
 ratis-shell/pom.xml           | 2 +-
 ratis-test/pom.xml            | 2 +-
 ratis-tools/pom.xml           | 2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/pom.xml b/pom.xml
index 55a75c723..1ed06c943 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 
   <artifactId>ratis</artifactId>
   <groupId>org.apache.ratis</groupId>
-  <version>2.4.0-SNAPSHOT</version>
+  <version>2.4.0</version>
   <name>Apache Ratis</name>
   <packaging>pom</packaging>
   <description>
diff --git a/ratis-assembly/pom.xml b/ratis-assembly/pom.xml
index 0bd81aa9b..9b08ec120 100644
--- a/ratis-assembly/pom.xml
+++ b/ratis-assembly/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-assembly</artifactId>
diff --git a/ratis-client/pom.xml b/ratis-client/pom.xml
index ae5beb565..93c11f199 100644
--- a/ratis-client/pom.xml
+++ b/ratis-client/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-client</artifactId>
diff --git a/ratis-common/pom.xml b/ratis-common/pom.xml
index 732491135..22ead7bab 100644
--- a/ratis-common/pom.xml
+++ b/ratis-common/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-common</artifactId>
diff --git a/ratis-docs/pom.xml b/ratis-docs/pom.xml
index 19f00e851..8dc81a6b8 100644
--- a/ratis-docs/pom.xml
+++ b/ratis-docs/pom.xml
@@ -20,7 +20,7 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-docs</artifactId>
diff --git a/ratis-examples/pom.xml b/ratis-examples/pom.xml
index 9deb3f9bc..c84c7b0b3 100644
--- a/ratis-examples/pom.xml
+++ b/ratis-examples/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-examples</artifactId>
diff --git a/ratis-experiments/pom.xml b/ratis-experiments/pom.xml
index e6f6fb8c2..b9aa0f403 100644
--- a/ratis-experiments/pom.xml
+++ b/ratis-experiments/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-experiments</artifactId>
diff --git a/ratis-grpc/pom.xml b/ratis-grpc/pom.xml
index af3f4865b..37164689e 100644
--- a/ratis-grpc/pom.xml
+++ b/ratis-grpc/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-grpc</artifactId>
diff --git a/ratis-metrics/pom.xml b/ratis-metrics/pom.xml
index 8742c7beb..e708e26aa 100644
--- a/ratis-metrics/pom.xml
+++ b/ratis-metrics/pom.xml
@@ -18,7 +18,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-metrics</artifactId>
diff --git a/ratis-netty/pom.xml b/ratis-netty/pom.xml
index 954f1c89c..fe5ca78e7 100644
--- a/ratis-netty/pom.xml
+++ b/ratis-netty/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-netty</artifactId>
diff --git a/ratis-proto/pom.xml b/ratis-proto/pom.xml
index ea25145bd..40641afa5 100644
--- a/ratis-proto/pom.xml
+++ b/ratis-proto/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-proto</artifactId>
diff --git a/ratis-replicated-map/pom.xml b/ratis-replicated-map/pom.xml
index c4ce6fa75..4a209ce7a 100644
--- a/ratis-replicated-map/pom.xml
+++ b/ratis-replicated-map/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-replicated-map</artifactId>
diff --git a/ratis-resource-bundle/pom.xml b/ratis-resource-bundle/pom.xml
index c19ae36ad..342a9ae37 100644
--- a/ratis-resource-bundle/pom.xml
+++ b/ratis-resource-bundle/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
     <relativePath>..</relativePath>
   </parent>
 
diff --git a/ratis-server-api/pom.xml b/ratis-server-api/pom.xml
index a1a5be4e1..81747408c 100644
--- a/ratis-server-api/pom.xml
+++ b/ratis-server-api/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-server-api</artifactId>
diff --git a/ratis-server/pom.xml b/ratis-server/pom.xml
index 43c5f3a32..92d2830d6 100644
--- a/ratis-server/pom.xml
+++ b/ratis-server/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-server</artifactId>
diff --git a/ratis-shell/pom.xml b/ratis-shell/pom.xml
index c3b8d5e76..0218becba 100644
--- a/ratis-shell/pom.xml
+++ b/ratis-shell/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-shell</artifactId>
diff --git a/ratis-test/pom.xml b/ratis-test/pom.xml
index 0a13d01d3..431364bde 100644
--- a/ratis-test/pom.xml
+++ b/ratis-test/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-test</artifactId>
diff --git a/ratis-tools/pom.xml b/ratis-tools/pom.xml
index be76a9e51..f8c1261ed 100644
--- a/ratis-tools/pom.xml
+++ b/ratis-tools/pom.xml
@@ -17,7 +17,7 @@
   <parent>
     <artifactId>ratis</artifactId>
     <groupId>org.apache.ratis</groupId>
-    <version>2.4.0-SNAPSHOT</version>
+    <version>2.4.0</version>
   </parent>
 
   <artifactId>ratis-tools</artifactId>