You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/08/30 08:02:48 UTC

[GitHub] [incubator-pinot] kishoreg opened a new pull request #5949: Zookeeper put api

kishoreg opened a new pull request #5949:
URL: https://github.com/apache/incubator-pinot/pull/5949


   ## Description
   Adding an api to update ZK Path. Will be used by the UI
   ## Upgrade Notes
   Does this PR prevent a zero down-time upgrade? (Assume upgrade order: Controller, Broker, Server, Minion)
   * [ ] Yes (Please label as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR fix a zero-downtime upgrade introduced earlier?
   * [ ] Yes (Please label this as **<code>backward-incompat</code>**, and complete the section below on Release Notes)
   
   Does this PR otherwise need attention when creating release notes? Things to consider:
   - New configuration options
   - Deprecation of configurations
   - Signature changes to public methods/interfaces
   - New plugins added or old plugins removed
   * [ ] Yes (Please label this PR as **<code>release-notes</code>** and complete the section on Release Notes)
   ## Release Notes
   If you have tagged this as either backward-incompat or release-notes,
   you MUST add text here that you would like to see appear in release notes of the
   next release.
   
   If you have a series of commits adding or enabling a feature, then
   add this section only in final commit that marks the feature completed.
   Refer to earlier release notes to see examples of text
   
   ## Documentation
   If you have introduced a new feature or configuration, please add it to the documentation as well.
   See https://docs.pinot.apache.org/developers/developers-and-contributors/update-document
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] mayankshriv commented on pull request #5949: Zookeeper put api

Posted by GitBox <gi...@apache.org>.
mayankshriv commented on pull request #5949:
URL: https://github.com/apache/incubator-pinot/pull/5949#issuecomment-691700375


   @sajjad-moradi You may want to take into account these apis when adding ACL checks.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] kishoreg merged pull request #5949: Zookeeper put api

Posted by GitBox <gi...@apache.org>.
kishoreg merged pull request #5949:
URL: https://github.com/apache/incubator-pinot/pull/5949


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] kishoreg commented on a change in pull request #5949: Zookeeper put api

Posted by GitBox <gi...@apache.org>.
kishoreg commented on a change in pull request #5949:
URL: https://github.com/apache/incubator-pinot/pull/5949#discussion_r487555289



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
##########
@@ -75,6 +80,63 @@ public String getData(
     return null;
   }
 
