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

Helix Node/Instance Swap #2662

Closed
6 tasks done
zpinto opened this issue Oct 17, 2023 · 1 comment
Closed
6 tasks done

Helix Node/Instance Swap #2662

zpinto opened this issue Oct 17, 2023 · 1 comment
Assignees

Comments

@zpinto
Copy link
Contributor

zpinto commented Oct 17, 2023

Helix Node/Instance Swap

Implementation for N -> N + 1 -> N instance swap for all replicas on the instance

  1. Bootstrap new replicas on the SWAP_IN node: New replicas are created for all the partitions hosted on the node to be replaced. These new replicas are then assigned and bootstrapped on the SWAP_IN-node.
  2. Remove replicas from the SWAP_OUT node: After successfully bootstrapping all the new replicas, the SWAP_OUT node will have its replicas dropped. Waiting until all replicas bootstrap on the SWAP_IN node will ensure we maintain all partitions desired replication factor.
  3. Do not populate SWAP_IN replicas in routing tables until SWAP is completed. (Avoid spectator serving traffic to SWAP_IN node)

Requirements

  • Swapping of a node requires “transaction”. When bootstrapping new replicas on the SWAP_IN host, replica count of all partitions should be N + 1 (and should be in topState or secondTopState) before SWAP_OUT node can begin dropping replicas (which will return replica count to N)

Assumptions

When a node is being swapped, the following criteria must be met for the SWAP_IN node:

  1. The cluster must have TOPOLOGY with a FAULT_ZONE_TYPE and EndNodeType:
  • EndNodeType is the last key in the TOPOLOGY. The corresponding value is considered to be the logicalId. This is necessary as logicalId will need to be used for deterministic placement when the SWAP_IN node is introduced as an assignable node.
  1. DOMAIN of SWAP_IN and SWAP_OUT must have identical fault zone and logicalId.
  2. This will be further explained in the topology section
  3. If WAGED is enabled in the cluster, the INSTANCE_CAPACITY_MAP should match exactly.

Without these assumptions, it is not possible to swap a node as this would not be considered the best possible assignment for the cluster. If these assumptions cannot be met, this functionality should not be utilized. Instead the old node should use the Node Evacuation flow. A new instance can be added in the ENABLED state either before or after to replenish the capacity of removing the old node.

Execution

  • HelixAdmin.setInstanceOperation and addInstance sanity checks for SWAP_IN & SWAP_OUT
  • Create HelixAdmin.canCompleteSwap and completeSwapIfPossible(returns if swap finished)
  • Refactor BaseControllerDataProvider only allow AssignableNodes (either SWAP_OUT or SWAP_IN) and update all places with either getAssignableInstances or getAllInstances.
  • Refactor BestPossibleStateCalcStage to add SWAP_IN node with correct states to stateMaps containing SWAP_OUT node following partitionAssignment and partitionState calculation.
  • Refactor WAGED to do assignment based on logicalId instead of instanceName.
  • Refactor routing provider to not include replicas from SWAP_IN nodes in routing tables
@zpinto
Copy link
Contributor Author

zpinto commented Dec 20, 2023

This issue has now been closed with the merging of Application Cluster Manager branch. #2714

@zpinto zpinto closed this as completed Dec 20, 2023
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

No branches or pull requests

2 participants