Skip to content
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

HelixAdmin APIs and pipeline changes to support Helix Node Swap #2661

Merged
merged 18 commits into from
Nov 3, 2023

Conversation

zpinto
Copy link
Contributor

@zpinto zpinto commented Oct 17, 2023

Issues

  • HelixAdmin.setInstanceOperation and addInstance sanity checks for SWAP_IN & SWAP_OUT Helix Node/Instance Swap #2662

    • Can only set instance to SWAP_OUT
    • Can only add instance with the same logicaId as another if the already existing has InstanceOperation set to SWAP_OUT and there is not more than 1 already.
  • Create HelixAdmin.isSwapReadyToComplete and completeSwapIfReady(returns if swap finished) Helix Node/Instance Swap #2662

    • completeSwapIfFinished will check if the swap is ready to complete. If ready, mark the SWAP_OUT instance as HELIX_ENABLED: false and clear the INSTANCE_OPERATION for SWAP_IN node.
  • Change WAGED assignment tie breaker logic to use logicalId when present Helix Node/Instance Swap #2662

    • May want to make this configurable, as it will lead to shuffling when this change is deployed
  • Refactor DelayedAutoRebalancerUtil and DelayedAutoRebalancer.computeBestPossibleStateForPartition
    to filter out SWAP_IN node because we will add SWAP_IN node to the end of preference list in computeBestPossibleStateForPartition until the swap is complete Helix Node/Instance Swap #2662

    • Adding it to the end of the preference list will ensure that the SWAP_IN node only carries secondary states
    • When SWAP_IN node has identical Current State to SWAP_OUT, isSwapFinished completeSwapIfFinished will return true

Description

Adding Helix Admin APIs and updating existing setInstanceOperation and addInstance implementations to support Helix Node Swap.

  • setInstanceOperation: Add sanity check to disallow setting the INSTANCE_OPERATION to SWAP_IN, as this should be set when we addInstance to cluster. We can't have a case where where there are two instances in the cluster with the same logicalId unless there is exactly 1 with SWAP_OUT and 1 with SWAP_IN INSTANCE_OPERATION.
  • addInstance: We now check to ensure that there is not already an instance in the cluster with the same logicalId. We only allow adding an instance with the same logicalId if the existing instance has SWAP_OUT INSTANCE_OPERATION or the add instance is being added in the disable state.
  • canSwapComplete: Checks if the swap of two instances is ready to mark completed. It takes either the SWAP_OUT or SWAP_IN instance as an argument. It does the following 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
    5. SwapIn instance must have correct state for all partitions that are currently assigned to the SwapOut instance.
  • completeSwapPossible: Checks to see if the swap is ready to complete using isSwapReadyToComplete. If ready, it will clear the SwapIn node's INSTANCE_OPERATION and disable the SwapOut node.

Add ability for up to 2 nodes with the same logicalId to be added to the cluster at the same time when a SWAP is happening.
During all paritionAssignment for WAGED and DelayedAutoRebalancer, we select just one instance for each logicalId.

Cases:

  • If only one instance with logicalId, it passes through the filter
  • If two instances with logicalId, SWAP_OUT passes through the filter if the other node is SWAP_IN. If SWAP_IN node passes through the filter when the SWAP is marked complete by setting the InstanceOperation of the SWAP_IN node to null.

When SWAP_OUT nodes are the instances which pass through the filter and there are corresponding SWAP_IN nodes which are live and enabled, we add them to the end of all preference lists which contain the SWAP_OUT node following computeIdealState. This ensures that they are in secondTopState for all StateModels that can only have a single replica in the topState. For stateModels that allow multiple replicas of the topState, the SWAP_IN node could host topState replicas before the SWAP is completed.

Once the swap is complete and SWAP_IN node has InstanceOperation set to null, SWAP_IN node becomes assignable and WAGED and DelayedAutoRebalancer + CRUSHED will computePartitionAssignment and generate IdealState with SWAP_IN instance in same index of the preferenceList as the SWAP_OUT instance used to be in. This means that not only will SWAP_IN node have all the same partitions that the SWAP_OUT node had, but also the same states.

