anuragp010 commented on code in PR #11100:
URL: https://github.com/apache/ozone/pull/11100#discussion_r4061773025
##########
hadoop-ozone/cli-debug/src/main/java/org/apache/hadoop/ozone/fsck/ContainerMapper.java:
##########
@@ -127,6 +106,34 @@ public static void main(String[] args) throws IOException {
}
}
+ private static void addLocations(
+ Map<Long, List<Map<Long, BlockIdDetails>>> dataMap, OmKeyInfo keyInfo,
+ OmKeyLocationInfoGroup keyLocationInfoGroup) {
+ for (List<OmKeyLocationInfo> keyLocationInfo : keyLocationInfoGroup
+ .getLocationLists()) {
+ for (OmKeyLocationInfo keyLocation : keyLocationInfo) {
+ BlockIdDetails blockIdDetails = new BlockIdDetails();
+ Map<Long, BlockIdDetails> innerMap = new HashMap<>();
+
+ long containerID = keyLocation.getBlockID().getContainerID();
+ long blockID = keyLocation.getBlockID().getLocalID();
+ blockIdDetails.setBucketName(keyInfo.getBucketName());
+ blockIdDetails.setBlockVol(keyInfo.getVolumeName());
+ blockIdDetails.setKeyName(keyInfo.getKeyName());
+
+ List<Map<Long, BlockIdDetails>> innerList = new ArrayList<>();
Review Comment:
nit: Since we moved the loop into its own method, would
```java
dataMap.computeIfAbsent(containerID, k -> new ArrayList<>())
.add(Collections.singletonMap(blockID, blockIdDetails))
```
be cleaner?
Note: singletonMap is immutable, but in this case, the entries are not
mutated.
##########
hadoop-ozone/cli-debug/src/main/java/org/apache/hadoop/ozone/fsck/ContainerMapper.java:
##########
@@ -127,6 +106,34 @@ public static void main(String[] args) throws IOException {
}
}
+ private static void addLocations(
Review Comment:
The current `TestContainerMapper` doesn't cover the case where a key has
multiple versions. Although not specific to this change, do you think it's
worth adding a test for that or leave it out of scope for this PR?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]