-
Notifications
You must be signed in to change notification settings - Fork 5
Return current Evacuation status of isEvacuateFinished #100
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
Conversation
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
Outdated
Show resolved
Hide resolved
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
Outdated
Show resolved
Hide resolved
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
Outdated
Show resolved
Hide resolved
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
Outdated
Show resolved
Hide resolved
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
Outdated
Show resolved
Hide resolved
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PerInstanceAccessor.java
Show resolved
Hide resolved
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/PerInstanceAccessor.java
Show resolved
Hide resolved
|
@LZD-PratyushBhatt Can you update the PR description test section with before and new responses as well. Makes it clear. |
helix-core/src/main/java/org/apache/helix/model/EvacuationInfo.java
Outdated
Show resolved
Hide resolved
|
Review comment from @bellatrix007 |
One way I can think of achieving this is to iterate over all the currentState records(as for each resource its a diff znode) and get the mtime, pick the latest one among all. I'll check this one out, it shouldn't be extra zk calls as we are already iterating over all the currentStates already. |
Updated with using getPropertyStats, the current code uses getChildValues which doesnt return stats, as the method internally passes null stat object so zk ultimately doesnt populate it. |
helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java
Outdated
Show resolved
Hide resolved
| EvacuationInfo result = new EvacuationInfo(); | ||
|
|
||
| InstanceConfig config = getInstanceConfig(clusterName, instanceName); | ||
| if (config == null || config.getInstanceOperation().getOperation() != |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should have different reason code for config as null vs no evacuate operation assigned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think so it will add any value, even if instance config is not present, instance is technically not evacauting, and in both cases the user will anyways go to the cluster to check the instance config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, we will propagate this to UI. For user facing things, we should be meticulous about what messages we show/return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no harm in adding it, added! Thanks for the suggestion!
| Assert.assertTrue(evacuateFinishedResult.get("successful")); | ||
| Assert.assertTrue((Boolean) evacuateFinishedResult.get("successful")); | ||
| // Verify new fields are present in the response | ||
| Assert.assertTrue(evacuateFinishedResult.containsKey("remainingCount"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*remainingPartitionCount
| "Response should contain remainingCount field"); | ||
| Assert.assertTrue(evacuateFinishedResult.containsKey("pendingMessageCount"), | ||
| "Response should contain pendingMessageCount field"); | ||
| Assert.assertEquals(evacuateFinishedResult.get("remainingCount"), 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change here as well - *remainingCount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line apache#788 as well
| "Response should contain remainingCount field"); | ||
| Assert.assertTrue(evacuateFinishedResult.containsKey("pendingMessageCount"), | ||
| "Response should contain pendingMessageCount field"); | ||
| Assert.assertEquals(evacuateFinishedResult.get("remainingCount"), 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line apache#788 as well
| evacuateFinishedResult = OBJECT_MAPPER.readValue(response.readEntity(String.class), Map.class); | ||
| Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); | ||
| Assert.assertTrue(evacuateFinishedResult.get("successful")); | ||
| Assert.assertTrue((Boolean) evacuateFinishedResult.get("successful")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we still keeping "successful"? Make sense to ensure backward compatibility. But I do not see this in tests responses shared in PR description. Can you please update those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the final responses after lastActivityAddition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ngngwr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing the changes. LGTM.
Issues
Return remaining paritition count during isEvacuateFinished
(apache#200 - Link your issue number here: You can write "Fixes #XXX". Please use the proper keyword so that the issue gets closed automatically. See https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue
Any of the following keywords can be used: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved)
Description
Currently isEvacuateFinished API just returns a boolean response, users have no visibility into why the evacuation is blocked. This PR adds a remainingPartitionCounter, which returns the client remaining count and failure reason as well.
(Write a concise description including what, why, how)
Tests
Before:
New respons e structure examples:
New tests added.
(List the names of added unit/integration tests)
(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)
(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)
(Link the GitHub wiki you added)
Commits
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)