This is an automated email from the ASF dual-hosted git repository.
hanishakoneru pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2dfa932 HDDS-1684. OM should create Ratis related dirs only if ratis
is enabled (#965)
2dfa932 is described below
commit 2dfa932818bca2abfb9f69cb973418abbdc4f45d
Author: Hanisha Koneru <[email protected]>
AuthorDate: Tue Jun 18 16:08:48 2019 -0700
HDDS-1684. OM should create Ratis related dirs only if ratis is enabled
(#965)
---
.../container/common/impl/TestHddsDispatcher.java | 2 +-
.../apache/hadoop/ozone/om/TestOzoneManager.java | 22 ----------
.../snapshot/TestOzoneManagerSnapshotProvider.java | 1 +
.../org/apache/hadoop/ozone/om/OzoneManager.java | 51 ++++++++++------------
4 files changed, 26 insertions(+), 50 deletions(-)
diff --git
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java
index 54dbe94..fe27eeb 100644
---
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java
+++
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestHddsDispatcher.java
@@ -74,12 +74,12 @@ public class TestHddsDispatcher {
String testDir = GenericTestUtils.getTempPath(
TestHddsDispatcher.class.getSimpleName());
OzoneConfiguration conf = new OzoneConfiguration();
+ conf.set(HDDS_DATANODE_DIR_KEY, testDir);
DatanodeDetails dd = randomDatanodeDetails();
VolumeSet volumeSet = new VolumeSet(dd.getUuidString(), conf);
try {
UUID scmId = UUID.randomUUID();
- conf.set(HDDS_DATANODE_DIR_KEY, testDir);
ContainerSet containerSet = new ContainerSet();
DatanodeStateMachine stateMachine = Mockito.mock(
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
index 62464ba..30bca70 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
@@ -85,7 +85,6 @@ import static
org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_OPEN_KEY_EXPIRE_THRE
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
import static
org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.KEY_NOT_FOUND;
import static
org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_NOT_FOUND;
-import org.apache.ratis.util.LifeCycle;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -1365,27 +1364,6 @@ public class TestOzoneManager {
conf.get(OZONE_SCM_CLIENT_ADDRESS_KEY)), scmAddress);
}
- /**
- * Test that OM Ratis server is started only when OZONE_OM_RATIS_ENABLE_KEY
is
- * set to true.
- */
- @Test
- public void testRatisServerOnOMInitialization() throws IOException {
- // OM Ratis server should not be started when OZONE_OM_RATIS_ENABLE_KEY
- // is not set to true
- Assert.assertNull("OM Ratis server started though OM Ratis is disabled.",
- cluster.getOzoneManager().getOmRatisServerState());
-
- // Enable OM Ratis and restart OM
- conf.setBoolean(OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY, true);
- cluster.restartOzoneManager();
-
- // On enabling OM Ratis, the Ratis server should be started
- Assert.assertEquals("OM Ratis server did not start",
- LifeCycle.State.RUNNING,
- cluster.getOzoneManager().getOmRatisServerState());
- }
-
@Test
public void testVersion() {
String expectedVersion = OzoneVersionInfo.OZONE_VERSION_INFO.getVersion();
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneManagerSnapshotProvider.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneManagerSnapshotProvider.java
index f5e39f7..2f7550c 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneManagerSnapshotProvider.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneManagerSnapshotProvider.java
@@ -63,6 +63,7 @@ public class TestOzoneManagerSnapshotProvider {
clusterId = UUID.randomUUID().toString();
scmId = UUID.randomUUID().toString();
conf.setBoolean(OMConfigKeys.OZONE_OM_HTTP_ENABLED_KEY, true);
+ conf.setBoolean(OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY, true);
cluster = (MiniOzoneHAClusterImpl) MiniOzoneCluster.newHABuilder(conf)
.setClusterId(clusterId)
.setScmId(scmId)
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
index 287c2de..2f3daf3 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
@@ -313,12 +313,33 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
ProtobufRpcEngine.class);
metadataManager = new OmMetadataManagerImpl(configuration);
+
+ // This is a temporary check. Once fully implemented, all OM state change
+ // should go through Ratis - be it standalone (for non-HA) or replicated
+ // (for HA).
+ isRatisEnabled = configuration.getBoolean(
+ OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY,
+ OMConfigKeys.OZONE_OM_RATIS_ENABLE_DEFAULT);
startRatisServer();
startRatisClient();
- if (peerNodes != null && !peerNodes.isEmpty()) {
- this.omSnapshotProvider = new OzoneManagerSnapshotProvider(configuration,
- omRatisSnapshotDir, peerNodes);
+ if (isRatisEnabled) {
+ // Create Ratis storage dir
+ String omRatisDirectory = OmUtils.getOMRatisDirectory(configuration);
+ if (omRatisDirectory == null || omRatisDirectory.isEmpty()) {
+ throw new IllegalArgumentException(HddsConfigKeys.OZONE_METADATA_DIRS +
+ " must be defined.");
+ }
+ OmUtils.createOMDir(omRatisDirectory);
+
+ // Create Ratis snapshot dir
+ omRatisSnapshotDir = OmUtils.createOMDir(
+ OmUtils.getOMRatisSnapshotDirectory(configuration));
+
+ if (peerNodes != null && !peerNodes.isEmpty()) {
+ this.omSnapshotProvider = new OzoneManagerSnapshotProvider(
+ configuration, omRatisSnapshotDir, peerNodes);
+ }
}
this.ratisSnapshotFile = new File(omStorage.getCurrentDir(),
@@ -542,18 +563,6 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
configuration.set(OZONE_OM_ADDRESS_KEY,
NetUtils.getHostPortString(rpcAddress));
- // Create Ratis storage dir
- String omRatisDirectory = OmUtils.getOMRatisDirectory(configuration);
- if (omRatisDirectory == null || omRatisDirectory.isEmpty()) {
- throw new IllegalArgumentException(HddsConfigKeys.OZONE_METADATA_DIRS +
- " must be defined.");
- }
- OmUtils.createOMDir(omRatisDirectory);
-
- // Create Ratis snapshot dir
- omRatisSnapshotDir = OmUtils.createOMDir(
- OmUtils.getOMRatisSnapshotDirectory(configuration));
-
// Get and set Http(s) address of local node. If base config keys are
// not set, check for keys suffixed with OM serivce ID and node ID.
setOMNodeSpecificConfigs(serviceId, nodeId);
@@ -1253,12 +1262,6 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
* Creates an instance of ratis server.
*/
private void startRatisServer() throws IOException {
- // This is a temporary check. Once fully implemented, all OM state change
- // should go through Ratis - be it standalone (for non-HA) or replicated
- // (for HA).
- isRatisEnabled = configuration.getBoolean(
- OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY,
- OMConfigKeys.OZONE_OM_RATIS_ENABLE_DEFAULT);
if (isRatisEnabled) {
if (omRatisServer == null) {
omRatisServer = OzoneManagerRatisServer.newOMRatisServer(
@@ -1277,12 +1280,6 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
* Creates an instance of ratis client.
*/
private void startRatisClient() throws IOException {
- // This is a temporary check. Once fully implemented, all OM state change
- // should go through Ratis - be it standalone (for non-HA) or replicated
- // (for HA).
- isRatisEnabled = configuration.getBoolean(
- OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY,
- OMConfigKeys.OZONE_OM_RATIS_ENABLE_DEFAULT);
if (isRatisEnabled) {
if (omRatisClient == null) {
omRatisClient = OzoneManagerRatisClient.newOzoneManagerRatisClient(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]