hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject hadoop git commit: HDFS-11761. Ozone: Get container report should only report closed containers. Contributed by Weiwei Yang.
Date Sat, 06 May 2017 16:48:24 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 2feec0045 -> f713452e7


HDFS-11761. Ozone: Get container report should only report closed containers. Contributed
by Weiwei Yang.


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

Branch: refs/heads/HDFS-7240
Commit: f713452e7e3fd2194238805d2ab949718a648d6a
Parents: 2feec00
Author: Anu Engineer <aengineer@apache.org>
Authored: Sat May 6 09:44:07 2017 -0700
Committer: Anu Engineer <aengineer@apache.org>
Committed: Sat May 6 09:44:07 2017 -0700

----------------------------------------------------------------------
 .../common/impl/ContainerManagerImpl.java       |  2 +-
 .../common/impl/TestContainerPersistence.java   | 29 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/f713452e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerManagerImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerManagerImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerManagerImpl.java
index 5beae37..8b3fe10 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerManagerImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerManagerImpl.java
@@ -746,7 +746,7 @@ public class ContainerManagerImpl implements ContainerManager {
     // after we iterate a point.
     return containerMap.entrySet().stream()
         .filter(containerStatus ->
-            containerStatus.getValue().getContainer().isOpen())
+            !containerStatus.getValue().getContainer().isOpen())
         .map(containerStatus -> containerStatus.getValue().getContainer())
         .collect(Collectors.toList());
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/f713452e/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
index 110093a..7e78330 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/impl/TestContainerPersistence.java
@@ -256,6 +256,35 @@ public class TestContainerPersistence {
         .containsKey(containerName1));
   }
 
+  @Test
+  public void testGetContainerReports() throws Exception{
+    final int count = 10;
+    List<String> containerNames = new ArrayList<String>();
+
+    for (int i = 0; i < count; i++) {
+      String containerName = OzoneUtils.getRequestID();
+      ContainerData data = new ContainerData(containerName);
+      containerManager.createContainer(createSingleNodePipeline(containerName),
+          data);
+
+      // Close a bunch of containers.
+      // Put closed container names to a list.
+      if (i%3 == 0) {
+        containerManager.closeContainer(containerName);
+        containerNames.add(containerName);
+      }
+    }
+
+    // The container report only returns reports of closed containers.
+    List<ContainerData> reports = containerManager.getContainerReports();
+    Assert.assertEquals(4, reports.size());
+    for(ContainerData report : reports) {
+      String actualName = report.getContainerName();
+      Assert.assertTrue(containerNames.remove(actualName));
+    }
+    Assert.assertTrue(containerNames.isEmpty());
+  }
+
   /**
    * This test creates 1000 containers and reads them back 5 containers at a
    * time and verifies that we did get back all containers.


---------------------------------------------------------------------
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