Tests

  • testAddingNodeWithSwapOutInstanceOperation
  • testAddingNodeWithSwapOutNodeInstanceOperationUnset
  • testNodeSwapWithNoSwapOutNode
  • testNodeSwapSwapInNodeNoInstanceOperationEnabled
  • testNodeSwapSwapInNodeWithAlreadySwappingPair
  • testNodeSwapWrongFaultZone
  • testNodeSwapWrongCapacity
  • testNodeSwapNoTopologySetup
  • testNodeSwap
  • testNodeSwapSwapInNodeNoInstanceOperationDisabled
  • testNodeSwapCancelSwapWhenReadyToComplete
  • testNodeSwapAfterEMM
  • testNodeSwapWithSwapOutInstanceDisabled
  • testNodeSwapAddSwapInFirstEnabledBeforeSwapOutSet(
  • testNodeSwapAddSwapInFirstEnableBeforeSwapOutSet
  • testUnsetInstanceOperationOnSwapInWhenAlreadyUnsetOnSwapOut
  • testNodeSwapAddSwapInFirst
➜  helix git:(helix_node_swap_apis) ✗ mvn test -o -Dtest=TestInstanceOperation -pl=helix-core
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.apache.helix:metrics-common:bundle:1.3.2-SNAPSHOT
[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-javadoc-plugin @ org.apache.helix:helix:1.3.2-SNAPSHOT, /Users/zapinto/Documents/git2/zpinto/helix/pom.xml, line 678, column 17
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.apache.helix:helix:pom:1.3.2-SNAPSHOT
[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-javadoc-plugin @ line 678, column 17
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] --------------------< org.apache.helix:helix-core >---------------------
[INFO] Building Apache Helix :: Core 1.3.2-SNAPSHOT
[INFO]   from pom.xml
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO] 
[INFO] --- enforcer:1.4.1:enforce (enforce-maven-version) @ helix-core ---
[INFO] 
[INFO] --- enforcer:1.4.1:enforce (enforce-java-version) @ helix-core ---
[INFO] 
[INFO] --- enforcer:1.4.1:enforce (enforce-output-timestamp-property) @ helix-core ---
[INFO] 
[INFO] --- jacoco:0.8.6:prepare-agent (default) @ helix-core ---
[INFO] argLine set to -javaagent:/Users/zapinto/.m2/repository/org/jacoco/org.jacoco.agent/0.8.6/org.jacoco.agent-0.8.6-runtime.jar=destfile=/Users/zapinto/Documents/git2/zpinto/helix/helix-core/target/jacoco.exec
[INFO] 
[INFO] --- remote-resources:1.7.0:process (process-resource-bundles) @ helix-core ---
[INFO] Preparing remote bundle org.apache:apache-jar-resource-bundle:1.4
[INFO] Copying 3 resources from 1 bundle.
[INFO] 
[INFO] --- resources:3.2.0:resources (default-resources) @ helix-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 4 resources
[INFO] Copying 0 resource
[INFO] Copying 3 resources
[INFO] The encoding used to copy filtered properties files have not been set. This means that the same encoding will be used to copy filtered properties files as when copying other filtered resources. This might not be what you want! Run your build with --debug to see which files might be affected. Read more at https://maven.apache.org/plugins/maven-resources-plugin/examples/filtering-properties-files.html
[INFO] 
[INFO] --- compiler:3.10.1:compile (default-compile) @ helix-core ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- bundle:5.1.4:manifest (bundle-manifest) @ helix-core ---
[WARNING] Manifest org.apache.helix:helix-core:bundle:1.3.2-SNAPSHOT : Unused Import-Package instructions: [org.apache.logging.log4j*, org.apache.logging.slf4j*] 
[INFO] Writing manifest: /Users/zapinto/Documents/git2/zpinto/helix/helix-core/target/classes/META-INF/MANIFEST.MF
[INFO] 
[INFO] --- resources:3.2.0:testResources (default-testResources) @ helix-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 15 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- compiler:3.10.1:testCompile (default-testCompile) @ helix-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 498 source files to /Users/zapinto/Documents/git2/zpinto/helix/helix-core/target/test-classes
[INFO] /Users/zapinto/Documents/git2/zpinto/helix/helix-core/src/test/java/org/apache/helix/integration/TestCarryOverBadCurState.java: Some input files use or override a deprecated API.
[INFO] /Users/zapinto/Documents/git2/zpinto/helix/helix-core/src/test/java/org/apache/helix/integration/TestCarryOverBadCurState.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/zapinto/Documents/git2/zpinto/helix/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/zapinto/Documents/git2/zpinto/helix/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- surefire:3.0.0-M3:test (default-test) @ helix-core ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.helix.integration.rebalancer.TestInstanceOperation
Start zookeeper at localhost:2183 in thread main

...

START TestInstanceOperation.testAddingNodeWithSwapOutInstanceOperation() at Wed Nov 01 16:07:33 PDT 2023
START TestInstanceOperation.testAddingNodeWithSwapOutNodeInstanceOperationUnset() at Wed Nov 01 16:07:35 PDT 2023
START TestInstanceOperation.testNodeSwapWithNoSwapOutNode() at Wed Nov 01 16:07:37 PDT 2023
START TestInstanceOperation.testNodeSwapSwapInNodeNoInstanceOperationEnabled() at Wed Nov 01 16:07:39 PDT 2023
START TestInstanceOperation.testNodeSwapSwapInNodeWithAlreadySwappingPair() at Wed Nov 01 16:07:43 PDT 2023
START TestInstanceOperation.testNodeSwapNoTopologySetup() at Wed Nov 01 16:07:47 PDT 2023
START TestInstanceOperation.testNodeSwapWrongFaultZone() at Wed Nov 01 16:07:49 PDT 2023
START TestInstanceOperation.testNodeSwapWrongCapacity() at Wed Nov 01 16:07:55 PDT 2023
START TestInstanceOperation.testNodeSwap() at Wed Nov 01 16:07:57 PDT 2023
START TestInstanceOperation.testNodeSwapSwapInNodeNoInstanceOperationDisabled() at Wed Nov 01 16:08:05 PDT 2023
START TestInstanceOperation.testNodeSwapCancelSwapWhenReadyToComplete() at Wed Nov 01 16:08:15 PDT 2023
START TestInstanceOperation.testNodeSwapAfterEMM() at Wed Nov 01 16:08:26 PDT 2023
START TestInstanceOperation.testNodeSwapWithSwapOutInstanceDisabled() at Wed Nov 01 16:08:36 PDT 2023
START TestInstanceOperation.testNodeSwapAddSwapInFirstEnabledBeforeSwapOutSet() at Wed Nov 01 16:08:47 PDT 2023
START TestInstanceOperation.testNodeSwapAddSwapInFirstEnableBeforeSwapOutSet() at Wed Nov 01 16:08:50 PDT 2023
START TestInstanceOperation.testUnsetInstanceOperationOnSwapInWhenAlreadyUnsetOnSwapOut() at Wed Nov 01 16:08:55 PDT 2023
START TestInstanceOperation.testNodeSwapAddSwapInFirst() at Wed Nov 01 16:08:59 PDT 2023
AfterClass: TestInstanceOperation called.
Shut down zookeeper at port 2183 in thread main
[INFO] Tests run: 24, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 238.321 s - in org.apache.helix.integration.rebalancer.TestInstanceOperation
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 24, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- jacoco:0.8.6:report (generate-code-coverage-report) @ helix-core ---
[INFO] Loading execution data file /Users/zapinto/Documents/git2/zpinto/helix/helix-core/target/jacoco.exec
[INFO] Analyzed bundle 'Apache Helix :: Core' with 947 classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:36 min
[INFO] Finished at: 2023-10-30T12:32:08-04:00
[INFO] ------------------------------------------------------------------------

Changes that Break Backward Compatibility (Optional)

  • We change the compareTo method in AssignableNode to use logicalId to make sure partitionAssignment will be the same after switching to SWAP_IN node. This is only used for tie breaking, so impact should not be large on already existing WAGED cluster assignment; however, it can cause some replica shuffling.

Documentation (Optional)

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)