+  @DELETE
+  @Path("/zk/delete")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")
+  @ApiResponses(value = { //

Review comment:
       just formatting




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] kishoreg commented on a change in pull request #5949: Zookeeper put api

Posted by GitBox <gi...@apache.org>.
kishoreg commented on a change in pull request #5949:
URL: https://github.com/apache/incubator-pinot/pull/5949#discussion_r487555268



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
##########
@@ -75,6 +80,63 @@ public String getData(
     return null;
   }
 
+  @DELETE
+  @Path("/zk/delete")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")

Review comment:
       fixed




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #5949: Zookeeper put api

Posted by GitBox <gi...@apache.org>.
mayankshriv commented on a change in pull request #5949:
URL: https://github.com/apache/incubator-pinot/pull/5949#discussion_r487550170



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
##########
@@ -75,6 +80,63 @@ public String getData(
     return null;
   }
 
+  @DELETE
+  @Path("/zk/delete")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")
+  @ApiResponses(value = { //

Review comment:
       Are the trailing `//` needed for formatting, or some other purpose?

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
##########
@@ -75,6 +80,63 @@ public String getData(
     return null;
   }
 
+  @DELETE
+  @Path("/zk/delete")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")
+  @ApiResponses(value = { //
+      @ApiResponse(code = 200, message = "Success"), //
+      @ApiResponse(code = 404, message = "ZK Path not found"), //
+      @ApiResponse(code = 204, message = "No Content"), //
+      @ApiResponse(code = 500, message = "Internal server error")})
+  public SuccessResponse delete(
+      @ApiParam(value = "Zookeeper Path, must start with /", required = true, defaultValue = "/") @QueryParam("path") @DefaultValue("") String path) {
+
+    path = validateAndNormalizeZKPath(path);
+
+    boolean success = pinotHelixResourceManager.deleteZKPath(path);
+    if(success) {
+      return new SuccessResponse("Successfully deleted path: " + path);
+    } else {
+      throw new ControllerApplicationException(LOGGER, "Failed to delete path: " + path,
+          Response.Status.INTERNAL_SERVER_ERROR);
+    }
+  }
+
+  @PUT
+  @Path("/zk/put")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")
+  @ApiResponses(value = { //
+      @ApiResponse(code = 200, message = "Success"), //
+      @ApiResponse(code = 404, message = "ZK Path not found"), //
+      @ApiResponse(code = 204, message = "No Content"), //
+      @ApiResponse(code = 500, message = "Internal server error")})
+  public SuccessResponse putData(
+      @ApiParam(value = "Zookeeper Path, must start with /", required = true, defaultValue = "/") @QueryParam("path") @DefaultValue("") String path,
+      @ApiParam(value = "Content", required = true) @QueryParam("data") @DefaultValue("") String content,
+      @ApiParam(value = "expectedVersion", required = true, defaultValue = "-1") @QueryParam("expectedVersion") @DefaultValue("-1") String expectedVersion,
+      @ApiParam(value = "accessOption", required = true, defaultValue = "1") @QueryParam("accessOption") @DefaultValue("1") String accessOption) {
+    path = validateAndNormalizeZKPath(path);
+    ZNRecord record = null;
+    if (content != null) {
+      record = (ZNRecord) _znRecordSerializer.deserialize(content.getBytes(Charsets.UTF_8));
+    }
+    try {
+      boolean result = pinotHelixResourceManager

Review comment:
       Will this allow any arbitrary path to be set with any arbitrary value (as-in possibly corrupt the cluster state)?

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
##########
@@ -75,6 +80,63 @@ public String getData(
     return null;
   }
 
+  @DELETE
+  @Path("/zk/delete")

Review comment:
       The `delete` api seems a bit dangerous. Should we protect it to only allow deleting certain paths? Seems this api will allow deleting the entire cluster? 

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
##########
@@ -75,6 +80,63 @@ public String getData(
     return null;
   }
 
+  @DELETE
+  @Path("/zk/delete")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")

Review comment:
       `value` should be `delete` and not `Get`?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [incubator-pinot] kishoreg commented on a change in pull request #5949: Zookeeper put api

Posted by GitBox <gi...@apache.org>.
kishoreg commented on a change in pull request #5949:
URL: https://github.com/apache/incubator-pinot/pull/5949#discussion_r487555430



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ZookeeperResource.java
##########
@@ -75,6 +80,63 @@ public String getData(
     return null;
   }
 
+  @DELETE
+  @Path("/zk/delete")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")
+  @ApiResponses(value = { //
+      @ApiResponse(code = 200, message = "Success"), //
+      @ApiResponse(code = 404, message = "ZK Path not found"), //
+      @ApiResponse(code = 204, message = "No Content"), //
+      @ApiResponse(code = 500, message = "Internal server error")})
+  public SuccessResponse delete(
+      @ApiParam(value = "Zookeeper Path, must start with /", required = true, defaultValue = "/") @QueryParam("path") @DefaultValue("") String path) {
+
+    path = validateAndNormalizeZKPath(path);
+
+    boolean success = pinotHelixResourceManager.deleteZKPath(path);
+    if(success) {
+      return new SuccessResponse("Successfully deleted path: " + path);
+    } else {
+      throw new ControllerApplicationException(LOGGER, "Failed to delete path: " + path,
+          Response.Status.INTERNAL_SERVER_ERROR);
+    }
+  }
+
+  @PUT
+  @Path("/zk/put")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Get content of the znode")
+  @ApiResponses(value = { //
+      @ApiResponse(code = 200, message = "Success"), //
+      @ApiResponse(code = 404, message = "ZK Path not found"), //
+      @ApiResponse(code = 204, message = "No Content"), //
+      @ApiResponse(code = 500, message = "Internal server error")})
+  public SuccessResponse putData(
+      @ApiParam(value = "Zookeeper Path, must start with /", required = true, defaultValue = "/") @QueryParam("path") @DefaultValue("") String path,
+      @ApiParam(value = "Content", required = true) @QueryParam("data") @DefaultValue("") String content,
+      @ApiParam(value = "expectedVersion", required = true, defaultValue = "-1") @QueryParam("expectedVersion") @DefaultValue("-1") String expectedVersion,
+      @ApiParam(value = "accessOption", required = true, defaultValue = "1") @QueryParam("accessOption") @DefaultValue("1") String accessOption) {
+    path = validateAndNormalizeZKPath(path);
+    ZNRecord record = null;
+    if (content != null) {
+      record = (ZNRecord) _znRecordSerializer.deserialize(content.getBytes(Charsets.UTF_8));
+    }
+    try {
+      boolean result = pinotHelixResourceManager

Review comment:
       yes. ZK does allow that. However, the UI will only allow updating the leaf node.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org