You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ArafatKhan2198 (via GitHub)" <gi...@apache.org> on 2024/03/19 05:49:09 UTC
[PR] HDDS-10541 Replace GSON with Jackson in debug commands [ozone]
ArafatKhan2198 opened a new pull request, #6401:
URL: https://github.com/apache/ozone/pull/6401
## What changes were proposed in this pull request?
This update addresses compatibility concerns with Java 17 by transitioning from GSON to Jackson in the `Debug-Shell` module. This change simplifies dependencies and ensures smooth operation across different Java versions.
Parent Jira Issue: [HDDS-10538](https://issues.apache.org/jira/browse/HDDS-10538)
This patch streamlines our Debug-Shell Implementation.
Affected Classes:
```
- ChunkKeyHandler.java
- ReadReplicas.java
- ContainerChunkInfo.java
```
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10541
## How was this patch tested?
To test out the changes we have to run :- `TestOzoneDebugShell` Integration test.
The forked CI also ran successfully.
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541 Replace GSON with Jackson in debug commands [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on code in PR #6401:
URL: https://github.com/apache/ozone/pull/6401#discussion_r1532885671
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java:
##########
@@ -80,13 +79,13 @@ protected void execute(OzoneClient client, OzoneAddress address)
XceiverClientManager xceiverClientManager = containerOperationClient.getXceiverClientManager()) {
OzoneManagerProtocol ozoneManagerClient = client.getObjectStore().getClientProxy().getOzoneManagerClient();
address.ensureKeyAddress();
- JsonElement element;
- JsonObject result = new JsonObject();
+ ObjectMapper objectMapper = new ObjectMapper();
Review Comment:
Thanks for reminding!
I have implemented the changes!!
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541 Replace GSON with Jackson in debug commands [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6401:
URL: https://github.com/apache/ozone/pull/6401#discussion_r1530044784
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java:
##########
@@ -80,13 +79,13 @@ protected void execute(OzoneClient client, OzoneAddress address)
XceiverClientManager xceiverClientManager = containerOperationClient.getXceiverClientManager()) {
OzoneManagerProtocol ozoneManagerClient = client.getObjectStore().getClientProxy().getOzoneManagerClient();
address.ensureKeyAddress();
- JsonElement element;
- JsonObject result = new JsonObject();
+ ObjectMapper objectMapper = new ObjectMapper();
Review Comment:
Have you considered using `JsonUtils`, as mentioned in https://github.com/apache/ozone/pull/6147#pullrequestreview-1941518871?
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541. Replace GSON with Jackson in debug commands [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #6401:
URL: https://github.com/apache/ozone/pull/6401#issuecomment-2012271728
@dombizita @tanvipenumudy please review
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541 Replace GSON with Jackson in debug commands [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on code in PR #6401:
URL: https://github.com/apache/ozone/pull/6401#discussion_r1533386286
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java:
##########
@@ -102,8 +100,9 @@ protected void execute(OzoneClient client, OzoneAddress address)
}
ContainerLayoutVersion containerLayoutVersion = ContainerLayoutVersion
.getConfiguredVersion(getConf());
- JsonArray responseArrayList = new JsonArray();
- for (OmKeyLocationInfo keyLocation : locationInfos) {
+ ArrayNode responseArrayList = JsonUtils.createArrayNode();
+ for (OmKeyLocationInfo keyLocation : keyInfo.getLatestVersionLocations()
+ .getBlocksLatestVersionOnly()) {
Review Comment:
Done!
Thanks!
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java:
##########
@@ -213,10 +205,11 @@ private void downloadReplicasAndCreateManifest(
}
replicasJson.add(replicaJson);
}
- blockJson.add(JSON_PROPERTY_BLOCK_REPLICAS, replicasJson);
+ blockJson.set(JSON_PROPERTY_BLOCK_REPLICAS, replicasJson);
blocks.add(blockJson);
- IOUtils.close(LOG, blockReplicasWithoutChecksum.values());
+ blockReplicasWithoutChecksum.values()
+ .forEach(each -> IOUtils.close(LOG, each));
Review Comment:
Done!
Thanks!
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541 Replace GSON with Jackson in debug commands [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6401:
URL: https://github.com/apache/ozone/pull/6401#discussion_r1530044784
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java:
##########
@@ -80,13 +79,13 @@ protected void execute(OzoneClient client, OzoneAddress address)
XceiverClientManager xceiverClientManager = containerOperationClient.getXceiverClientManager()) {
OzoneManagerProtocol ozoneManagerClient = client.getObjectStore().getClientProxy().getOzoneManagerClient();
address.ensureKeyAddress();
- JsonElement element;
- JsonObject result = new JsonObject();
+ ObjectMapper objectMapper = new ObjectMapper();
Review Comment:
Have you considered using `JsonUtil`, as mentioned in https://github.com/apache/ozone/pull/6147#pullrequestreview-1941518871?
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541. Replace GSON with Jackson in debug commands [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #6401:
URL: https://github.com/apache/ozone/pull/6401
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541 Replace GSON with Jackson in debug commands [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6401:
URL: https://github.com/apache/ozone/pull/6401#discussion_r1533355343
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java:
##########
@@ -102,8 +100,9 @@ protected void execute(OzoneClient client, OzoneAddress address)
}
ContainerLayoutVersion containerLayoutVersion = ContainerLayoutVersion
.getConfiguredVersion(getConf());
- JsonArray responseArrayList = new JsonArray();
- for (OmKeyLocationInfo keyLocation : locationInfos) {
+ ArrayNode responseArrayList = JsonUtils.createArrayNode();
+ for (OmKeyLocationInfo keyLocation : keyInfo.getLatestVersionLocations()
+ .getBlocksLatestVersionOnly()) {
Review Comment:
Also seems to be unrelated changed. Can we keep using `locationInfos`?
```suggestion
for (OmKeyLocationInfo keyLocation : locationInfos) {
```
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java:
##########
@@ -213,10 +205,11 @@ private void downloadReplicasAndCreateManifest(
}
replicasJson.add(replicaJson);
}
- blockJson.add(JSON_PROPERTY_BLOCK_REPLICAS, replicasJson);
+ blockJson.set(JSON_PROPERTY_BLOCK_REPLICAS, replicasJson);
blocks.add(blockJson);
- IOUtils.close(LOG, blockReplicasWithoutChecksum.values());
+ blockReplicasWithoutChecksum.values()
+ .forEach(each -> IOUtils.close(LOG, each));
Review Comment:
This part of the change is unrelated, only due to merge conflict resolution. Let's keep the original:
```suggestion
IOUtils.close(LOG, blockReplicasWithoutChecksum.values());
```
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541. Replace GSON with Jackson in debug commands [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #6401:
URL: https://github.com/apache/ozone/pull/6401#issuecomment-2016708927
Thanks @ArafatKhan2198 for the patch, @tanvipenumudy for the review.
Tested this with Java 17, works well.
--
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: issues-unsubscribe@ozone.apache.org
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
Re: [PR] HDDS-10541 Replace GSON with Jackson in debug commands [ozone]
Posted by "tanvipenumudy (via GitHub)" <gi...@apache.org>.
tanvipenumudy commented on code in PR #6401:
URL: https://github.com/apache/ozone/pull/6401#discussion_r1530009739
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java:
##########
@@ -213,15 +209,16 @@ private void downloadReplicasAndCreateManifest(
}
replicasJson.add(replicaJson);
}
- blockJson.add(JSON_PROPERTY_BLOCK_REPLICAS, replicasJson);
+ blockJson.set(JSON_PROPERTY_BLOCK_REPLICAS, replicasJson);
blocks.add(blockJson);
- IOUtils.close(LOG, blockReplicasWithoutChecksum.values());
+ blockReplicasWithoutChecksum.values()
+ .forEach(each -> IOUtils.close(LOG, each));
}
}
private Map<DatanodeDetails, OzoneInputStream> replicasOf(BlockID blockID,
- Map<OmKeyLocationInfo, Map<DatanodeDetails, OzoneInputStream>> replicas) {
+ Map<OmKeyLocationInfo, Map<DatanodeDetails, OzoneInputStream>> replicas) {
Review Comment:
Minor nit: I think we can stick with the original indentation, thanks.
--
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: issues-unsubscribe@ozone.apache.org
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