HDDS-14221. Support primitive query params#9537
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.
It seems here change to use getInt() not JAX-RS. should we add error hadling in getInt().
now:
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.
OS3Exception is a checked exception, needs to be declared, but the interface does not allow that.
There was a problem hiding this comment.
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.
sure! I think it makes sense to me.
|
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.
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