errose28 commented on code in PR #8146:
URL: https://github.com/apache/ozone/pull/8146#discussion_r2036214977
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/replicas/chunk/ChunkKeyHandler.java:
##########
@@ -123,51 +119,64 @@ protected void execute(OzoneClient client, OzoneAddress
address)
keyLocation.getContainerID(), pipeline);
ArrayNode responseFromAllNodes = JsonUtils.createArrayNode();
for (Map.Entry<DatanodeDetails,
ContainerProtos.GetBlockResponseProto> entry : responses.entrySet()) {
- chunkPaths.clear();
ObjectNode jsonObj = JsonUtils.createObjectNode(null);
if (entry.getValue() == null) {
- LOG.error("Cant execute getBlock on this node");
+ LOG.error("Can't execute getBlock on this node");
continue;
}
- tempchunks = entry.getValue().getBlockData().getChunksList();
- ContainerProtos.ContainerDataProto containerData =
- readContainerResponses.get(entry.getKey()).getContainerData();
- for (ContainerProtos.ChunkInfo chunkInfo : tempchunks) {
- String fileName = containerLayoutVersion.getChunkFile(new File(
+ ContainerProtos.ChunkInfo chunks = null;
+ String fileName = "";
+ if (entry.getValue().getBlockData().getChunksCount() > 0) {
+ chunks = entry.getValue().getBlockData().getChunks(0);
+ ContainerProtos.ContainerDataProto containerData =
+
readContainerResponses.get(entry.getKey()).getContainerData();
+ fileName = containerLayoutVersion.getChunkFile(new File(
getChunkLocationPath(containerData.getContainerPath())),
keyLocation.getBlockID(),
- chunkInfo.getChunkName()).toString();
- chunkPaths.add(fileName);
- ChunkDetails chunkDetails = new ChunkDetails();
- chunkDetails.setChunkName(fileName);
- chunkDetails.setChunkOffset(chunkInfo.getOffset());
- chunkDetailsList.add(chunkDetails);
+ chunks.getChunkName()).toString();
}
- containerChunkInfoVerbose.setContainerPath(containerData
- .getContainerPath());
- containerChunkInfoVerbose.setPipeline(keyPipeline);
- containerChunkInfoVerbose.setChunkInfos(chunkDetailsList);
- containerChunkInfo.setFiles(chunkPaths);
- containerChunkInfo.setPipelineID(keyPipeline.getId().getId());
- if (isECKey) {
- ChunkType blockChunksType =
- isECParityBlock(keyPipeline, entry.getKey()) ?
- ChunkType.PARITY : ChunkType.DATA;
- containerChunkInfoVerbose.setChunkType(blockChunksType);
- containerChunkInfo.setChunkType(blockChunksType);
+
+ ObjectNode dnObj = JsonUtils.createObjectNode(null);
Review Comment:
For adding objects or arrays to other json objects, we should add them to
the return value of `ObjectNode#putArray(String)` or `ObjectNode#putObject`
respectively instead of using these `JsonUtils` methods.
--
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]