8000 Added code for initial placement by RiyaTyagi · Pull Request #4361 · m3db/m3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added code for initial placement #4361

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

Open
wants to merge 3 commits into
base: sub-cluster-5
Choose a base branch
from
Open

Conversation

RiyaTyagi
Copy link
Collaborator
@RiyaTyagi RiyaTyagi commented Jun 27, 2025

What this PR does / why we need it:
This PR adds the complete code for Initial placement with following changes:

  • The subclustered placement also uses the instance heap used by the sharded placement algorithm to assign shards to the instances based on the load left on the instance. But, in this case when the load on two instances is same instead of choosing the smallest instance by ID we randomly choose an instance. This is to minimize the shard sharing percentage between the nodes of different isolation groups within a subcluster. For initial placement it doesn't make any difference but while adding instances, especially when the name of the instances are ordered, i.e i1,i2,i3,i4 ...,. We are not violating the property of overloading or under-loading an instance because this randomness is only introduced when the load on two instances is same. For adding this functionality a new field in heap struct has been introduced which will be false in case of sharded algorithm and thus will not have any affect on currebt sharded algo implementation.
  • The method of placeShards has been implemented which is identical to one in the sharded algorithm. It tries to place the shard to instances using instanceHeap to distribute the shard equally.
  • The moveShard method checks if a shard can be moved from one one instance to another. In case of initialPlacement fromInstance is always nil.
  • The canAssignInstance checks if the shard can be assigned to the toInstance making sure that all the shard replicas are assigned to a single subcluster and shards are equally distributed among the subclusters.
  • CanMoveShard method makes sure that replicas of the shards are assigned to different isolation group.
  • The method generatePlacement generates a subclustered placement based on the shard assignment.
  • returnInitializingShardsToSource is again identical to sharded algorithm and return any INITIALIZING shards to its source before assigning them to other instances through placeShards.

@RiyaTyagi RiyaTyagi marked this pull request as ready for review June 30, 2025 11:08
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

Successfully merging this pull request may close these issues.

1 participant
0