Skip to content

Commit

Permalink
Fix incompatibility for customers which implement HelixAdmin and Base…
Browse files Browse the repository at this point in the history
…DataAccessor. (apache#2809)
  • Loading branch information
zpinto authored Jun 13, 2024
1 parent 55bdc08 commit 76f8a83
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ default boolean multiSet(Map<String, DataUpdater<T>> updaterByPath) {
* version
* @return true if the removal succeeded, false otherwise
*/
boolean removeWithExpectedVersion(String path, int options, int expectedVersion);
default boolean removeWithExpectedVersion(String path, int options, int expectedVersion) {
throw new NotImplementedException("removeWithExpectedVersion is not implemented");
}

/**
* Use it when creating children under a parent node. This will use async api for better
Expand Down
42 changes: 30 additions & 12 deletions helix-core/src/main/java/org/apache/helix/HelixAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ void enableInstance(String clusterName, String instanceName, boolean enabled,
* @param instanceName The instance name
* @param instanceOperation The instance operation type
*/
void setInstanceOperation(String clusterName, String instanceName,
InstanceConstants.InstanceOperation instanceOperation);
default void setInstanceOperation(String clusterName, String instanceName,
InstanceConstants.InstanceOperation instanceOperation) {
throw new UnsupportedOperationException("setInstanceOperation is not implemented.");
}

/**
* Set the instanceOperation of and instance with {@link InstanceConstants.InstanceOperation}.
Expand All @@ -327,8 +329,10 @@ void setInstanceOperation(String clusterName, String instanceName,
* @param instanceOperation The instance operation type
* @param reason The reason for the operation
*/
void setInstanceOperation(String clusterName, String instanceName,
InstanceConstants.InstanceOperation instanceOperation, String reason);
default void setInstanceOperation(String clusterName, String instanceName,
InstanceConstants.InstanceOperation instanceOperation, String reason) {
throw new UnsupportedOperationException("setInstanceOperation is not implemented.");
}

/**
* Set the instanceOperation of and instance with {@link InstanceConstants.InstanceOperation}.
Expand All @@ -340,8 +344,10 @@ void setInstanceOperation(String clusterName, String instanceName,
* @param overrideAll Whether to override all existing instance operations from all other
* instance operations
*/
void setInstanceOperation(String clusterName, String instanceName,
InstanceConstants.InstanceOperation instanceOperation, String reason, boolean overrideAll);
default void setInstanceOperation(String clusterName, String instanceName,
InstanceConstants.InstanceOperation instanceOperation, String reason, boolean overrideAll) {
throw new UnsupportedOperationException("setInstanceOperation is not implemented.");
}

/**
* Disable or enable a resource
Expand Down Expand Up @@ -453,8 +459,10 @@ void manuallyEnableMaintenanceMode(String clusterName, boolean enabled, String r
* @param resourceName
* @param partitionNames
*/
void setPartitionsToError(String clusterName, String instanceName, String resourceName,
List<String> partitionNames);
default void setPartitionsToError(String clusterName, String instanceName, String resourceName,
List<String> partitionNames) {
throw new UnsupportedOperationException("setPartitionsToError is not implemented.");
}

/**
* Reset a list of partitions in error state for an instance
Expand Down Expand Up @@ -795,7 +803,9 @@ Map<String, Boolean> validateInstancesForWagedRebalance(String clusterName,
* @param instancesNames
* @return Return true if there is no current state nor pending message on the instance.
*/
boolean isEvacuateFinished(String clusterName, String instancesNames);
default boolean isEvacuateFinished(String clusterName, String instancesNames) {
throw new UnsupportedOperationException("isEvacuateFinished is not implemented.");
}

/**
* Check to see if swapping between two instances can be completed. Either the swapOut or
Expand All @@ -804,7 +814,9 @@ 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 canCompleteSwap(String clusterName, String instanceName);
default boolean canCompleteSwap(String clusterName, String instanceName) {
throw new UnsupportedOperationException("canCompleteSwap is not implemented.");
}

/**
* Check to see if swapping between two instances is ready to be completed and complete it if
Expand All @@ -816,7 +828,10 @@ Map<String, Boolean> validateInstancesForWagedRebalance(String clusterName,
* @return True if the swap is ready to be completed and was completed successfully, false
* otherwise.
*/
boolean completeSwapIfPossible(String clusterName, String instanceName, boolean forceComplete);
default boolean completeSwapIfPossible(String clusterName, String instanceName,
boolean forceComplete) {
throw new UnsupportedOperationException("completeSwapIfPossible is not implemented.");
}

/**
* Return if instance is ready for preparing joining cluster. The instance should have no current state,
Expand All @@ -825,5 +840,8 @@ Map<String, Boolean> validateInstancesForWagedRebalance(String clusterName,
* @param instancesNames
* @return true if the instance is ready for preparing joining cluster.
*/
boolean isReadyForPreparingJoiningCluster(String clusterName, String instancesNames);
default boolean isReadyForPreparingJoiningCluster(String clusterName, String instancesNames) {
throw new UnsupportedOperationException(
"isReadyForPreparingJoiningCluster is not implemented.");
}
}

0 comments on commit 76f8a83

Please sign in to comment.