You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2023/03/03 03:22:34 UTC
[ratis] branch master updated: RATIS-1798. Make ratis-shell command respect GENERIC_COMMAND_OPTIONS (#834)
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 b5f9c0f50 RATIS-1798. Make ratis-shell command respect GENERIC_COMMAND_OPTIONS (#834)
b5f9c0f50 is described below
commit b5f9c0f503ae5ec5765cd3e0758aa9b9e5448980
Author: Angerszhuuuu <an...@gmail.com>
AuthorDate: Fri Mar 3 11:22:29 2023 +0800
RATIS-1798. Make ratis-shell command respect GENERIC_COMMAND_OPTIONS (#834)
---
.../src/main/java/org/apache/ratis/shell/cli/RaftUtils.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ratis-shell/src/main/java/org/apache/ratis/shell/cli/RaftUtils.java b/ratis-shell/src/main/java/org/apache/ratis/shell/cli/RaftUtils.java
index dfbfdd32f..1239fc56c 100644
--- a/ratis-shell/src/main/java/org/apache/ratis/shell/cli/RaftUtils.java
+++ b/ratis-shell/src/main/java/org/apache/ratis/shell/cli/RaftUtils.java
@@ -26,6 +26,7 @@ import org.apache.ratis.retry.ExponentialBackoffRetry;
import org.apache.ratis.util.TimeDuration;
import java.net.InetSocketAddress;
+import java.util.Properties;
import java.util.concurrent.TimeUnit;
/**
@@ -67,6 +68,12 @@ public final class RaftUtils {
RaftProperties properties = new RaftProperties();
RaftClientConfigKeys.Rpc.setRequestTimeout(properties,
TimeDuration.valueOf(15, TimeUnit.SECONDS));
+
+ // Since ratis-shell support GENERIC_COMMAND_OPTIONS, here we should
+ // merge these options to raft properties to make it work.
+ final Properties sys = System.getProperties();
+ sys.stringPropertyNames().forEach(key -> properties.set(key, sys.getProperty(key)));
+
ExponentialBackoffRetry retryPolicy = ExponentialBackoffRetry.newBuilder()
.setBaseSleepTime(TimeDuration.valueOf(1000, TimeUnit.MILLISECONDS))
.setMaxAttempts(10)