sodonnel commented on a change in pull request #2052:
URL: https://github.com/apache/hadoop/pull/2052#discussion_r435188755



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
##########
@@ -578,7 +578,13 @@ public void removeVolumes(
           // Unlike updating the volumeMap in addVolume(), this operation does
           // not scan disks.
           for (String bpid : volumeMap.getBlockPoolList()) {
-            List<ReplicaInfo> blocks = new ArrayList<>();
+            List<ReplicaInfo> blocks;
+            if (blkToInvalidate.containsKey(bpid)) {
+              blocks = blkToInvalidate.get(bpid);
+            } else {
+              blocks = new ArrayList<>();
+              blkToInvalidate.put(bpid, blocks);
+            }

Review comment:
       Just thinking - this fix will need to go on all branches back into the 
2.8 branch, which I think still uses Java 7. Therefore it would be ideal to 
have the computeIfAbsent method for trunk and 3.x but we will need a patch like 
this existing one for branch 2.




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



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

Reply via email to