diff --git a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java index 7fce4cd642..c7f44c2366 100644 --- a/helix-core/src/main/java/org/apache/helix/HelixAdmin.java +++ b/helix-core/src/main/java/org/apache/helix/HelixAdmin.java @@ -763,7 +763,7 @@ Map 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 @@ -774,7 +774,7 @@ Map 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, diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java index 6defdd37cd..73db2e74d5 100644 --- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java +++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZKHelixAdmin.java @@ -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. * @@ -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 baseAccessor = new ZkBaseDataAccessor(_zkClient); HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, baseAccessor); @@ -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( @@ -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( @@ -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; } diff --git a/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java index 87789baba6..3ce79f119e 100644 --- a/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java +++ b/helix-core/src/test/java/org/apache/helix/mock/MockHelixAdmin.java @@ -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; }