Skip to content
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

Expose Evacuate Finished API in Helix-Rest #2694

Merged

Conversation

GrantPSpencer
Copy link
Contributor

Issues

  • My PR addresses the following Helix issues and references them in the PR description:

isEvacuateFinished API not available in helix-rest

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Expose isEvacuateFinished API in helix-rest. setInstanceOperation is already exposed.

One key thing to note is the way we return the true/false value. Should we always return a 200 response code if we do not encounter an error? If so, then how do we represent the true/false value? Do we want to send it as json {"isEvacuateFinished": "true"} or just as a raw "true" / "false" string? Ideally we should decide on 1 way of returning true/false's and stick to that

Tests

  • The following tests are written for this issue:

Added tests to updateInstance method in testPerInstanceAccessor.java

  • The following is the result of the "mvn test" command on the appropriate module:

$ mvn test -o -Dtest=TestPerInstanceAccessor -pl=helix-rest

[INFO] Tests run: 24, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 52.578 s - in org.apache.helix.rest.server.TestPerInstanceAccessor
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 24, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco:0.8.6:report (generate-code-coverage-report) @ helix-rest ---
[INFO] Loading execution data file /Users/gspencer/Desktop/git-repos/helix/helix-rest/target/jacoco.exec
[INFO] Analyzed bundle 'Apache Helix :: Restful Interface' with 92 classes
[WARNING] Classes in bundle 'Apache Helix :: Restful Interface' do not match with execution data. For report generation the same class files must be used as at runtime.
[WARNING] Execution data for class org/apache/helix/rest/server/resources/helix/ResourceAssignmentOptimizerAccessor does not match.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  57.262 s
[INFO] Finished at: 2023-11-06T16:13:53-08:00
[INFO] ------------------------------------------------------------------------

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":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. 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)

Copy link
Contributor

@desaikomal desaikomal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grant to answer your question:

  • we should return true/false as JSON and not as pure text. If request was successfully processed - independent of the response, HTTP Return code should be 200.
  • all our existing APIs (getResource etc) returns JSON. so it is good to return as JSON

@GrantPSpencer
Copy link
Contributor Author

Changed response to JSON of
{"evacuateFinished": BOOLEAN}

@GrantPSpencer GrantPSpencer changed the base branch from master to ApplicationClusterManager November 13, 2023 18:36
@GrantPSpencer GrantPSpencer changed the base branch from ApplicationClusterManager to master November 13, 2023 18:36
@GrantPSpencer GrantPSpencer changed the base branch from master to ApplicationClusterManager November 13, 2023 19:45
@GrantPSpencer
Copy link
Contributor Author

Pull request approved by @zpinto
Commit message: Expose isEvacuateFinished API in helix-rest

@xyuanlu xyuanlu merged commit 75c5521 into apache:ApplicationClusterManager Nov 14, 2023
1 of 2 checks passed
asfgit pushed a commit that referenced this pull request Dec 8, 2023
asfgit pushed a commit that referenced this pull request Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants