You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ivanzlenko (via GitHub)" <gi...@apache.org> on 2024/02/15 06:03:36 UTC
[PR] HDDS-10367. Fix possible NullPointerException in listKeysLight method [ozone]
ivanzlenko opened a new pull request, #6221:
URL: https://github.com/apache/ozone/pull/6221
## What changes were proposed in this pull request?
Fix possible NullPointerException which can occur in some cases while invoking listKeysLight from OzoneManagerProtocolClientSideTranslatorPB.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10367
## How was this patch tested?
This patch is test manually.
Separate epic created to cover testing of hdfs client with S3A protocol: https://issues.apache.org/jira/browse/HDDS-10381
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "myskov (via GitHub)" <gi...@apache.org>.
myskov commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1490664638
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -254,7 +254,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
private OmTransport transport;
private ThreadLocal<S3Auth> threadLocalS3Auth
= new ThreadLocal<>();
-
+
Review Comment:
It's a wrong suggestion from me 🙈
My intention was to revert changing line 257 at all
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "myskov (via GitHub)" <gi...@apache.org>.
myskov commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1490829516
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -1033,7 +1033,7 @@ public ListKeysLightResult listKeysLight(String volumeName,
reqBuilder.setBucketName(bucketName);
reqBuilder.setCount(maxKeys);
- if (StringUtils.isNotEmpty(startKey)) {
+ if (startKey != null) {
Review Comment:
I would go with isNotEmpty in other checks too
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1504681295
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -2297,9 +2301,12 @@ public List<OzoneFileStatusLight> listStatusLight(OmKeyArgs args,
ListStatusRequest.newBuilder()
.setKeyArgs(keyArgs)
.setRecursive(recursive)
- .setStartKey(startKey)
.setNumEntries(numEntries);
+ if (startKey != null) {
+ listStatusRequestBuilder.setStartKey(startKey);
+ }
Review Comment:
Since this is also a `ListStatusRequest`, I think we need to set `""` in `else` branch here, too.
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "ivanzlenko (via GitHub)" <gi...@apache.org>.
ivanzlenko commented on PR #6221:
URL: https://github.com/apache/ozone/pull/6221#issuecomment-1951683015
@adoroszlai I've added additional test cases but looking at test coverage all changes were covered already. Looks like some of the issues with s3a protocol were fixed in HDDS-9762, but my fixes should prevent future cases where we accidentally could pass 'null' for startKey.
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "ivanzlenko (via GitHub)" <gi...@apache.org>.
ivanzlenko commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1490643582
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -1033,7 +1033,7 @@ public ListKeysLightResult listKeysLight(String volumeName,
reqBuilder.setBucketName(bucketName);
reqBuilder.setCount(maxKeys);
- if (StringUtils.isNotEmpty(startKey)) {
+ if (startKey != null) {
Review Comment:
The goal of this change is to make this check consistent between several methods. I can replace all similar checks to isNotEmpty though.
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "myskov (via GitHub)" <gi...@apache.org>.
myskov commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1490655401
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -254,7 +254,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
private OmTransport transport;
private ThreadLocal<S3Auth> threadLocalS3Auth
= new ThreadLocal<>();
-
+
Review Comment:
```suggestion
```
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "myskov (via GitHub)" <gi...@apache.org>.
myskov commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1490640800
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -1033,7 +1033,7 @@ public ListKeysLightResult listKeysLight(String volumeName,
reqBuilder.setBucketName(bucketName);
reqBuilder.setCount(maxKeys);
- if (StringUtils.isNotEmpty(startKey)) {
+ if (startKey != null) {
Review Comment:
StringUtils.isNotEmpty includes checking for null
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "ivanzlenko (via GitHub)" <gi...@apache.org>.
ivanzlenko commented on PR #6221:
URL: https://github.com/apache/ozone/pull/6221#issuecomment-1968883355
@myskov @sumitagrawl @adoroszlai thanks for 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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #6221:
URL: https://github.com/apache/ozone/pull/6221
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1495441237
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestListKeysWithFSO.java:
##########
Review Comment:
Why is this test class moved to another package? Similar class `TestListKeys` is still in the original package. Also, `listKeys*` is part of OM API, so the original package looks more closely related.
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1499811220
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -2261,9 +2260,12 @@ public List<OzoneFileStatus> listStatus(OmKeyArgs args, boolean recursive,
ListStatusRequest.newBuilder()
.setKeyArgs(keyArgs)
.setRecursive(recursive)
- .setStartKey(startKey)
.setNumEntries(numEntries);
+ if (startKey != null) {
+ listStatusRequestBuilder.setStartKey(startKey);
Review Comment:
`startKey` is required for `ListStatusRequest`. So now we get the following instead of `NullPointerException`:
```
com.google.protobuf.UninitializedMessageException: Message missing required fields: startKey
at com.google.protobuf.AbstractMessage$Builder.newUninitializedMessageException(AbstractMessage.java:770)
at org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos$ListStatusRequest$Builder.build(OzoneManagerProtocolProtos.java)
at org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB.listStatus(OzoneManagerProtocolClientSideTranslatorPB.java:2274)
```
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #6221:
URL: https://github.com/apache/ozone/pull/6221#discussion_r1490866121
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java:
##########
@@ -1033,7 +1033,7 @@ public ListKeysLightResult listKeysLight(String volumeName,
reqBuilder.setBucketName(bucketName);
reqBuilder.setCount(maxKeys);
- if (StringUtils.isNotEmpty(startKey)) {
+ if (startKey != null) {
Review Comment:
Is setting empty string on the builder a problem? If not, we can keep `startKey != null` check.
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "ivanzlenko (via GitHub)" <gi...@apache.org>.
ivanzlenko commented on PR #6221:
URL: https://github.com/apache/ozone/pull/6221#issuecomment-1956138057
@adoroszlai we have some preliminary checks for nulls in intermediary code. So this test cases here for good measure. I believe we would've caught HDDS-9762 earlier having cases with null value.
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on PR #6221:
URL: https://github.com/apache/ozone/pull/6221#issuecomment-1954811329
cc @tanvipenumudy
--
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-10367. Fix possible NullPointerException in listKeysLight method [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #6221:
URL: https://github.com/apache/ozone/pull/6221#issuecomment-1968880244
Thanks @ivanzlenko for the patch, @myskov, @sumitagrawl for the 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