Skip to content

Commit c2fcb1f

Browse files
committed
Fix review comment and test
1 parent 8542a70 commit c2fcb1f

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ public ContainerWithPipeline allocateContainer(ReplicationConfig replicationConf
255255
getScm().checkAdminAccess(getRemoteUser(), false);
256256
final ContainerInfo container = scm.getContainerManager()
257257
.allocateContainer(replicationConfig, owner);
258+
if (container == null) {
259+
throw new SCMException(
260+
"Could not allocate container for replication " + replicationConfig
261+
+ ", owner=" + owner
262+
+ ": no suitable open pipeline with enough space",
263+
ResultCodes.FAILED_TO_ALLOCATE_CONTAINER);
264+
}
258265
final Pipeline pipeline = scm.getPipelineManager()
259266
.getPipeline(container.getPipelineID());
260267
ContainerWithPipeline cp = new ContainerWithPipeline(container, pipeline);

hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/MockNodeManager.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,6 @@ public int getPipelinesCount(DatanodeDetails datanodeDetails) {
533533
@Override
534534
public void addPipeline(Pipeline pipeline) {
535535
node2PipelineMap.addPipeline(pipeline);
536-
// Pipeline creation uses DNs that may not be the pre-registered fake nodes; ensure each
537-
// pipeline member has metrics so {@link #getDatanodeInfo} and space checks work.
538-
for (DatanodeDetails dn : pipeline.getNodes()) {
539-
if (nodeMetricMap.get(dn) == null) {
540-
populateNodeMetric(dn, 0);
541-
}
542-
}
543536
}
544537

545538
/**

0 commit comments

Comments
 (0)