From 3cf07b43bc1ce65c1d51a93afaeb79e089e7c8e0 Mon Sep 17 00:00:00 2001 From: Anu Engineer Date: Fri, 9 Feb 2018 15:23:13 -0800 Subject: [PATCH] HDFS-13127. Fix TestContainerStateManager and TestOzoneConfigurationFields. Contributed by Mukul Kumar Singh. --- .../hadoop/ozone/client/rest/RestClient.java | 4 +--- .../scm/container/ContainerStateManager.java | 3 +-- .../src/main/resources/ozone-default.xml | 19 ------------------- .../container/TestContainerStateManager.java | 4 +++- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/RestClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/RestClient.java index 56fadd24f2b..c420ce5aeaf 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/RestClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/ozone/client/rest/RestClient.java @@ -89,9 +89,7 @@ import static java.net.HttpURLConnection.HTTP_OK; /** * Ozone Client REST protocol implementation. It uses REST protocol to - * connect to Ozone Handler that executes client calls. RestClient uses - * ozone.rest.servers and ozone.rest.client.port - * to discover Ozone Rest Server. + * connect to Ozone Handler that executes client calls. */ public class RestClient implements ClientProtocol { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/ContainerStateManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/ContainerStateManager.java index 6fb5872e575..c586107d890 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/ContainerStateManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/scm/container/ContainerStateManager.java @@ -415,8 +415,7 @@ public class ContainerStateManager implements Closeable { // Get the container with space to meet our request. for (ContainerID id : searchSet) { ContainerInfo containerInfo = containers.getContainerInfo(id.getId()); - if ((containerInfo.getAllocatedBytes() <= this.containerSize) && - (containerInfo.getAllocatedBytes() <= size)) { + if (containerInfo.getAllocatedBytes() + size <= this.containerSize) { containerInfo.updateLastUsedTime(); ContainerState key = new ContainerState(owner, diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml index e09afb27213..db21c12eddb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/resources/ozone-default.xml @@ -1204,25 +1204,6 @@ percentage in float notation (X.Yf), with 1.0f meaning 100%. - - ozone.rest.servers - - OZONE, CLIENT - - The REST server hostnames to connect, comma separated list of host - (typically datanodes) where Ozone REST handler are running. - - - - ozone.rest.client.port - 9864 - OZONE, CLIENT - - Port used by client to connect to Ozone REST server. When a datanode - is configured to run Ozone REST handler, this port typically points to - datanode info port. - - ozone.rest.client.http.connection.max 100 diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/container/TestContainerStateManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/container/TestContainerStateManager.java index 633e876ead4..9b1a4c1fdc9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/container/TestContainerStateManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/scm/container/TestContainerStateManager.java @@ -159,11 +159,13 @@ public class TestContainerStateManager { scmContainerMapping.updateContainerState(container2, OzoneProtos.LifeCycleEvent.CREATED); + // space has already been allocated in container1, now container 2 should + // be chosen. info = stateManager .getMatchingContainer(OzoneConsts.GB * 3, containerOwner, xceiverClientManager.getType(), xceiverClientManager.getFactor(), OzoneProtos.LifeCycleState.OPEN); - Assert.assertEquals(container1, info.getContainerName()); + Assert.assertEquals(container2, info.getContainerName()); } @Test