You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by vi...@apache.org on 2021/08/17 23:21:35 UTC
[ozone] branch master updated: HDDS-5054. Merge SCM HA configs to
ScmConfigKeys. (#2506)
This is an automated email from the ASF dual-hosted git repository.
vivekratnavel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new bbf9acf HDDS-5054. Merge SCM HA configs to ScmConfigKeys. (#2506)
bbf9acf is described below
commit bbf9acf87b2df8d0023f13d978b51ed3045474b9
Author: Aswin Shakil Balasubramanian <as...@gmail.com>
AuthorDate: Tue Aug 17 19:21:18 2021 -0400
HDDS-5054. Merge SCM HA configs to ScmConfigKeys. (#2506)
---
.../org/apache/hadoop/hdds/scm/ScmConfigKeys.java | 75 +++++
.../hadoop/hdds/scm/ha/SCMHAConfiguration.java | 320 ---------------------
.../org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java | 4 +-
.../common/src/main/resources/ozone-default.xml | 115 ++++++++
.../hadoop/hdds/scm/ha/InterSCMGrpcClient.java | 7 +-
.../org/apache/hadoop/hdds/scm/ha/RatisUtil.java | 131 ++++++---
.../hadoop/hdds/scm/ha/SCMRatisServerImpl.java | 26 +-
.../hadoop/hdds/scm/ha/TestSCMHAConfiguration.java | 25 --
.../hadoop/hdds/scm/TestSCMInstallSnapshot.java | 10 +-
.../apache/hadoop/hdds/scm/TestSCMSnapshot.java | 6 +-
.../hadoop/ozone/TestStorageContainerManager.java | 3 +-
.../hadoop/ozone/scm/TestFailoverWithSCMHA.java | 8 +-
.../ozone/scm/TestSCMInstallSnapshotWithHA.java | 12 +-
13 files changed, 317 insertions(+), 425 deletions(-)
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java
index 0394591..e61ccea 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java
@@ -475,6 +475,81 @@ public final class ScmConfigKeys {
OZONE_SCM_EVENT_PREFIX + "ContainerReport.thread.pool.size";
public static final int OZONE_SCM_EVENT_THREAD_POOL_SIZE_DEFAULT = 10;
+ public static final String OZONE_SCM_HA_RATIS_RPC_TYPE =
+ "ozone.scm.ha.ratis.rpc.type";
+ public static final String OZONE_SCM_HA_RATIS_RPC_TYPE_DEFAULT =
+ "GRPC";
+
+ public static final String OZONE_SCM_HA_RAFT_SEGMENT_SIZE =
+ "ozone.scm.ha.ratis.segment.size";
+ public static final String OZONE_SCM_HA_RAFT_SEGMENT_SIZE_DEFAULT = "16KB";
+
+ public static final String OZONE_SCM_HA_RAFT_SEGMENT_PRE_ALLOCATED_SIZE =
+ "ozone.scm.ha.ratis.segment.preallocated.size";
+ public static final String
+ OZONE_SCM_HA_RAFT_SEGMENT_PRE_ALLOCATED_SIZE_DEFAULT = "16KB";
+
+ public static final String OZONE_SCM_HA_RAFT_LOG_APPENDER_QUEUE_BYTE_LIMIT =
+ "ozone.scm.ha.ratis.log.appender.queue.byte-limit";
+ public static final String
+ OZONE_SCM_HA_RAFT_LOG_APPENDER_QUEUE_BYTE_LIMIT_DEFAULT = "32MB";
+
+ public static final String OZONE_SCM_HA_GRPC_DEADLINE_INTERVAL =
+ "ozone.scm.ha.grpc.deadline.interval";
+ public static final long
+ OZONE_SCM_HA_GRPC_DEADLINE_INTERVAL_DEFAULT = 30 * 60 * 1000L;
+
+ public static final String OZONE_SCM_HA_RATIS_NODE_FAILURE_TIMEOUT =
+ "ozone.scm.ha.ratis.server.failure.timeout.duration";
+ public static final long
+ OZONE_SCM_HA_RATIS_NODE_FAILURE_TIMEOUT_DEFAULT = 120 * 1000L;
+
+ public static final String OZONE_SCM_HA_RATIS_LEADER_READY_CHECK_INTERVAL =
+ "ozone.scm.ha.ratis.leader.ready.check.interval";
+ public static final long
+ OZONE_SCM_HA_RATIS_LEADER_READY_CHECK_INTERVAL_DEFAULT = 2 * 1000L;
+
+ public static final String OZONE_SCM_HA_RATIS_LEADER_READY_WAIT_TIMEOUT =
+ "ozone.scm.ha.ratis.leader.ready.wait.timeout";
+ public static final long
+ OZONE_SCM_HA_RATIS_LEADER_READY_WAIT_TIMEOUT_DEFAULT = 60 * 1000L;
+
+ public static final String OZONE_SCM_HA_RATIS_RETRY_CACHE_TIMEOUT =
+ "ozone.scm.ha.ratis.server.retry.cache.timeout";
+ public static final long
+ OZONE_SCM_HA_RATIS_RETRY_CACHE_TIMEOUT_DEFAULT = 60 * 1000L;
+
+ public static final String OZONE_SCM_HA_RATIS_STORAGE_DIR =
+ "ozone.scm.ha.ratis.storage.dir";
+
+ public static final String OZONE_SCM_HA_RAFT_LOG_PURGE_ENABLED =
+ "ozone.scm.ha.ratis.log.purge.enabled";
+ public static final boolean OZONE_SCM_HA_RAFT_LOG_PURGE_ENABLED_DEFAULT =
+ false;
+
+ public static final String OZONE_SCM_HA_RAFT_LOG_PURGE_GAP =
+ "ozone.scm.ha.ratis.log.purge.gap";
+ public static final int OZONE_SCM_HA_RAFT_LOG_PURGE_GAP_DEFAULT =1000000;
+
+ public static final String OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD =
+ "ozone.scm.ha.ratis.snapshot.threshold";
+ public static final long OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD_DEFAULT =
+ 1000L;
+
+ public static final String OZONE_SCM_HA_RATIS_SNAPSHOT_DIR =
+ "ozone.scm.ha.ratis.snapshot.dir";
+
+ public static final String OZONE_SCM_HA_RATIS_LEADER_ELECTION_TIMEOUT =
+ "ozone.scm.ha.ratis.leader.election.timeout";
+ public static final long
+ OZONE_SCM_HA_RATIS_LEADER_ELECTION_TIMEOUT_DEFAULT = 5 * 1000L;
+
+ public static final String OZONE_SCM_HA_RATIS_REQUEST_TIMEOUT =
+ "ozone.scm.ha.ratis.request.timeout";
+ public static final long
+ OZONE_SCM_HA_RATIS_REQUEST_TIMEOUT_DEFAULT = 30 * 1000L;
+
+
/**
* Never constructed.
*/
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAConfiguration.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAConfiguration.java
deleted file mode 100644
index 1f0dfe5..0000000
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAConfiguration.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * <p>http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * <p>Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.hdds.scm.ha;
-
-import java.net.InetSocketAddress;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.hdds.conf.Config;
-import org.apache.hadoop.hdds.conf.ConfigGroup;
-import org.apache.hadoop.hdds.conf.ConfigType;
-import org.apache.hadoop.net.NetUtils;
-
-import static org.apache.hadoop.hdds.conf.ConfigTag.HA;
-import static org.apache.hadoop.hdds.conf.ConfigTag.OZONE;
-import static org.apache.hadoop.hdds.conf.ConfigTag.RATIS;
-import static org.apache.hadoop.hdds.conf.ConfigTag.SCM;
-
-/**
- * Configuration used by SCM HA.
- */
-@ConfigGroup(prefix = "ozone.scm.ha")
-public class SCMHAConfiguration {
-
- @Config(key = "ratis.storage.dir",
- type = ConfigType.STRING,
- defaultValue = "",
- tags = {OZONE, SCM, HA, RATIS},
- description = "Storage directory used by SCM to write Ratis logs."
- )
- private String ratisStorageDir;
-
- @Config(key = "ratis.bind.host",
- type = ConfigType.STRING,
- defaultValue = "0.0.0.0",
- tags = {OZONE, SCM, HA, RATIS},
- description = "Host used by SCM for binding Ratis Server."
- )
- private String ratisBindHost = "0.0.0.0";
-
- @Config(key = "ratis.bind.port",
- type = ConfigType.INT,
- defaultValue = "9894",
- tags = {OZONE, SCM, HA, RATIS},
- description = "Port used by SCM for Ratis Server."
- )
- private int ratisBindPort = 9894;
-
-
- @Config(key = "ratis.rpc.type",
- type = ConfigType.STRING,
- defaultValue = "GRPC",
- tags = {SCM, OZONE, HA, RATIS},
- description = "Ratis supports different kinds of transports like" +
- " netty, GRPC, Hadoop RPC etc. This picks one of those for" +
- " this cluster."
- )
- private String ratisRpcType;
-
- @Config(key = "ratis.segment.size",
- type = ConfigType.SIZE,
- defaultValue = "16KB",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The size of the raft segment used by Apache Ratis on" +
- " SCM. (16 KB by default)"
- )
- private long raftSegmentSize = 16L * 1024L;
-
- @Config(key = "ratis.segment.preallocated.size",
- type = ConfigType.SIZE,
- defaultValue = "16KB",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The size of the buffer which is preallocated for" +
- " raft segment used by Apache Ratis on SCM.(16 KB by default)"
- )
- private long raftSegmentPreAllocatedSize = 16L * 1024L;
-
- @Config(key = "ratis.log.appender.queue.num-elements",
- type = ConfigType.INT,
- defaultValue = "1024",
- tags = {SCM, OZONE, HA, RATIS},
- description = "Number of operation pending with Raft's Log Worker."
- )
- private int raftLogAppenderQueueNum = 1024;
-
- @Config(key = "ratis.log.appender.queue.byte-limit",
- type = ConfigType.SIZE,
- defaultValue = "32MB",
- tags = {SCM, OZONE, HA, RATIS},
- description = "Byte limit for Raft's Log Worker queue."
- )
- private int raftLogAppenderQueueByteLimit = 32 * 1024 * 1024;
-
- @Config(key = "ratis.log.purge.enabled",
- type = ConfigType.BOOLEAN,
- defaultValue = "false",
- tags = {SCM, OZONE, HA, RATIS},
- description = "whether enable raft log purge."
- )
- private boolean raftLogPurgeEnabled = false;
-
- @Config(key = "ratis.log.purge.gap",
- type = ConfigType.INT,
- defaultValue = "1000000",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The minimum gap between log indices for Raft server to" +
- " purge its log segments after taking snapshot."
- )
- private int raftLogPurgeGap = 1000000;
-
- @Config(key = "ratis.snapshot.threshold",
- type = ConfigType.LONG,
- defaultValue = "1000",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The threshold to trigger a Ratis taking snapshot " +
- "operation for SCM")
- private long ratisSnapshotThreshold = 1000L;
-
- @Config(key = "ratis.request.timeout",
- type = ConfigType.TIME,
- defaultValue = "30s",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The timeout duration for SCM's Ratis server RPC."
- )
- private long ratisRequestTimeout = 30 * 1000L;
-
- @Config(key = "ratis.server.retry.cache.timeout",
- type = ConfigType.TIME,
- defaultValue = "60s",
- tags = {SCM, OZONE, HA, RATIS},
- description = "Retry Cache entry timeout for SCM's ratis server."
- )
- private long ratisRetryCacheTimeout = 60 * 1000L;
-
-
- @Config(key = "ratis.leader.election.timeout",
- type = ConfigType.TIME,
- defaultValue = "5s",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The minimum timeout duration for SCM ratis leader" +
- " election. Default is 1s."
- )
- private long ratisLeaderElectionTimeout = 5 * 1000L;
-
- @Config(key = "ratis.leader.ready.wait.timeout",
- type = ConfigType.TIME,
- defaultValue = "60s",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The minimum timeout duration for waiting for" +
- "leader readiness"
- )
- private long ratisLeaderReadyWaitTimeout = 60 * 1000L;
-
- @Config(key = "ratis.leader.ready.check.interval",
- type = ConfigType.TIME,
- defaultValue = "2s",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The interval between ratis server performing" +
- "a leader readiness check"
- )
- private long ratisLeaderReadyCheckInterval = 2 * 1000L;
-
- @Config(key = "ratis.server.failure.timeout.duration",
- type = ConfigType.TIME,
- defaultValue = "120s",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The timeout duration for ratis server failure" +
- " detection, once the threshold has reached, the ratis state" +
- " machine will be informed about the failure in the ratis ring."
- )
- private long ratisNodeFailureTimeout = 120 * 1000L;
-
- @Config(key = "ratis.server.role.check.interval",
- type = ConfigType.TIME,
- defaultValue = "15s",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The interval between SCM leader performing a role" +
- " check on its ratis server. Ratis server informs SCM if it loses" +
- " the leader role. The scheduled check is an secondary check to" +
- " ensure that the leader role is updated periodically"
- )
- private long ratisRoleCheckerInterval = 15 * 1000L;
-
- @Config(key = "ratis.snapshot.dir",
- type = ConfigType.STRING,
- defaultValue = "",
- tags = {SCM, OZONE, HA, RATIS},
- description = "The ratis snapshot dir location"
- )
- private String ratisSnapshotDir;
-
- @Config(key = "grpc.deadline.interval",
- type = ConfigType.TIME,
- defaultValue = "30m",
- tags = {OZONE, SCM, HA, RATIS},
- description = "Deadline for SCM DB checkpoint interval."
- )
- private long grpcDeadlineInterval = 30 * 60 * 1000L;
-
- public long getGrpcDeadlineInterval() {
- return grpcDeadlineInterval;
- }
-
-
- public String getRatisStorageDir() {
- return ratisStorageDir;
- }
-
- public String getRatisSnapshotDir() {
- return ratisSnapshotDir;
- }
-
- public void setRatisStorageDir(String dir) {
- this.ratisStorageDir = dir;
- }
-
- public void setRatisSnapshotDir(String dir) {
- this.ratisSnapshotDir = dir;
- }
-
- public void setRaftLogPurgeGap(int gap) {
- this.raftLogPurgeGap = gap;
- }
-
- public InetSocketAddress getRatisBindAddress() {
- return NetUtils.createSocketAddr(ratisBindHost, ratisBindPort);
- }
-
- public String getRatisRpcType() {
- return ratisRpcType;
- }
-
- public long getRaftSegmentSize() {
- return raftSegmentSize;
- }
-
- public long getRaftSegmentPreAllocatedSize() {
- return raftSegmentPreAllocatedSize;
- }
-
- public int getRaftLogAppenderQueueNum() {
- return raftLogAppenderQueueNum;
- }
-
- public int getRaftLogAppenderQueueByteLimit() {
- return raftLogAppenderQueueByteLimit;
- }
-
- public boolean getRaftLogPurgeEnabled() {
- return raftLogPurgeEnabled;
- }
-
- public void setRaftLogPurgeEnabled(boolean enabled) {
- this.raftLogPurgeEnabled = enabled;
- }
-
- public int getRaftLogPurgeGap() {
- return raftLogPurgeGap;
- }
-
- public long getRatisSnapshotThreshold() {
- return ratisSnapshotThreshold;
- }
-
- public void setRatisSnapshotThreshold(long threshold) {
- this.ratisSnapshotThreshold = threshold;
- }
-
- public long getRatisRetryCacheTimeout() {
- return ratisRetryCacheTimeout;
- }
-
- public long getRatisRequestTimeout() {
- Preconditions.checkArgument(ratisRequestTimeout > 1000L,
- "Ratis request timeout cannot be less than 1000ms.");
- return ratisRequestTimeout;
- }
-
- public long getLeaderElectionMinTimeout() {
- return ratisLeaderElectionTimeout;
- }
-
- public long getLeaderElectionMaxTimeout() {
- return ratisLeaderElectionTimeout + 200L;
- }
-
- public long getLeaderReadyWaitTimeout() {
- return ratisLeaderReadyWaitTimeout;
- }
-
- public void setLeaderReadyWaitTimeout(long mills) {
- ratisLeaderReadyWaitTimeout = mills;
- }
-
- public long getLeaderReadyCheckInterval() {
- return ratisLeaderReadyCheckInterval;
- }
-
- public long getRatisNodeFailureTimeout() {
- return ratisNodeFailureTimeout;
- }
-
- public long getRatisRoleCheckerInterval() {
- return ratisRoleCheckerInterval;
- }
-}
\ No newline at end of file
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
index b5271fb..3dba07f 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
@@ -127,7 +127,7 @@ public final class SCMHAUtils {
*/
public static String getSCMRatisDirectory(ConfigurationSource conf) {
String scmRatisDirectory =
- conf.getObject(SCMHAConfiguration.class).getRatisStorageDir();
+ conf.get(ScmConfigKeys.OZONE_SCM_HA_RATIS_STORAGE_DIR);
if (Strings.isNullOrEmpty(scmRatisDirectory)) {
scmRatisDirectory = ServerUtils.getDefaultRatisDirectory(conf);
@@ -137,7 +137,7 @@ public final class SCMHAUtils {
public static String getSCMRatisSnapshotDirectory(ConfigurationSource conf) {
String snapshotDir =
- conf.getObject(SCMHAConfiguration.class).getRatisStorageDir();
+ conf.get(ScmConfigKeys.OZONE_SCM_HA_RATIS_STORAGE_DIR);
// If ratis snapshot directory is not set, fall back to ozone.metadata.dir.
if (Strings.isNullOrEmpty(snapshotDir)) {
diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml b/hadoop-hdds/common/src/main/resources/ozone-default.xml
index 5e480ae..3a15d4d 100644
--- a/hadoop-hdds/common/src/main/resources/ozone-default.xml
+++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml
@@ -2815,6 +2815,121 @@
will not be allocated a pipeline or container replica.
</description>
</property>
+ <property>
+ <name>ozone.scm.ha.ratis.storage.dir</name>
+ <value></value>
+ <tag>OZONE, SCM, HA, RATIS</tag>
+ <description>Storage directory used by SCM to write Ratis logs.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.rpc.type</name>
+ <value>GRPC</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>Ratis supports different kinds of transports like
+ netty, GRPC, Hadoop RPC etc. This picks one of those for
+ this cluster.
+ </description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.segment.size</name>
+ <value>16KB</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The size of the raft segment used by Apache Ratis on
+ SCM. (16 KB by default)
+ </description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.segment.preallocated.size</name>
+ <value>16KB</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The size of the buffer which is preallocated for
+ raft segment used by Apache Ratis on SCM.(16 KB by default)
+ </description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.log.appender.queue.byte-limit</name>
+ <value>32MB</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>Byte limit for Raft's Log Worker queue.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.log.purge.enabled</name>
+ <value>false</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>whether enable raft log purge.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.log.purge.gap</name>
+ <value>1000000</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The minimum gap between log indices for Raft server to
+ purge its log segments after taking snapshot.
+ </description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.snapshot.threshold</name>
+ <value>1000</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The threshold to trigger a Ratis taking snapshot
+ operation for SCM.
+ </description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.request.timeout</name>
+ <value>30s</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The timeout duration for SCM's Ratis server RPC.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.server.retry.cache.timeout</name>
+ <value>60s</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>Retry Cache entry timeout for SCM's Ratis server.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.leader.election.timeout</name>
+ <value>5s</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The minimum timeout duration for SCM ratis leader
+ election. Default is 1s.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.leader.ready.wait.timeout</name>
+ <value>60s</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The minimum timeout duration for waiting for
+ leader readiness.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.leader.ready.check.interval</name>
+ <value>2s</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The interval between ratis server performing
+ a leader readiness check.
+ </description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.server.failure.timeout.duration</name>
+ <value>120s</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The timeout duration for ratis server failure
+ detection, once the threshold has reached, the ratis state
+ machine will be informed about the failure in the ratis ring.
+ </description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.ratis.snapshot.dir</name>
+ <value></value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>The ratis snapshot dir location.</description>
+ </property>
+ <property>
+ <name>ozone.scm.ha.grpc.deadline.interval</name>
+ <value>30m</value>
+ <tag>SCM, OZONE, HA, RATIS</tag>
+ <description>Deadline for SCM DB checkpoint interval.</description>
+ </property>
+
<property>
<name>ozone.s3g.kerberos.keytab.file</name>
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcClient.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcClient.java
index 11e05d5..f565ac0 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcClient.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcClient.java
@@ -22,6 +22,7 @@ import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolProtos;
import org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolProtos.CopyDBCheckpointResponseProto;
import org.apache.hadoop.hdds.protocol.scm.proto.InterSCMProtocolServiceGrpc;
+import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.security.x509.SecurityConfig;
import org.apache.hadoop.hdds.security.x509.certificate.client.SCMCertificateClient;
import org.apache.hadoop.ozone.OzoneConsts;
@@ -60,8 +61,10 @@ public class InterSCMGrpcClient implements SCMSnapshotDownloader {
int port, final ConfigurationSource conf,
SCMCertificateClient scmCertificateClient) throws IOException {
Preconditions.checkNotNull(conf);
- timeout =
- conf.getObject(SCMHAConfiguration.class).getGrpcDeadlineInterval();
+ timeout = conf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_GRPC_DEADLINE_INTERVAL,
+ ScmConfigKeys.OZONE_SCM_HA_GRPC_DEADLINE_INTERVAL_DEFAULT,
+ TimeUnit.MILLISECONDS);
NettyChannelBuilder channelBuilder =
NettyChannelBuilder.forAddress(host, port).usePlaintext()
.maxInboundMessageSize(OzoneConsts.OZONE_SCM_CHUNK_MAX_SIZE);
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/RatisUtil.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/RatisUtil.java
index 63545dd..327b6ba 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/RatisUtil.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/RatisUtil.java
@@ -17,9 +17,11 @@
package org.apache.hadoop.hdds.scm.ha;
+import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.protobuf.ServiceException;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
+import org.apache.hadoop.hdds.conf.StorageUnit;
import org.apache.hadoop.hdds.ratis.ServerNotLeaderException;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.security.exception.SCMSecurityException;
@@ -57,21 +59,21 @@ public final class RatisUtil {
/**
- * Constructs new Raft Properties instance using {@link SCMHAConfiguration}.
- * @param haConf SCMHAConfiguration
+ * Constructs new Raft Properties instance using {@link ConfigurationSource}.
+ *
* @param conf ConfigurationSource
*/
public static RaftProperties newRaftProperties(
- final SCMHAConfiguration haConf, final ConfigurationSource conf) {
+ final ConfigurationSource conf) {
//TODO: Remove ConfigurationSource!
// TODO: Check the default values.
final RaftProperties properties = new RaftProperties();
- setRaftStorageDir(properties, haConf, conf);
- setRaftRpcProperties(properties, haConf, conf);
- setRaftLogProperties(properties, haConf);
- setRaftRetryCacheProperties(properties, haConf);
- setRaftSnapshotProperties(properties, haConf);
- setRaftLeadElectionProperties(properties, haConf);
+ setRaftStorageDir(properties, conf);
+ setRaftRpcProperties(properties, conf);
+ setRaftLogProperties(properties, conf);
+ setRaftRetryCacheProperties(properties, conf);
+ setRaftSnapshotProperties(properties, conf);
+ setRaftLeadElectionProperties(properties);
return properties;
}
@@ -79,19 +81,16 @@ public final class RatisUtil {
* Set the local directory where ratis logs will be stored.
*
* @param properties RaftProperties instance which will be updated
- * @param haConf SCMHAConfiguration
* @param conf ConfigurationSource
*/
public static void setRaftStorageDir(final RaftProperties properties,
- final SCMHAConfiguration haConf,
final ConfigurationSource conf) {
RaftServerConfigKeys.setStorageDir(properties,
- Collections.singletonList(new File(getRatisStorageDir(haConf, conf))));
+ Collections.singletonList(new File(getRatisStorageDir(conf))));
}
- public static String getRatisStorageDir(final SCMHAConfiguration haConf,
- final ConfigurationSource conf) {
- String storageDir = haConf.getRatisStorageDir();
+ public static String getRatisStorageDir(final ConfigurationSource conf) {
+ String storageDir = conf.get(ScmConfigKeys.OZONE_SCM_HA_RATIS_STORAGE_DIR);
if (Strings.isNullOrEmpty(storageDir)) {
File metaDirPath = ServerUtils.getOzoneMetaDirPath(conf);
storageDir = (new File(metaDirPath, "scm-ha")).getPath();
@@ -102,36 +101,57 @@ public final class RatisUtil {
* Set properties related to Raft RPC.
*
* @param properties RaftProperties instance which will be updated
- * @param conf SCMHAConfiguration
+ * @param ozoneConf ConfigurationSource
*/
private static void setRaftRpcProperties(final RaftProperties properties,
- final SCMHAConfiguration conf, ConfigurationSource ozoneConf) {
+ ConfigurationSource ozoneConf) {
RaftConfigKeys.Rpc.setType(properties,
- RpcType.valueOf(conf.getRatisRpcType()));
+ RpcType.valueOf(ozoneConf.get(ScmConfigKeys.OZONE_SCM_HA_RATIS_RPC_TYPE,
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_RPC_TYPE_DEFAULT)));
GrpcConfigKeys.Server.setPort(properties, ozoneConf
.getInt(ScmConfigKeys.OZONE_SCM_RATIS_PORT_KEY,
ScmConfigKeys.OZONE_SCM_RATIS_PORT_DEFAULT));
GrpcConfigKeys.setMessageSizeMax(properties,
SizeInBytes.valueOf("32m"));
-
+ long ratisRequestTimeout = ozoneConf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_REQUEST_TIMEOUT,
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_REQUEST_TIMEOUT_DEFAULT,
+ TimeUnit.MILLISECONDS);
+ Preconditions.checkArgument(ratisRequestTimeout > 1000L,
+ "Ratis request timeout cannot be less than 1000ms.");
Rpc.setRequestTimeout(properties, TimeDuration.valueOf(
- conf.getRatisRequestTimeout(), TimeUnit.MILLISECONDS));
+ ratisRequestTimeout, TimeUnit.MILLISECONDS));
Rpc.setTimeoutMin(properties, TimeDuration.valueOf(
- conf.getLeaderElectionMinTimeout(), TimeUnit.MILLISECONDS));
+ ozoneConf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_LEADER_ELECTION_TIMEOUT,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RATIS_LEADER_ELECTION_TIMEOUT_DEFAULT,
+ TimeUnit.MILLISECONDS),
+ TimeUnit.MILLISECONDS));
Rpc.setTimeoutMax(properties, TimeDuration.valueOf(
- conf.getLeaderElectionMaxTimeout(), TimeUnit.MILLISECONDS));
+ ozoneConf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_LEADER_ELECTION_TIMEOUT,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RATIS_LEADER_ELECTION_TIMEOUT_DEFAULT,
+ TimeUnit.MILLISECONDS)+200L,
+ TimeUnit.MILLISECONDS));
Rpc.setSlownessTimeout(properties, TimeDuration.valueOf(
- conf.getRatisNodeFailureTimeout(), TimeUnit.MILLISECONDS));
+ ozoneConf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_NODE_FAILURE_TIMEOUT,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RATIS_NODE_FAILURE_TIMEOUT_DEFAULT,
+ TimeUnit.MILLISECONDS),
+ TimeUnit.MILLISECONDS));
}
/**
* Set properties related to Raft leader election.
*
* @param properties RaftProperties instance which will be updated
- * @param conf SCMHAConfiguration
+ *
*/
private static void setRaftLeadElectionProperties(
- final RaftProperties properties, final SCMHAConfiguration conf) {
+ final RaftProperties properties) {
// Disable the pre vote feature (related to leader election) in Ratis
RaftServerConfigKeys.LeaderElection.setPreVote(properties, false);
}
@@ -140,21 +160,40 @@ public final class RatisUtil {
* Set properties related to Raft Log.
*
* @param properties RaftProperties instance which will be updated
- * @param conf SCMHAConfiguration
+ * @param ozoneConf ConfigurationSource
*/
private static void setRaftLogProperties(final RaftProperties properties,
- final SCMHAConfiguration conf) {
- Log.setSegmentSizeMax(properties,
- SizeInBytes.valueOf(conf.getRaftSegmentSize()));
+ final ConfigurationSource ozoneConf) {
+ Log.setSegmentSizeMax(properties, SizeInBytes.valueOf((long)
+ ozoneConf.getStorageSize(
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_SEGMENT_SIZE,
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_SEGMENT_SIZE_DEFAULT,
+ StorageUnit.BYTES)));
Log.Appender.setBufferElementLimit(properties,
- conf.getRaftLogAppenderQueueByteLimit());
- Log.Appender.setBufferByteLimit(properties,
- SizeInBytes.valueOf(conf.getRaftLogAppenderQueueByteLimit()));
- Log.setPreallocatedSize(properties,
- SizeInBytes.valueOf(conf.getRaftSegmentPreAllocatedSize()));
+ (int) ozoneConf.getStorageSize(
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_APPENDER_QUEUE_BYTE_LIMIT,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RAFT_LOG_APPENDER_QUEUE_BYTE_LIMIT_DEFAULT,
+ StorageUnit.BYTES));
+ Log.Appender.setBufferByteLimit(properties, SizeInBytes.valueOf(
+ (long) ozoneConf.getStorageSize(
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_APPENDER_QUEUE_BYTE_LIMIT,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RAFT_LOG_APPENDER_QUEUE_BYTE_LIMIT_DEFAULT,
+ StorageUnit.BYTES)));
+ Log.setPreallocatedSize(properties, SizeInBytes.valueOf(
+ (long) ozoneConf.getStorageSize(
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_SEGMENT_PRE_ALLOCATED_SIZE,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RAFT_SEGMENT_PRE_ALLOCATED_SIZE_DEFAULT,
+ StorageUnit.BYTES)));
Log.Appender.setInstallSnapshotEnabled(properties, false);
- Log.setPurgeUptoSnapshotIndex(properties, conf.getRaftLogPurgeEnabled());
- Log.setPurgeGap(properties, conf.getRaftLogPurgeGap());
+ Log.setPurgeUptoSnapshotIndex(properties, ozoneConf.getBoolean(
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_PURGE_ENABLED,
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_PURGE_ENABLED_DEFAULT));
+ Log.setPurgeGap(properties,
+ ozoneConf.getInt(ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_PURGE_GAP,
+ ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_PURGE_GAP_DEFAULT));
Log.setSegmentCacheNumMax(properties, 2);
}
@@ -162,25 +201,33 @@ public final class RatisUtil {
* Set properties related to Raft Retry Cache.
*
* @param properties RaftProperties instance which will be updated
- * @param conf SCMHAConfiguration
+ * @param ozoneConf ConfigurationSource
*/
private static void setRaftRetryCacheProperties(
- final RaftProperties properties, final SCMHAConfiguration conf) {
+ final RaftProperties properties,
+ final ConfigurationSource ozoneConf) {
RetryCache.setExpiryTime(properties, TimeDuration.valueOf(
- conf.getRatisRetryCacheTimeout(), TimeUnit.MILLISECONDS));
+ ozoneConf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_RETRY_CACHE_TIMEOUT,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RATIS_RETRY_CACHE_TIMEOUT_DEFAULT,
+ TimeUnit.MILLISECONDS),
+ TimeUnit.MILLISECONDS));
}
/**
* Set properties related to Raft Snapshot.
*
* @param properties RaftProperties instance which will be updated
- * @param conf SCMHAConfiguration
+ * @param ozoneConf ConfigurationSource
*/
private static void setRaftSnapshotProperties(
- final RaftProperties properties, final SCMHAConfiguration conf) {
+ final RaftProperties properties,
+ final ConfigurationSource ozoneConf) {
Snapshot.setAutoTriggerEnabled(properties, true);
Snapshot.setAutoTriggerThreshold(properties,
- conf.getRatisSnapshotThreshold());
+ ozoneConf.getLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD,
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD_DEFAULT));
}
public static void checkRatisException(IOException e, String port,
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
index 6ab46f5..e5fe91b 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.SCMRatisProtocol.RequestType;
import org.apache.hadoop.hdds.scm.AddSCMRequest;
+import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.hdds.security.x509.SecurityConfig;
@@ -67,6 +68,7 @@ public class SCMRatisServerImpl implements SCMRatisServer {
private static final Logger LOG =
LoggerFactory.getLogger(SCMRatisServerImpl.class);
+ private final OzoneConfiguration ozoneConf = new OzoneConfiguration();
private final RaftServer server;
private final SCMStateMachine stateMachine;
private final StorageContainerManager scm;
@@ -134,9 +136,15 @@ public class SCMRatisServerImpl implements SCMRatisServer {
OzoneConfiguration conf, RaftGroup group) throws IOException {
boolean ready;
long st = Time.monotonicNow();
- final SCMHAConfiguration haConf = conf.getObject(SCMHAConfiguration.class);
- long waitTimeout = haConf.getLeaderReadyWaitTimeout();
- long retryInterval = haConf.getLeaderReadyCheckInterval();
+ long waitTimeout = conf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_LEADER_READY_WAIT_TIMEOUT,
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_LEADER_READY_WAIT_TIMEOUT_DEFAULT,
+ TimeUnit.MILLISECONDS);
+ long retryInterval = conf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_LEADER_READY_CHECK_INTERVAL,
+ ScmConfigKeys.
+ OZONE_SCM_HA_RATIS_LEADER_READY_CHECK_INTERVAL_DEFAULT,
+ TimeUnit.MILLISECONDS);
do {
ready = server.getDivision(group.getGroupId()).getInfo().isLeaderReady();
@@ -158,9 +166,8 @@ public class SCMRatisServerImpl implements SCMRatisServer {
private static RaftServer.Builder newRaftServer(final String scmId,
final ConfigurationSource conf) {
- final SCMHAConfiguration haConf = conf.getObject(SCMHAConfiguration.class);
final RaftProperties serverProperties =
- RatisUtil.newRaftProperties(haConf, conf);
+ RatisUtil.newRaftProperties(conf);
return RaftServer.newBuilder().setServerId(RaftPeerId.getRaftPeerId(scmId))
.setProperties(serverProperties);
}
@@ -205,9 +212,12 @@ public class SCMRatisServerImpl implements SCMRatisServer {
.setType(RaftClientRequest.writeRequestType())
.build();
// any request submitted to
- final long requestTimeout =
- scm.getConfiguration().getObject(SCMHAConfiguration.class)
- .getRatisRequestTimeout();
+ final long requestTimeout = ozoneConf.getTimeDuration(
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_REQUEST_TIMEOUT,
+ ScmConfigKeys.OZONE_SCM_HA_RATIS_REQUEST_TIMEOUT_DEFAULT,
+ TimeUnit.MILLISECONDS);
+ Preconditions.checkArgument(requestTimeout > 1000L,
+ "Ratis request timeout cannot be less than 1000ms.");
final RaftClientReply raftClientReply =
server.submitClientRequestAsync(raftClientRequest)
.get(requestTimeout, TimeUnit.MILLISECONDS);
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAConfiguration.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAConfiguration.java
index 6f5eab4..9ec10fc 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAConfiguration.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAConfiguration.java
@@ -59,31 +59,6 @@ public class TestSCMHAConfiguration {
}
@Test
- public void testSetStorageDir() {
- SCMHAConfiguration scmhaConfiguration = conf.getObject(
- SCMHAConfiguration.class);
- scmhaConfiguration.setRatisStorageDir("scm-ratis");
- conf.setFromObject(scmhaConfiguration);
-
- scmhaConfiguration = conf.getObject(
- SCMHAConfiguration.class);
- Assert.assertEquals("scm-ratis", scmhaConfiguration.getRatisStorageDir());
- }
-
- @Test
- public void testRaftLogPurgeEnabled() {
- SCMHAConfiguration scmhaConfiguration = conf.getObject(
- SCMHAConfiguration.class);
- scmhaConfiguration.setRaftLogPurgeEnabled(true);
- conf.setFromObject(scmhaConfiguration);
-
- scmhaConfiguration = conf.getObject(
- SCMHAConfiguration.class);
- Assert.assertEquals(true, scmhaConfiguration.getRaftLogPurgeEnabled());
- }
-
-
- @Test
public void testSCMHAConfig() throws Exception {
String scmServiceId = "scmserviceId";
conf.set(ScmConfigKeys.OZONE_SCM_SERVICE_IDS_KEY, scmServiceId);
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java
index 83f51ac..3da1777 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java
@@ -22,7 +22,6 @@ import org.apache.hadoop.hdds.client.RatisReplicationConfig;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.scm.container.ContainerID;
import org.apache.hadoop.hdds.scm.container.ContainerManagerV2;
-import org.apache.hadoop.hdds.scm.ha.SCMHAConfiguration;
import org.apache.hadoop.hdds.scm.ha.SCMNodeDetails;
import org.apache.hadoop.hdds.scm.ha.SCMSnapshotProvider;
import org.apache.hadoop.hdds.scm.ha.SCMStateMachine;
@@ -63,12 +62,9 @@ public class TestSCMInstallSnapshot {
conf = new OzoneConfiguration();
conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, true);
conf.set(ScmConfigKeys.OZONE_SCM_PIPELINE_CREATION_INTERVAL, "10s");
- SCMHAConfiguration scmhaConfiguration = conf.getObject(
- SCMHAConfiguration.class);
- scmhaConfiguration.setRatisSnapshotThreshold(1L);
- scmhaConfiguration.setRatisSnapshotDir(
- GenericTestUtils.getRandomizedTempPath() + "/snapshot");
- conf.setFromObject(scmhaConfiguration);
+ conf.setLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD, 1L);
+ conf.set(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_DIR,
+ GenericTestUtils.getRandomizedTempPath() + "/snapshot");
cluster = MiniOzoneCluster
.newBuilder(conf)
.setNumDatanodes(3)
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMSnapshot.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMSnapshot.java
index 84b9e58..53656ce 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMSnapshot.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMSnapshot.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hdds.scm;
import org.apache.hadoop.hdds.client.RatisReplicationConfig;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.scm.container.ContainerManagerV2;
-import org.apache.hadoop.hdds.scm.ha.SCMHAConfiguration;
import org.apache.hadoop.hdds.utils.TransactionInfo;
import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
import org.apache.hadoop.hdds.scm.pipeline.PipelineManager;
@@ -49,10 +48,7 @@ public class TestSCMSnapshot {
conf = new OzoneConfiguration();
conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, true);
conf.set(ScmConfigKeys.OZONE_SCM_PIPELINE_CREATION_INTERVAL, "10s");
- SCMHAConfiguration scmhaConfiguration = conf.getObject(
- SCMHAConfiguration.class);
- scmhaConfiguration.setRatisSnapshotThreshold(1L);
- conf.setFromObject(scmhaConfiguration);
+ conf.setLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD, 1L);
cluster = MiniOzoneCluster
.newBuilder(conf)
.setNumDatanodes(3)
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
index 03bc8ba..badcc44 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
@@ -565,8 +565,7 @@ public class TestStorageContainerManager {
@VisibleForTesting
public static void validateRatisGroupExists(OzoneConfiguration conf,
String clusterId) throws IOException {
- final SCMHAConfiguration haConf = conf.getObject(SCMHAConfiguration.class);
- final RaftProperties properties = RatisUtil.newRaftProperties(haConf, conf);
+ final RaftProperties properties = RatisUtil.newRaftProperties(conf);
final RaftGroupId raftGroupId =
SCMRatisServerImpl.buildRaftGroupId(clusterId);
final AtomicBoolean found = new AtomicBoolean(false);
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestFailoverWithSCMHA.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestFailoverWithSCMHA.java
index 1607d92..10ab528 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestFailoverWithSCMHA.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestFailoverWithSCMHA.java
@@ -21,7 +21,7 @@ import org.apache.hadoop.hdds.protocol.DatanodeDetails;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
import org.apache.hadoop.hdds.scm.container.ContainerID;
import org.apache.hadoop.hdds.scm.container.common.helpers.MoveDataNodePair;
-import org.apache.hadoop.hdds.scm.ha.SCMHAConfiguration;
+import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.protocol.ScmBlockLocationProtocol;
import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol;
import org.apache.hadoop.hdds.scm.protocolPB.ScmBlockLocationProtocolClientSideTranslatorPB;
@@ -75,10 +75,8 @@ public class TestFailoverWithSCMHA {
scmId = UUID.randomUUID().toString();
omServiceId = "om-service-test1";
scmServiceId = "scm-service-test1";
- SCMHAConfiguration scmhaConfiguration =
- conf.getObject(SCMHAConfiguration.class);
- scmhaConfiguration.setRatisSnapshotThreshold(SNAPSHOT_THRESHOLD);
- conf.setFromObject(scmhaConfiguration);
+ conf.setLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD,
+ SNAPSHOT_THRESHOLD);
cluster = (MiniOzoneHAClusterImpl) MiniOzoneCluster.newHABuilder(conf)
.setClusterId(clusterId).setScmId(scmId).setOMServiceId(omServiceId)
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestSCMInstallSnapshotWithHA.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestSCMInstallSnapshotWithHA.java
index 9919322..e9a7cf3 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestSCMInstallSnapshotWithHA.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestSCMInstallSnapshotWithHA.java
@@ -27,8 +27,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.hadoop.hdds.client.RatisReplicationConfig;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor;
+import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.container.ContainerInfo;
-import org.apache.hadoop.hdds.scm.ha.SCMHAConfiguration;
import org.apache.hadoop.hdds.scm.ha.SCMHAManagerImpl;
import org.apache.hadoop.hdds.scm.ha.SCMStateMachine;
import org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition;
@@ -86,13 +86,11 @@ public class TestSCMInstallSnapshotWithHA {
scmId = UUID.randomUUID().toString();
omServiceId = "om-service-test1";
scmServiceId = "scm-service-test1";
- SCMHAConfiguration scmhaConfiguration =
- conf.getObject(SCMHAConfiguration.class);
- scmhaConfiguration.setRaftLogPurgeEnabled(true);
- scmhaConfiguration.setRaftLogPurgeGap(LOG_PURGE_GAP);
- scmhaConfiguration.setRatisSnapshotThreshold(SNAPSHOT_THRESHOLD);
- conf.setFromObject(scmhaConfiguration);
+ conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_PURGE_ENABLED, true);
+ conf.setInt(ScmConfigKeys.OZONE_SCM_HA_RAFT_LOG_PURGE_GAP, LOG_PURGE_GAP);
+ conf.setLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD,
+ SNAPSHOT_THRESHOLD);
cluster = (MiniOzoneHAClusterImpl) MiniOzoneCluster.newHABuilder(conf)
.setClusterId(clusterId)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org