narendly commented on a change in pull request #799: [MSDS] Add REST endpoint
to get mapping of all sharding keys by realm
URL: https://github.com/apache/helix/pull/799#discussion_r382970849
##########
File path:
helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
##########
@@ -167,14 +183,22 @@ public Response
deleteMetadataStoreRealm(@PathParam("realm") String realm) {
*/
@GET
@Path("/sharding-keys")
- public Response getShardingKeys(@QueryParam("prefix") String prefix) {
+ public Response getShardingKeys(@QueryParam("prefix") String prefix,
+ @DefaultValue("false") @QueryParam("groupByRealm") boolean groupByRealm)
{
try {
- if (prefix == null) {
- // For endpoint: "/sharding-keys" to get all sharding keys in a
namespace.
- return getAllShardingKeys();
+ if (prefix != null) {
+ // For endpoint: "/sharding-keys?prefix={prefix}"
+ // Ignore groupByRealm because response already has realm info for
each sharding key.
Review comment:
Have you considered creating a separate endpoint for retrieving all
realm-list of keys mappings?
As I previously commented, I believe that making sure an endpoint does as
little as possible and keeping it simple is an important part of a good API
design. But now this endpoint has multiple queryParams, and I think this makes
it a little more confusing.
This is because this endpoint now does more than one thing depending on what
queryParams are given, and in this case, the `groupByRealm` queryParam seems to
be serving to specify an option/mode rather than a filter.
Could we please create a separate endpoint called `getAllRoutingData(String
namespace)`? This way, we keep the original `getShardingKeys` simple, and
there's no confusion about what each of these endpoints is doing. The endpoint
name could be something like `/all-routing-data` or whatever you see fit.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]