Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.hadoop.hdds.conf;

import com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hdds.scm.ha.SCMHAUtils;

import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -53,6 +54,7 @@ public static <T> void forceUpdateConfigValue(String config, T value) {

@VisibleForTesting
public static void clearDefaultConfigs() {
SCMHAUtils.setRatisEnabled(true);
CONFIG_DEFAULT_MAP.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,6 @@ public final class ScmConfigKeys {
public static final String HDDS_TRACING_ENABLED = "hdds.tracing.enabled";
public static final boolean HDDS_TRACING_ENABLED_DEFAULT = false;

// SCM Ratis related
public static final String OZONE_SCM_HA_ENABLE_KEY
= "ozone.scm.ratis.enable";
/** Default Value would be Overriden based on the current state of Ratis.
{@link org.apache.hadoop.hdds.conf.DefaultConfigManager}
*/
public static final boolean OZONE_SCM_HA_ENABLE_DEFAULT
= true;
public static final String OZONE_SCM_RATIS_PORT_KEY
= "ozone.scm.ratis.port";
public static final int OZONE_SCM_RATIS_PORT_DEFAULT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.hadoop.hdds.HddsUtils;
import org.apache.hadoop.hdds.conf.ConfigurationException;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.conf.DefaultConfigManager;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.ratis.ServerNotLeaderException;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
Expand Down Expand Up @@ -87,11 +86,14 @@ private SCMHAUtils() {
// not used
}

// Check if SCM HA is enabled.
// This will be removed in follow-up Jira. Ref. HDDS-11754
private static boolean isRatisEnabled = true;
public static boolean isSCMHAEnabled(ConfigurationSource conf) {
return conf.getBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
DefaultConfigManager.getValue(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
ScmConfigKeys.OZONE_SCM_HA_ENABLE_DEFAULT));
return isRatisEnabled;
}

public static void setRatisEnabled(boolean value) {
isRatisEnabled = value;
}

public static String getPrimordialSCM(ConfigurationSource conf) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.hadoop.ozone.container.upgrade;

import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.ha.SCMHAUtils;
import org.apache.hadoop.hdds.upgrade.HDDSLayoutFeature;
import org.apache.hadoop.hdds.upgrade.HDDSLayoutVersionManager;
import org.apache.hadoop.ozone.OzoneConsts;
Expand Down Expand Up @@ -117,9 +117,7 @@ public static String chooseContainerPathID(StorageVolume volume,
*/
public static String chooseContainerPathID(ConfigurationSource conf,
String scmID, String clusterID) {
boolean scmHAEnabled =
conf.getBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
ScmConfigKeys.OZONE_SCM_HA_ENABLE_DEFAULT);
boolean scmHAEnabled = SCMHAUtils.isSCMHAEnabled(conf);
if (isFinalized(HDDSLayoutFeature.SCM_HA) || scmHAEnabled) {
return clusterID;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package org.apache.hadoop.hdds.scm.ha;

import com.google.common.base.Preconditions;
import org.apache.hadoop.hdds.conf.ConfigurationException;
import org.apache.hadoop.hdds.conf.DefaultConfigManager;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.ScmUtils;
Expand Down Expand Up @@ -149,10 +147,7 @@ public static SCMHANodeDetails loadDefaultConfig(
}

/** Validates SCM HA Config.
For Non Initialized SCM the value is taken directly based on the config
{@link org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY}
which defaults to
{@link org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_HA_ENABLE_DEFAULT}
For Non Initialized SCM the value is true.
For Previously Initialized SCM the values are taken from the version file
<br>
Ratis SCM -> Non Ratis SCM is not supported.
Expand All @@ -164,30 +159,8 @@ private static void validateSCMHAConfig(SCMStorageConfig scmStorageConfig,
boolean scmHAEnableDefault = state == Storage.StorageState.INITIALIZED
? scmStorageConfig.isSCMHAEnabled()
: SCMHAUtils.isSCMHAEnabled(conf);
boolean scmHAEnabled = SCMHAUtils.isSCMHAEnabled(conf);

if (Storage.StorageState.INITIALIZED.equals(state) &&
scmHAEnabled != scmHAEnableDefault) {
String errorMessage = String.format("Current State of SCM: %s",
scmHAEnableDefault ? "SCM is running with Ratis. "
: "SCM is running without Ratis. ")
+ "Ratis SCM -> Non Ratis SCM is not supported.";
if (!scmHAEnabled) {
throw new ConfigurationException(String.format("Invalid Config %s " +
"Provided ConfigValue: false, Expected Config Value: true. %s",
ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, errorMessage));
} else {
LOG.warn("Default/Configured value of config {} conflicts with " +
"the expected value. " +
"Default/Configured: {}. " +
"Expected: {}. " +
"Falling back to the expected value. {}",
ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
scmHAEnabled, scmHAEnableDefault, errorMessage);
}
}
DefaultConfigManager.setConfigValue(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
scmHAEnableDefault);
// If we have an initialized cluster, use the value from VERSION file.
SCMHAUtils.setRatisEnabled(scmHAEnableDefault);
}

public static SCMHANodeDetails loadSCMHAConfig(OzoneConfiguration conf,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.hadoop.hdds.HddsUtils;
import org.apache.hadoop.hdds.annotation.InterfaceAudience;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.conf.DefaultConfigManager;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.conf.ReconfigurationHandler;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
Expand Down Expand Up @@ -1330,8 +1329,7 @@ public static boolean scmInit(OzoneConfiguration conf,
// Initialize security if security is enabled later.
initializeSecurityIfNeeded(conf, scmStorageConfig, selfHostName, true);

if (conf.getBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
ScmConfigKeys.OZONE_SCM_HA_ENABLE_DEFAULT) && !isSCMHAEnabled) {
if (SCMHAUtils.isSCMHAEnabled(conf) && !isSCMHAEnabled) {
SCMRatisServerImpl.initialize(scmStorageConfig.getClusterID(),
scmStorageConfig.getScmId(), haDetails.getLocalNodeDetails(),
conf);
Expand All @@ -1346,8 +1344,7 @@ public static boolean scmInit(OzoneConfiguration conf,
*/

try {
DefaultConfigManager.forceUpdateConfigValue(
ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, true);
SCMHAUtils.setRatisEnabled(true);
StorageContainerManager scm = createSCM(conf);
scm.start();
scm.getScmHAManager().getRatisServer().triggerSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static org.apache.hadoop.ozone.upgrade.UpgradeActionHdds.Component.SCM;

import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.ha.SCMHAUtils;
import org.apache.hadoop.hdds.scm.server.SCMStorageConfig;
import org.apache.hadoop.hdds.upgrade.HDDSUpgradeAction;
Expand Down Expand Up @@ -62,9 +61,8 @@ public static void checkScmHA(OzoneConfiguration conf,
if (!versionManager.isAllowed(SCM_HA) &&
SCMHAUtils.isSCMHAEnabled(conf) &&
!storageConf.isSCMHAEnabled()) {
throw new UpgradeException(String.format("Configuration %s cannot be " +
"used until SCM upgrade has been finalized",
ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY),
throw new UpgradeException("Ratis cannot be " +
"used until SCM upgrade has been finalized",
UpgradeException.ResultCodes.PREFINALIZE_ACTION_VALIDATION_FAILED);
}
}
Expand Down
4 changes: 0 additions & 4 deletions hadoop-ozone/dev-support/intellij/ozone-site-ha.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
<name>ozone.metadata.dirs</name>
<value>/tmp/metadata</value>
</property>
<property>
<name>ozone.scm.ratis.enable</name>
<value>true</value>
</property>
<property>
<name>ozone.scm.service.ids</name>
<value>scm-group</value>
Expand Down
4 changes: 0 additions & 4 deletions hadoop-ozone/dev-support/intellij/ozone-site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@
<name>datanode.replication.port</name>
<value>0</value>
</property>
<property>
<name>ozone.scm.ratis.enable</name>
<value>false</value>
</property>
<property>
<name>hdds.container.report.interval</name>
<value>60m</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ OZONE-SITE.XML_ozone.scm.nodes.scmservice=scm1,scm2,scm3
OZONE-SITE.XML_ozone.scm.address.scmservice.scm1=scm1
OZONE-SITE.XML_ozone.scm.address.scmservice.scm2=scm2
OZONE-SITE.XML_ozone.scm.address.scmservice.scm3=scm3
OZONE-SITE.XML_ozone.scm.ratis.enable=true
OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data/metadata
OZONE-SITE.XML_ozone.scm.container.size=100MB
OZONE-SITE.XML_ozone.scm.block.size=20MB
Expand Down
1 change: 0 additions & 1 deletion hadoop-ozone/dist/src/main/compose/ozone-ha/docker-config
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ OZONE-SITE.XML_ozone.scm.nodes.scmservice=scm1,scm2,scm3
OZONE-SITE.XML_ozone.scm.address.scmservice.scm1=scm1
OZONE-SITE.XML_ozone.scm.address.scmservice.scm2=scm2
OZONE-SITE.XML_ozone.scm.address.scmservice.scm3=scm3
OZONE-SITE.XML_ozone.scm.ratis.enable=true
OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data/metadata
OZONE-SITE.XML_ozone.scm.container.size=1GB
OZONE-SITE.XML_ozone.scm.datanode.ratis.volume.free-space.min=10MB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ OZONE-SITE.XML_ozone.scm.nodes.scmservice=scm1,scm2,scm3
OZONE-SITE.XML_ozone.scm.address.scmservice.scm1=scm1.org
OZONE-SITE.XML_ozone.scm.address.scmservice.scm2=scm2.org
OZONE-SITE.XML_ozone.scm.address.scmservice.scm3=scm3.org
OZONE-SITE.XML_ozone.scm.ratis.enable=true
OZONE-SITE.XML_ozone.scm.close.container.wait.duration=5s

OZONE-SITE.XML_ozone.om.volume.listall.allowed=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ OZONE-SITE.XML_ozone.scm.nodes.scmservice=scm1,scm2,scm3
OZONE-SITE.XML_ozone.scm.address.scmservice.scm1=scm1.org
OZONE-SITE.XML_ozone.scm.address.scmservice.scm2=scm2.org
OZONE-SITE.XML_ozone.scm.address.scmservice.scm3=scm3.org
OZONE-SITE.XML_ozone.scm.ratis.enable=true
OZONE-SITE.XML_ozone.scm.primordial.node.id=scm1

OZONE-SITE.XML_ozone.scm.pipeline.creation.interval=30s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ description: Enable HA for SCM components
OZONE-SITE.XML_ozone.scm.address.scmservice.scm0: scm-0.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.address.scmservice.scm1: scm-1.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.address.scmservice.scm2: scm-2.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.ratis.enable: "true"
OZONE-SITE.XML_ozone.scm.primordial.node.id: scm0
- type: add
trigger:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ description: Enable HA for SCM component
OZONE-SITE.XML_ozone.scm.address.scmservice.scm0: scm-0.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.address.scmservice.scm1: scm-1.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.address.scmservice.scm2: scm-2.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.ratis.enable: "true"
OZONE-SITE.XML_ozone.scm.primordial.node.id: scm0
- type: add
trigger:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ data:
OZONE-SITE.XML_ozone.scm.address.scmservice.scm0: scm-0.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.address.scmservice.scm1: scm-1.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.address.scmservice.scm2: scm-2.scm.default.svc.cluster.local
OZONE-SITE.XML_ozone.scm.ratis.enable: "true"
OZONE-SITE.XML_ozone.scm.primordial.node.id: scm0
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,6 @@ protected void initializeConfiguration() throws IOException {
Path metaDir = Paths.get(path, "ozone-meta");
Files.createDirectories(metaDir);
conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDir.toString());
// conf.setBoolean(ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY, true);

conf.setTimeDuration(OMConfigKeys.OZONE_OM_RATIS_MINIMUM_TIMEOUT_KEY,
DEFAULT_RATIS_RPC_TIMEOUT_SEC, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ private void addPropertiesNotInXml() {
OMConfigKeys.OZONE_OM_DECOMMISSIONED_NODES_KEY,
ScmConfigKeys.OZONE_SCM_NODES_KEY,
ScmConfigKeys.OZONE_SCM_ADDRESS_KEY,
ScmConfigKeys.OZONE_SCM_HA_ENABLE_KEY,
ScmConfigKeys.OZONE_CHUNK_READ_NETTY_CHUNKED_NIO_FILE_KEY,
OMConfigKeys.OZONE_FS_TRASH_INTERVAL_KEY,
OMConfigKeys.OZONE_FS_TRASH_CHECKPOINT_INTERVAL_KEY,
Expand Down
Loading