You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/03/16 09:51:27 UTC

[GitHub] [ozone] GlenGeng commented on a change in pull request #2046: TEST HDDS-4968 for CI check

GlenGeng commented on a change in pull request #2046:
URL: https://github.com/apache/ozone/pull/2046#discussion_r595011564



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
##########
@@ -68,13 +68,7 @@
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.util.TreeSet;
-import java.util.Set;
+import java.util.*;

Review comment:
       expand the *

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerManagerImpl.java
##########
@@ -152,15 +150,10 @@ public ContainerInfo getContainer(final ContainerID id)
   public List<ContainerInfo> getContainers(final ContainerID startID,
                                            final int count) {
     scmContainerManagerMetrics.incNumListContainersOps();
-    // TODO: Remove the null check, startID should not be null. Fix the unit
-    //  test before removing the check.
-    final long start = startID == null ? 0 : startID.getId();
-    final List<ContainerID> containersIds =
-        new ArrayList<>(containerStateManager.getContainerIDs());
-    Collections.sort(containersIds);
-    return containersIds.stream()
-        .filter(id -> id.getId() > start).limit(count)
-        .map(ContainerID::getProtobuf)
+    final long start = startID.getId();

Review comment:
       The changes in this file seems not necessary to the back-port. We can create a refactor Jira to beautify the code later. 
   We can reserve the `>=` change.

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
##########
@@ -362,7 +356,11 @@ private boolean hasRequiredReplicas(ContainerInfo contInfo) {
     }
     try {
       final ContainerID containerId = ContainerID.valueOf(startContainerID);
-      return scm.getContainerManager().getContainers(containerId, count);
+      if(null == state) {
+        return scm.getContainerManager().getContainers(containerId, count);
+      }
+      return scm.getContainerManager().getContainers(state).stream()
+          .limit(count).collect(Collectors.toList());

Review comment:
       the `startContainerID` does not take effect here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org