-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-14221. Support primitive query params #9537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@adoroszlai Thanks for the patch! |
| int maxKeys = queryParams().getInt(QueryParams.MAX_KEYS, 1000); | ||
| final int maxUploads = queryParams().getInt(QueryParams.MAX_UPLOADS, 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems here change to use getInt() not JAX-RS. should we add error hadling in getInt().
now:
ozone/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigurationSource.java
Lines 45 to 48 in 049abeb
| default int getInt(String key, int defaultValue) { | |
| String value = get(key); | |
| return value != null ? Integer.parseInt(value) : defaultValue; | |
| } |
just a suggestion:
@Override
public int getInt(String key, int defaultValue) {
String value = get(key);
if (value == null) {
return defaultValue;
}
try {
return Integer.parseInt(value.trim());
} catch (NumberFormatException e) {
throw new OS3Exception(S3ErrorTable.INVALID_ARGUMENT,
key + " must be a valid integer");
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OS3Exception is a checked exception, needs to be declared, but the interface does not allow that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can translate to WebApplicationException(400), but doing so for every type seems cumbersome. Then it may be better to create a new converter just for params, initially supporting only getInt/setInt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure! I think it makes sense to me.
ivandika3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM +1.
hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigurationTarget.java
Outdated
Show resolved
Hide resolved
|
I'm wondering whether instead of a single long method for handling PUT, GET (e.g. Not sure if there are any performance implications. |
|
Thanks @ivandika3, @rich7420 for the review. I have updated the patch to translate to
We do have two handlers for Assuming we have to roll our own, I'd like to:
(See #9516 (review) for details.) |
|
@adoroszlai thanks for the update! LGTM |
ivandika3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. LGTM +1.
|
Thanks @adoroszlai for the patch and @rich7420 for the review. |
|
@adoroszlai , @ivandika3 thanks! |
|
Thanks @ivandika3, @rich7420 for the review. |
What changes were proposed in this pull request?
Reuse Ozone configuration's
Stringconversion logic to support primitive types for query parameters.Update
BucketEndpoint#getto usegetInt, tests to usesetInt.https://issues.apache.org/jira/browse/HDDS-14221
How was this patch tested?
Ran all S3 unit and integration tests locally.
CI (in progress):
https://github.com/adoroszlai/ozone/actions/runs/20394478143