@zpinto zpinto changed the title APIs for Helix Node Swap HelixAdmin APIs for Helix Node Swap Oct 17, 2023
@asfgit asfgit force-pushed the ApplicationClusterManager branch from 7fca663 to 5f1a3f7 Compare October 17, 2023 20:25
@zpinto zpinto force-pushed the helix_node_swap_apis branch from c16310f to 7063dec Compare October 17, 2023 20:56
@zpinto zpinto marked this pull request as ready for review October 19, 2023 22:11
New APIs:
- isSwapReadyToComplete
- completeSwapIfReady

Updated APIs:
- setInstanceOperation
- addInstance (check to make sure no other instances with same logicalId unless old has SWAP_OUT and to add has SWAP_IN)
@zpinto zpinto force-pushed the helix_node_swap_apis branch from 7063dec to ee03fd2 Compare October 20, 2023 20:24
@zpinto zpinto changed the title HelixAdmin APIs for Helix Node Swap HelixAdmin APIs and pipeline changes to support Helix Node Swap Oct 26, 2023
Copy link
Contributor

@desaikomal desaikomal left a comment

Choose a reason for hiding this comment

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

these are just my initial comments, i will do next pas soon..

* swapIn instance can be passed in.
* @param clusterName The cluster name
* @param instanceName The instance that is being swapped out or swapped in
* @return True if the swap is ready to be completed, false otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry for my lack of understanding, typically swap involves 2 entries, why does the API take only one? Also what does "swap" mean in this context?

