hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject hadoop git commit: HDFS-12796. SCM should not start if Cluster Version file does not exist. Contributed by Shashikant Banerjee.
Date Fri, 10 Nov 2017 10:53:01 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 4dd1609fc -> b8297b084


HDFS-12796. SCM should not start if Cluster Version file does not exist. Contributed by Shashikant
Banerjee.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b8297b08
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b8297b08
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b8297b08

Branch: refs/heads/HDFS-7240
Commit: b8297b0846d20ebeed05932c5a950dd826343a07
Parents: 4dd1609
Author: Nanda kumar <nanda@apache.org>
Authored: Fri Nov 10 16:22:41 2017 +0530
Committer: Nanda kumar <nanda@apache.org>
Committed: Fri Nov 10 16:22:41 2017 +0530

----------------------------------------------------------------------
 .../hadoop/ozone/scm/StorageContainerManager.java     |  5 ++---
 .../hadoop/ozone/TestStorageContainerManager.java     | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8297b08/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java
index a4f4503..1f86bd0 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/StorageContainerManager.java
@@ -226,9 +226,8 @@ public class StorageContainerManager extends ServiceRuntimeInfoImpl
 
     StorageContainerManager.initMetrics();
     scmStorage = new SCMStorage(conf);
-    String clusterId = scmStorage.getClusterID();
-    if (clusterId == null) {
-      throw new SCMException("clusterId not found",
+    if (scmStorage.getState() != StorageState.INITIALIZED) {
+      throw new SCMException("SCM not initialized.",
           ResultCodes.SCM_NOT_INITIALIZED);
     }
     scmNodeManager = new SCMNodeManager(conf, scmStorage.getClusterID());

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8297b08/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
index 305eb29..e42065d 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestStorageContainerManager.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.ozone.scm.StorageContainerManager;
 import org.apache.hadoop.ozone.scm.StorageContainerManager.StartupOption;
 import org.apache.hadoop.ozone.scm.block.DeletedBlockLog;
 import org.apache.hadoop.ozone.scm.block.SCMBlockDeletingService;
+import org.apache.hadoop.ozone.scm.exceptions.SCMException;
 import org.apache.hadoop.ozone.scm.node.NodeManager;
 import org.apache.hadoop.scm.XceiverClientManager;
 import org.apache.hadoop.scm.container.common.helpers.Pipeline;
@@ -396,4 +397,17 @@ public class TestStorageContainerManager {
     Assert.assertEquals(OzoneConsts.NodeType.SCM, scmStore.getNodeType());
     Assert.assertNotEquals("testClusterId", scmStore.getClusterID());
   }
+
+  @Test
+  public void testSCMInitializationFailure() throws IOException {
+    OzoneConfiguration conf = new OzoneConfiguration();
+    final String path =
+        GenericTestUtils.getTempPath(UUID.randomUUID().toString());
+    Path scmPath = Paths.get(path, "scm-meta");
+    conf.set(OzoneConfigKeys.OZONE_METADATA_DIRS, scmPath.toString());
+    conf.setBoolean(OzoneConfigKeys.OZONE_ENABLED, true);
+    exception.expect(SCMException.class);
+    exception.expectMessage("SCM not initialized.");
+    StorageContainerManager.createSCM(null, conf);
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message