Skip to content

Commit

Permalink
Fix typos and rename swap APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
zpinto committed Oct 20, 2023
1 parent 6dc998d commit ee03fd2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions helix-core/src/main/java/org/apache/helix/HelixAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ Map<String, Boolean> validateInstancesForWagedRebalance(String clusterName,
* @param instanceName The instance that is being swapped out or swapped in
* @return True if the swap is ready to be completed, false otherwise.
*/
boolean isSwapReadyToComplete(String clusterName, String instanceName);
boolean canSwapBeCompleted(String clusterName, String instanceName);

/**
* Check to see if swapping between two instances is ready to be completed and completed it if
Expand All @@ -774,7 +774,7 @@ Map<String, Boolean> validateInstancesForWagedRebalance(String clusterName,
* @return True if the swap is ready to be completed and was completed successfully, false
* otherwise.
*/
boolean completeSwapIfReady(String clusterName, String instanceName);
boolean completeSwapIfPossible(String clusterName, String instanceName);

/**
* Return if instance is ready for preparing joining cluster. The instance should have no current state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ private InstanceConfig findMatchingSwapInstance(String clusterName,
* Check to see if swapping between two instances is ready to be completed. Checks: 1. Both
* instances must be alive. 2. Both instances must only have one session and not be carrying over
* from a previous session. 3. Both instances must have no pending messages. 4. Both instances
* cannot have partitions in the ERROR state 4. SwapIn instance must have correct state for all
* cannot have partitions in the ERROR state 5. SwapIn instance must have correct state for all
* partitions that are currently assigned to the SwapOut instance.
* TODO: We may want to make this a public API in the future.
*
Expand All @@ -533,7 +533,7 @@ private InstanceConfig findMatchingSwapInstance(String clusterName,
* @param swapInInstanceName The instance that is being swapped in
* @return True if the swap is ready to be completed, false otherwise.
*/
private boolean isSwapReadyToComplete(String clusterName, String swapOutInstanceName,
private boolean canSwapBeCompleted(String clusterName, String swapOutInstanceName,
String swapInInstanceName) {
BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<ZNRecord>(_zkClient);
HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, baseAccessor);
Expand Down Expand Up @@ -662,7 +662,7 @@ private boolean isSwapReadyToComplete(String clusterName, String swapOutInstance
}

@Override
public boolean isSwapReadyToComplete(String clusterName, String instanceName) {
public boolean canSwapBeCompleted(String clusterName, String instanceName) {
InstanceConfig instanceConfig = getInstanceConfig(clusterName, instanceName);
if (instanceConfig == null) {
logger.warn(
Expand All @@ -685,12 +685,12 @@ public boolean isSwapReadyToComplete(String clusterName, String instanceName) {
}

// Check if the swap is ready to be completed.
return isSwapReadyToComplete(clusterName, swapOutInstanceConfig.getInstanceName(),
return canSwapBeCompleted(clusterName, swapOutInstanceConfig.getInstanceName(),
swapInInstanceConfig.getInstanceName());
}

@Override
public boolean completeSwapIfReady(String clusterName, String instanceName) {
public boolean completeSwapIfPossible(String clusterName, String instanceName) {
InstanceConfig instanceConfig = getInstanceConfig(clusterName, instanceName);
if (instanceConfig == null) {
logger.warn(
Expand All @@ -713,7 +713,7 @@ public boolean completeSwapIfReady(String clusterName, String instanceName) {
}

// Check if the swap is ready to be completed. If not, return false.
if (!isSwapReadyToComplete(clusterName, swapOutInstanceConfig.getInstanceName(),
if (!canSwapBeCompleted(clusterName, swapOutInstanceConfig.getInstanceName(),
swapInInstanceConfig.getInstanceName())) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,12 @@ public boolean isEvacuateFinished(String clusterName, String instancesNames) {
}

@Override
public boolean isSwapReadyToComplete(String clusterName, String instancesNames) {
public boolean canSwapBeCompleted(String clusterName, String instancesNames) {
return false;
}

@Override
public boolean completeSwapIfReady(String clusterName, String instanceName) {
public boolean completeSwapIfPossible(String clusterName, String instanceName) {
return false;
}

Expand Down

0 comments on commit ee03fd2

Please sign in to comment.