Skip to content

Conversation

@LZD-PratyushBhatt
Copy link
Collaborator

@LZD-PratyushBhatt LZD-PratyushBhatt commented Jan 9, 2026

Issues

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

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.

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

(Write a concise description including what, why, how)

Tests

Before:

{
  "successful": true
}

New respons e structure examples:

  1. IN_PROGRESS
{
  "successful": true,
  "state": "COMPLETED",
  "remainingPartitionCount": 0,
  "pendingMessageCount": 0,
  "lastActivityTimestamp": 1736812345678
}
  1. NOT_EVACUATING
{
  "successful": false,
  "state": "NOT_EVACUATING",
  "reason": "Instance is not in EVACUATE operation"
}

New tests added.

  • The following tests are written for this issue:

(List the names of added unit/integration tests)

  • 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":
    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)

@LZD-PratyushBhatt LZD-PratyushBhatt changed the title Return remaining paritition count during isEvacuateFinished Return current Evacuation status of isEvacuateFinished Jan 12, 2026
@ngngwr
Copy link
Collaborator

ngngwr commented Jan 12, 2026

@LZD-PratyushBhatt Can you update the PR description test section with before and new responses as well. Makes it clear.

@LZD-PratyushBhatt
Copy link
Collaborator Author

Review comment from @bellatrix007
"One major thing, i wanted to check is, can we also propagate the last timestamp when things changed while evacuating the partitions?"

@LZD-PratyushBhatt
Copy link
Collaborator Author

Review comment from @bellatrix007 "One major thing, i wanted to check is, can we also propagate the last timestamp when things changed while evacuating the partitions?"

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.

@LZD-PratyushBhatt
Copy link
Collaborator Author

Review comment from @bellatrix007 "One major thing, i wanted to check is, can we also propagate the last timestamp when things changed while evacuating the partitions?"

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.

EvacuationInfo result = new EvacuationInfo();

InstanceConfig config = getInstanceConfig(clusterName, instanceName);
if (config == null || config.getInstanceOperation().getOperation() !=
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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"),
Copy link
Collaborator

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,
Copy link
Collaborator

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

Copy link
Collaborator

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,
Copy link
Collaborator

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"));
Copy link
Collaborator

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.

Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@ngngwr ngngwr left a 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.

@LZD-PratyushBhatt LZD-PratyushBhatt merged commit f96c61a into dev Jan 14, 2026
1 of 2 checks passed
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.

7 participants