Copy link
Contributor

Choose a reason for hiding this comment

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

unless instanceName is like "virtual" and there are 2 entities tied to the same virtual instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instance name in this case will be one of the unique instance names(same as InstanceConfig znode ID) involved in the swap. Either SWAP_OUT or SWAP_IN. This API is intended to be used with the PerInstanceAccessor in helix-rest. For that endpoint you pass one instanceName.

Because we can find the matching swap instance for either SWAP_OUT or SWAP_IN node, we can take either as the instance name.

"swap" is referring to the operation between two instances which can be deduced from providing one of the instances involved in the swap.

… fix AssignableNode to check for clusterTopologyConfig when attempting to get logicalId.
…join the cluster with an invalid DOMAIN field.
…ONE and matching INSTANCE_CAPACITY_MAP to SWAP_OUT node.
*
* @return a set of SWAP_IN instanceNames that have a corresponding SWAP_OUT instance.
*/
public Set<String> getEnabledLiveSwapInInstanceNames() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: when we tag SWAP_IN instanceNames, don't we already check if there is already an paring SWAP_OUT instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline.

TLDR: Sanity checks ensure that we can't have a case where there are two instances with the same logicalId and both have InstanceOperation unset. This allows for setting either SWAP_OUT node or SWAP_IN node instance operation first.

@@ -113,9 +114,16 @@ public IdealState computeNewIdealState(String resourceName,
allNodes = clusterData.getAllInstances();
}

