This is an automated email from the ASF dual-hosted git repository.

bharat pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 73f7b04  HDDS-1302. Fix SCM CLI does not list container with id 1.
73f7b04 is described below

commit 73f7b04e2b8f9a4b06a1e5b5c62eadd074555205
Author: Vivek Ratnavel Subramanian <vivekratnave...@gmail.com>
AuthorDate: Fri Mar 22 15:15:01 2019 -0700

    HDDS-1302. Fix SCM CLI does not list container with id 1.
---
 .../org/apache/hadoop/hdds/scm/container/SCMContainerManager.java  | 2 +-
 .../org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
index 6dd1949..728ac52 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
@@ -200,7 +200,7 @@ public class SCMContainerManager implements 
ContainerManager {
       Collections.sort(containersIds);
 
       return containersIds.stream()
-          .filter(id -> id.getId() >= startId)
+          .filter(id -> id.getId() > startId)
           .limit(count)
           .map(id -> {
             try {
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
index e85da54..8330f70 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
@@ -294,8 +294,13 @@ public class SCMClientProtocolServer implements
     auditMap.put("startContainerID", String.valueOf(startContainerID));
     auditMap.put("count", String.valueOf(count));
     try {
+      // To allow startcontainerId to take the value "0",
+      // "null" is assigned, so that its handled in the
+      // scm.getContainerManager().listContainer method
+      final ContainerID containerId = startContainerID != 0 ? ContainerID
+          .valueof(startContainerID) : null;
       return scm.getContainerManager().
-          listContainer(ContainerID.valueof(startContainerID), count);
+          listContainer(containerId, count);
     } catch (Exception ex) {
       auditSuccess = false;
       AUDIT.logReadFailure(


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

Reply via email to