[ 
https://issues.apache.org/jira/browse/HDFS-15716?focusedWorklogId=523258&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-523258
 ]

ASF GitHub Bot logged work on HDFS-15716:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Dec/20 18:00
            Start Date: 11/Dec/20 18:00
    Worklog Time Spent: 10m 
      Work Description: goiri commented on a change in pull request #2528:
URL: https://github.com/apache/hadoop/pull/2528#discussion_r541127258



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestUpgradeDomainBlockPlacementPolicy.java
##########
@@ -231,32 +229,34 @@ public Boolean get() {
         } catch (IOException ioe) {
           return false;
         }
-        for(LocatedBlock block : locatedBlocks.getLocatedBlocks()) {
+        for (LocatedBlock block : locatedBlocks.getLocatedBlocks()) {
           Set<DatanodeInfo> locs = new HashSet<>();
           for (DatanodeInfo datanodeInfo : block.getLocations()) {
-            if (datanodeInfo.getAdminState() ==
-                DatanodeInfo.AdminStates.NORMAL) {
+            if (datanodeInfo.getAdminState().equals(
+                DatanodeInfo.AdminStates.NORMAL)) {
               locs.add(datanodeInfo);
             }
           }
           for (DatanodeID datanodeID : expectedDatanodeIDs) {
-            successful = successful && locs.contains(datanodeID);
+            if (!locs.contains(datanodeID)) {
+              return false;
+            }
           }
         }
-        return successful;
+        return true;
       }
-    }, 1000, 60000);
+    }, 1000, WAIT_TIMEOUT_MS);
 
     // Verify block placement policy of each block.
-    LocatedBlocks locatedBlocks;
-    locatedBlocks =
+    LocatedBlocks locatedBlocks =
         cluster.getFileSystem().getClient().getLocatedBlocks(
             path.toString(), 0, fileSize);
-    for(LocatedBlock block : locatedBlocks.getLocatedBlocks()) {
-      BlockPlacementStatus status = cluster.getNamesystem().getBlockManager().
-          getBlockPlacementPolicy().verifyBlockPlacement(
-              block.getLocations(), REPLICATION_FACTOR);
-      assertTrue(status.isPlacementPolicySatisfied());

Review comment:
       Why not leave this static import?




----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 523258)
    Time Spent: 1h 20m  (was: 1h 10m)

> TestUpgradeDomainBlockPlacementPolicy flaky
> -------------------------------------------
>
>                 Key: HDFS-15716
>                 URL: https://issues.apache.org/jira/browse/HDFS-15716
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: namenode, test
>            Reporter: Ahmed Hussein
>            Assignee: Ahmed Hussein
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.3.1, 3.4.0, 3.1.5, 2.10.2, 3.2.3
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> In some slow runs {{TestUpgradeDomainBlockPlacementPolicy#testPlacement}} and 
> {{TestUpgradeDomainBlockPlacementPolicy#testPlacementAfterDecommission}} fail.
> On branch-2.10, this was fixed by waiting for the replication to be complete. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to