You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2021/06/15 17:59:03 UTC

[GitHub] [helix] xyuanlu opened a new pull request #1797: Add response metadata to response header for partitionAssignment

xyuanlu opened a new pull request #1797:
URL: https://github.com/apache/helix/pull/1797


   ### Issues
   
   - [X] My PR addresses the following Helix issues and references them in the PR description:
   
   #1746
   
   ### Description
   
   - [X] Here are some details about my PR, including screenshots of any UI changes:
   
   User may call this API asynchronously. We should return some metadata of the response to user as well.  
   
   ### Tests
   
   - [X] The following tests are written for this issue:
   
   testComputePartitionAssignment
   
   - The following is the result of the "mvn test" command on the appropriate module:
   
   (If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)
   
   ### Changes that Break Backward Compatibility (Optional)
   
   - My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:
   
   (Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)
   
   ### Documentation (Optional)
   
   - In case of new functionality, my PR adds documentation in the following wiki page:
   
   (Link the GitHub wiki you added)
   
   ### Commits
   
   - My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Code Quality
   
   - My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is used)
   


-- 
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: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] junkaixue commented on a change in pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
junkaixue commented on a change in pull request #1797:
URL: https://github.com/apache/helix/pull/1797#discussion_r673574533



##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/AbstractResource.java
##########
@@ -130,6 +130,13 @@ protected Response OK() {
     return Response.ok().build();
   }
 
+  protected Response OKWithHeader(Object entity, String headerName, Object headerValue) {
+    if (headerName == null || headerName.length()==0)
+      return OK(entity);
+    else

Review comment:
       NIT: remove the else and add {} to if statement. Let's respect our coding convention.




-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on pull request #1797:
URL: https://github.com/apache/helix/pull/1797#issuecomment-870147058


   > I have a general question, what is the reason to have the header value in the response?
   
   Thanks for the question.
   When user call this API in async mode, we need to add some metadata info in the reply indicating the return format/filter value etc. 
   Usually metadata stores in header instead of payload. 


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] junkaixue commented on pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
junkaixue commented on pull request #1797:
URL: https://github.com/apache/helix/pull/1797#issuecomment-879272412


   @xyuanlu any update on this?


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on pull request #1797:
URL: https://github.com/apache/helix/pull/1797#issuecomment-870147058


   > I have a general question, what is the reason to have the header value in the response?
   
   Thanks for the question.
   When user call this API in async mode, we need to add some metadata info in the reply indicating the return format/filter value etc. 
   Usually metadata stores in header instead of payload. 


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang merged pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
jiajunwang merged pull request #1797:
URL: https://github.com/apache/helix/pull/1797


   


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on pull request #1797:
URL: https://github.com/apache/helix/pull/1797#issuecomment-879323745


   > @xyuanlu any update on this?
   
   Thanks for the review.
   I have updated the PR. I plan to update the REST API document after this PR is merged. And maybe propose to evaluate all current APIs to see if we pass any metadata in response body (that may need to be reconstructed).
   
   Thanks!


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] junkaixue commented on pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
junkaixue commented on pull request #1797:
URL: https://github.com/apache/helix/pull/1797#issuecomment-873178499


   Sync up with @xyuanlu . Following actions needed:
   1. Add comments for the suggestion of leveraging header to store metadata.
   2. Think about what we can do that let existing customers know the header has info can be retrieved as well. I think most of our customers only relying on the payload returned by REST service.


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on pull request #1797:
URL: https://github.com/apache/helix/pull/1797#issuecomment-884535825


   This change is ready to be merged. 
   Approved  by @junkaixue 
   
   Commit message:
   "Add response metadata to response header for partitionAssignment"
   
   Thanks!!


-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] huizhilu commented on a change in pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
huizhilu commented on a change in pull request #1797:
URL: https://github.com/apache/helix/pull/1797#discussion_r661876813



##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/AbstractResource.java
##########
@@ -160,6 +164,16 @@ protected Response JSONRepresentation(Object entity) {
     }
   }
 
+  protected Response JSONRepresentation(Object entity, String headerName, Object headerValue) {

Review comment:
       I suggest it should reuse the existing method `protected Response JSONRepresentation(Object entity)` to combine them, reducing duplicate code.




-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] xyuanlu commented on a change in pull request #1797: Add response metadata to response header for partitionAssignment

Posted by GitBox <gi...@apache.org>.
xyuanlu commented on a change in pull request #1797:
URL: https://github.com/apache/helix/pull/1797#discussion_r669028346



##########
File path: helix-rest/src/main/java/org/apache/helix/rest/server/resources/AbstractResource.java
##########
@@ -160,6 +164,16 @@ protected Response JSONRepresentation(Object entity) {
     }
   }
 
+  protected Response JSONRepresentation(Object entity, String headerName, Object headerValue) {

Review comment:
       TFTR. Updated.




-- 
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: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org