Skip to content

Commit

Permalink
HDDS-3556 Refactor configuration in SCMRatisServer to Java-based conf…
Browse files Browse the repository at this point in the history
…iguration.
  • Loading branch information
timmylicheng committed May 11, 2020
1 parent 390a3c1 commit a777392
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 96 deletions.
Expand Up @@ -433,7 +433,7 @@ public final class ScmConfigKeys {
// SCM Ratis Leader Election configurations
public static final String
OZONE_SCM_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY =
"ozone.scm.leader.election.minimum.timeout.duration";
"ozone.scm.ratis.leader.election.minimum.timeout.duration";
public static final TimeDuration
OZONE_SCM_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_DEFAULT =
TimeDuration.valueOf(1, TimeUnit.SECONDS);
Expand Down
4 changes: 2 additions & 2 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Expand Up @@ -2035,7 +2035,7 @@
<name>ozone.scm.ratis.server.request.timeout</name>
<value>3s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The timeout duration for SCM's ratis server request .</description>
<description>The timeout duration for SCM's ratis server request.</description>
</property>

<property>
Expand All @@ -2054,7 +2054,7 @@
</property>

<property>
<name>ozone.scm.leader.election.minimum.timeout.duration</name>
<name>ozone.scm.ratis.leader.election.minimum.timeout.duration</name>
<value>1s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The minimum timeout duration for SCM ratis leader election.
Expand Down
Expand Up @@ -55,5 +55,10 @@
*/
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;

/**
* If type == SIZE the unit should be defined with this attribute.
*/
StorageUnit sizeUnit() default StorageUnit.BYTES;

ConfigTag[] tags();
}
Expand Up @@ -42,5 +42,6 @@ public enum ConfigTag {
STANDALONE,
S3GATEWAY,
DATANODE,
RECON
RECON,
HA
}
Expand Up @@ -84,6 +84,10 @@ public static <T> void injectConfigurationToObject(ConfigurationSource from,
forcedFieldSet(field, configuration,
from.getTimeDuration(key, "0s", configAnnotation.timeUnit()));
break;
case SIZE:
forcedFieldSet(field, configuration,
from.getStorageSize(key, "0B", configAnnotation.sizeUnit()));
break;
default:
throw new ConfigurationException(
"Unsupported ConfigType " + type + " on " + fieldLocation);
Expand Down
Expand Up @@ -269,6 +269,7 @@ public StorageContainerManager(OzoneConfiguration conf,
loginAsSCMUser(conf);
}

// Initialize SCM Ratis Server
if (SCMHAUtils.isSCMHAEnabled(conf)) {
this.scmRatisSnapshotInfo = new SCMRatisSnapshotInfo(
scmStorageConfig.getCurrentDir());
Expand Down Expand Up @@ -1141,9 +1142,11 @@ private void initializeRatisServer() throws IOException {
if (scmRatisServer == null) {
SCMNodeDetails scmNodeDetails = SCMNodeDetails
.initStandAlone(configuration);
//TODO enable Ratis ring
scmRatisServer = SCMRatisServer.newSCMRatisServer(configuration, this,
scmNodeDetails, Collections.EMPTY_LIST);
//TODO enable Ratis group
scmRatisServer = SCMRatisServer.newSCMRatisServer(configuration
.getObject(SCMRatisServer.SCMRatisServerConfiguration.class),
this, scmNodeDetails, Collections.EMPTY_LIST,
SCMRatisServer.getSCMRatisDirectory(configuration));
if (scmRatisServer != null) {
LOG.info("SCM Ratis server initialized at port {}",
scmRatisServer.getServerPort());
Expand Down

0 comments on commit a777392

Please sign in to comment.