This is an automated email from the ASF dual-hosted git repository.
ritesh 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 5453cd6aec HDDS-3419. Throw exception with correct code when available
data nodes are not sufficient (#3847)
5453cd6aec is described below
commit 5453cd6aec9ce1d6d68798222b310848fd9688b6
Author: Pratap Chandu <[email protected]>
AuthorDate: Fri Nov 4 13:29:24 2022 +0530
HDDS-3419. Throw exception with correct code when available data nodes are
not sufficient (#3847)
---
.../apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java | 9 ++++++++-
.../hdds/scm/pipeline/TestRatisPipelineCreateAndDestroy.java | 9 ++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java
index 6e7fe47f7f..befc0543a3 100644
---
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java
+++
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java
@@ -124,6 +124,14 @@ public final class PipelinePlacementPolicy extends
SCMCommonPlacementPolicy {
// get nodes in HEALTHY state
List<DatanodeDetails> healthyNodes =
nodeManager.getNodes(NodeStatus.inServiceHealthy());
+ String msg;
+ if (healthyNodes.size() == 0) {
+ msg = "No healthy node found to allocate container.";
+ LOG.error(msg);
+ throw new SCMException(msg, SCMException.ResultCodes
+ .FAILED_TO_FIND_HEALTHY_NODES);
+ }
+
healthyNodes = filterNodesWithSpace(healthyNodes, nodesRequired,
metadataSizeRequired, dataSizeRequired);
boolean multipleRacks = multipleRacksAvailable(healthyNodes);
@@ -131,7 +139,6 @@ public final class PipelinePlacementPolicy extends
SCMCommonPlacementPolicy {
healthyNodes.removeAll(excludedNodes);
}
int initialHealthyNodesCount = healthyNodes.size();
- String msg;
if (initialHealthyNodesCount < nodesRequired) {
msg = String.format("Pipeline creation failed due to no sufficient" +
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineCreateAndDestroy.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineCreateAndDestroy.java
index bf4e0c7e35..8f334a1231 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineCreateAndDestroy.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineCreateAndDestroy.java
@@ -31,7 +31,6 @@ import org.apache.hadoop.ozone.MiniOzoneCluster;
import org.apache.ozone.test.GenericTestUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.Assert;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
@@ -48,7 +47,6 @@ import static
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTER
/**
* Tests for RatisPipelineUtils.
*/
-@Disabled("HDDS-3419")
public class TestRatisPipelineCreateAndDestroy {
private MiniOzoneCluster cluster;
@@ -136,6 +134,11 @@ public class TestRatisPipelineCreateAndDestroy {
cluster.shutdownHddsDatanode(dn.getDatanodeDetails());
}
+ GenericTestUtils.waitFor(() ->
+ cluster.getStorageContainerManager().getScmNodeManager()
+ .getNodeCount(NodeStatus.inServiceHealthy()) == 0,
+ 100, 10 * 1000);
+
// try creating another pipeline now
try {
pipelineManager.createPipeline(RatisReplicationConfig.getInstance(
@@ -145,7 +148,7 @@ public class TestRatisPipelineCreateAndDestroy {
// As now all datanodes are shutdown, they move to stale state, there
// will be no sufficient datanodes to create the pipeline.
Assert.assertTrue(ioe instanceof SCMException);
-
Assert.assertEquals(SCMException.ResultCodes.FAILED_TO_FIND_SUITABLE_NODE,
+
Assert.assertEquals(SCMException.ResultCodes.FAILED_TO_FIND_HEALTHY_NODES,
((SCMException) ioe).getResult());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]