Yjd dev - #1485
Merged
Merged
Yjd dev#1485
Conversation
A failure domain is the unit whose members fail together. Several store instances on one machine share its kernel, power and NIC, so the domain is keyed by the store's server host; Helper::FailureDomainKey is the one place to change when rack or zone awareness is added later. FailureDomainProfile turns a peer set into its per-domain replica counts sorted descending, and IsFailureDomainNoWorse compares two profiles lexicographically ([1,1,1] < [2,1] < [3]) so callers can tell whether a change packs more replicas into one domain than before.
…osts) Every placement path worked per store_id with no notion of a host, so on a four-host cluster with five store instances each, 1955 of 2009 regions ended up with two replicas on one machine. This makes the coordinator failure-domain aware, keyed by the store's server host: - SelectStore spreads a new region's replicas over distinct hosts best-effort (PickStoresAcrossFailureDomains). With fewer hosts than replicas it stacks as little as possible and never fails creation. - ChangePeerRegion and ChangePairPeerRegion get a commit-side guard (ValidateFailureDomainNoWorse): a same-size change may not make the per-host profile worse, an added replica may not exceed ceil(replicas / online hosts), removals always pass. The rule is "no worse", not "must be legal", so legacy packed regions stay repairable. Refusals return ECHANGE_PEER_FAILURE_DOMAIN_WORSE. In verify_peer_on_store mode the effective peer set is rebuilt with set semantics (BuildEffectiveStoreIds), so activating a shadow peer is not mistaken for adding a replica. - Balance region pre-checks each move with the same rule, resolving peer hosts from the store map exactly like the guard, and reports domain rejections as one line per store pair. - Balance leader refuses to move a leader into a host that already holds more than its even share times (1 + tolerance); a move between two stores on the same host is exempt. - ChangePairPeerRegion rejects duplicate store ids, which set_difference would otherwise let through. Runtime knobs via ControlConfig: enable_failure_domain_guard, enable_failure_domain_placement, balance_leader_failure_domain_tolerance. Bumps dingo-store-proto to 494bf56 for the new errno.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.