Set<String> allNodesDeduped = DelayedRebalanceUtil.filterOutInstancesWithDuplicateLogicalIds(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we could integrate the logic into getEnabledLiveInstances?
Probably with better name when we work on consolidating operation and disable/enable in one enum and we redesign all the getters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a TODO for this. We can do it when we refactor to use states instead of InstanceOperation.

@zpinto
Copy link
Contributor Author

zpinto commented Nov 3, 2023

CI failure is due to recurring flaky test testDistributedController #2498

This PR is ready to be merged.

Final Commit Message:

Add ability for up to 2 nodes with the same logicalId to be added to the cluster at the same time when a SWAP is happening.
During all paritionAssignment for WAGED and DelayedAutoRebalancer, we select just one instance for each logicalId. Achieves n -> n+1 for all replicas on SWAP_OUT node and back n when SWAP is marked complete, making it cancelable.

Adding and updating Helix Admin APIs to support swap operation:

  • setInstanceOperation
  • addInstance
  • canCompleteSwap
  • completeSwapIfPossible

@xyuanlu xyuanlu merged commit 7613cab into apache:ApplicationClusterManager Nov 3, 2023
1 of 2 checks passed
asfgit pushed a commit that referenced this pull request Nov 13, 2023
Add ability for up to 2 nodes with the same logicalId to be added to the cluster at the same time when a SWAP is happening.
During all paritionAssignment for WAGED and DelayedAutoRebalancer, we select just one instance for each logicalId. Achieves n -> n+1 for all replicas on SWAP_OUT node and back n when SWAP is marked complete, making it cancelable.

Adding and updating Helix Admin APIs to support swap operation:

setInstanceOperation
addInstance
canCompleteSwap
completeSwapIfPossible
* Refactor sanity checks for HelixAdmin swap APIs.

* Helix Node Swap pipeline changes and integration tests.

* Fix integration tests to properly restore stopped MockParticipant so following tests are not affected.

* Add comments and docstrings.

* Fix tests to clean up after themselves.

* Optimize duplicate logicalId filtering to only be called on allNodes and then used to remove duplicate logicalIds from enabledLiveNodes.

* Add handling for clusterConfig == null in updateSwappingInstances and fix AssignableNode to check for clusterTopologyConfig when attempting to get logicalId.

* Fix integ tests.

* Fix testGetDomainInformation since we no longer allow an instance to join the cluster with an invalid DOMAIN field.

* Add checks to ensure that the SWAP_IN instance has a matching FAULT_ZONE and matching INSTANCE_CAPACITY_MAP to SWAP_OUT node.

* Rename canSwapBeCompleted to canCompleteSwap.

* Add sanity checks to allow SWAP_IN node to join the cluster in disabled state before SWAP_OUT node has instance operation set.

* Fix print in test case.

* Add canCompleteSwap to PerInstanceAccessor and fix formatting.

* Fix flaky node swap after completion by making sure replica has is computed with logicalIds intead of instanceNames.
asfgit pushed a commit that referenced this pull request Dec 8, 2023
Add ability for up to 2 nodes with the same logicalId to be added to the cluster at the same time when a SWAP is happening.
During all paritionAssignment for WAGED and DelayedAutoRebalancer, we select just one instance for each logicalId. Achieves n -> n+1 for all replicas on SWAP_OUT node and back n when SWAP is marked complete, making it cancelable.

Adding and updating Helix Admin APIs to support swap operation:

setInstanceOperation
addInstance
canCompleteSwap
completeSwapIfPossible
* Refactor sanity checks for HelixAdmin swap APIs.

* Helix Node Swap pipeline changes and integration tests.

* Fix integration tests to properly restore stopped MockParticipant so following tests are not affected.

* Add comments and docstrings.

* Fix tests to clean up after themselves.

* Optimize duplicate logicalId filtering to only be called on allNodes and then used to remove duplicate logicalIds from enabledLiveNodes.

* Add handling for clusterConfig == null in updateSwappingInstances and fix AssignableNode to check for clusterTopologyConfig when attempting to get logicalId.

* Fix integ tests.

* Fix testGetDomainInformation since we no longer allow an instance to join the cluster with an invalid DOMAIN field.

* Add checks to ensure that the SWAP_IN instance has a matching FAULT_ZONE and matching INSTANCE_CAPACITY_MAP to SWAP_OUT node.

* Rename canSwapBeCompleted to canCompleteSwap.

* Add sanity checks to allow SWAP_IN node to join the cluster in disabled state before SWAP_OUT node has instance operation set.

* Fix print in test case.

* Add canCompleteSwap to PerInstanceAccessor and fix formatting.

* Fix flaky node swap after completion by making sure replica has is computed with logicalIds intead of instanceNames.
asfgit pushed a commit that referenced this pull request Dec 13, 2023
Add ability for up to 2 nodes with the same logicalId to be added to the cluster at the same time when a SWAP is happening.
During all paritionAssignment for WAGED and DelayedAutoRebalancer, we select just one instance for each logicalId. Achieves n -> n+1 for all replicas on SWAP_OUT node and back n when SWAP is marked complete, making it cancelable.

Adding and updating Helix Admin APIs to support swap operation:

setInstanceOperation
addInstance
canCompleteSwap
completeSwapIfPossible
* Refactor sanity checks for HelixAdmin swap APIs.

* Helix Node Swap pipeline changes and integration tests.

* Fix integration tests to properly restore stopped MockParticipant so following tests are not affected.

* Add comments and docstrings.

* Fix tests to clean up after themselves.

* Optimize duplicate logicalId filtering to only be called on allNodes and then used to remove duplicate logicalIds from enabledLiveNodes.

* Add handling for clusterConfig == null in updateSwappingInstances and fix AssignableNode to check for clusterTopologyConfig when attempting to get logicalId.

* Fix integ tests.

* Fix testGetDomainInformation since we no longer allow an instance to join the cluster with an invalid DOMAIN field.

* Add checks to ensure that the SWAP_IN instance has a matching FAULT_ZONE and matching INSTANCE_CAPACITY_MAP to SWAP_OUT node.

* Rename canSwapBeCompleted to canCompleteSwap.

* Add sanity checks to allow SWAP_IN node to join the cluster in disabled state before SWAP_OUT node has instance operation set.

* Fix print in test case.

* Add canCompleteSwap to PerInstanceAccessor and fix formatting.

* Fix flaky node swap after completion by making sure replica has is computed with logicalIds intead of instanceNames.
xyuanlu pushed a commit that referenced this pull request Dec 20, 2023
Add ability for up to 2 nodes with the same logicalId to be added to the cluster at the same time when a SWAP is happening.
During all paritionAssignment for WAGED and DelayedAutoRebalancer, we select just one instance for each logicalId. Achieves n -> n+1 for all replicas on SWAP_OUT node and back n when SWAP is marked complete, making it cancelable.

Adding and updating Helix Admin APIs to support swap operation:

setInstanceOperation
addInstance
canCompleteSwap
completeSwapIfPossible
* Refactor sanity checks for HelixAdmin swap APIs.

* Helix Node Swap pipeline changes and integration tests.

* Fix integration tests to properly restore stopped MockParticipant so following tests are not affected.

* Add comments and docstrings.

* Fix tests to clean up after themselves.

* Optimize duplicate logicalId filtering to only be called on allNodes and then used to remove duplicate logicalIds from enabledLiveNodes.

* Add handling for clusterConfig == null in updateSwappingInstances and fix AssignableNode to check for clusterTopologyConfig when attempting to get logicalId.

* Fix integ tests.

* Fix testGetDomainInformation since we no longer allow an instance to join the cluster with an invalid DOMAIN field.

* Add checks to ensure that the SWAP_IN instance has a matching FAULT_ZONE and matching INSTANCE_CAPACITY_MAP to SWAP_OUT node.

* Rename canSwapBeCompleted to canCompleteSwap.

* Add sanity checks to allow SWAP_IN node to join the cluster in disabled state before SWAP_OUT node has instance operation set.

* Fix print in test case.

* Add canCompleteSwap to PerInstanceAccessor and fix formatting.

* Fix flaky node swap after completion by making sure replica has is computed with logicalIds intead of instanceNames.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants