Skip to content

Rewire minActiveReplica to IdealState and delete MIN_ACTIVE_REPLICAS from ResourceConfig - #272

Open
sjainit wants to merge 1 commit into
linkedin:devfrom
sjainit:sarjain/delete-resourceconfig-minactivereplica
Open

sjainit wants to merge 1 commit into
linkedin:devfrom
sjainit:sarjain/delete-resourceconfig-minactivereplica

Conversation

@sjainit

@sjainit sjainit commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Part of the ResourceConfig config-surface simplification epic (CICP-51496). Makes IdealState the single source of truth for minActiveReplica, physically deleting the duplicated MIN_ACTIVE_REPLICAS key from ResourceConfig.

MIN_ACTIVE_REPLICAS was never set on ResourceConfig in production (0/780 clusters set it on RC; all set it on IdealState). The only RC-side reader was DelayedRebalanceUtil.getMinActiveReplica(ResourceConfig, IdealState, int) — a 3-tier priority helper (RC → IdealState → replicaCount). Every one of its 4 callers built a merged RC inline purely to feed this call, and a merged RC already copies IdealState's value when RC is unset. So dropping the RC tier and reading IdealState directly is behavior-preserving for every real cluster.

Changes

  • ResourceConfig: remove the MIN_ACTIVE_REPLICAS enum constant, both constructor params, the field-write, getMinActiveReplica(), the Builder field + getter/setter, the build() arg, and the merge line in mergeIdealStateWithResourceConfig.
  • DelayedRebalanceUtil.getMinActiveReplica: drop the ResourceConfig tier; new signature getMinActiveReplica(IdealState, int) reads minActiveReplicas directly off IdealState, falling back to replicaCount. Also removed the stale TODO: Remove the idealState input once we have all the config information migrated to the resource config — that predates the campaign's IdealState-as-source-of-truth direction.
  • Rewire the 4 callers (2 internal in DelayedRebalanceUtil, WagedRebalancer, DelayedAutoRebalancer) to the 2-arg helper, dropping the inline mergeIdealStateWithResourceConfig.
  • ResourceConfigTrimmer: remove the MIN_ACTIVE_REPLICAS non-trimmable entry (change detection trims raw persisted RCs, which never carry it; IdealState changes are detected separately via IdealStateTrimmer).
  • Tests: drop RC-side minActiveReplica assertions/setters in TestResourceConfig and TestClusterModelProvider; IdealState still sets it (setMinActiveReplicas), so merged-config assertions still exercise the value.

Testing Done

  • JDK 11: mvn -o -pl helix-rest -am test -Dtest=TestResourceConfig,TestClusterModelProvider,TestHelixPropoertyTimmer,TestWagedRebalancer -Dsurefire.failIfNoSpecifiedTests=false — passes, including core and REST main/test compilation and all 38 selected test cases.
  • Constructor and IdealState merge coverage preserve the other ResourceConfig settings while removing only MIN_ACTIVE_REPLICAS.

Scope and related PRs

@LZD-PratyushBhatt

Copy link
Copy Markdown
Collaborator

wrong base branch, switch to dev. rebase the PR.

@sjainit
sjainit force-pushed the sarjain/delete-resourceconfig-minactivereplica branch from 3cbaf25 to d7cdbb3 Compare September 16, 2026 17:09
@sjainit
sjainit changed the base branch from master to dev September 16, 2026 17:09
Assert
.assertEquals(mergedResourceConfig.getMinActiveReplica(), testConfig.getMinActiveReplica());
Assert.assertEquals(mergedResourceConfig.isEnabled(), testConfig.isEnabled());
Assert.assertEquals(mergedResourceConfig.getResourceGroupName(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

wait, the asserts dropped just above here sit under the // Test priority, Resource Config field has higher priority. comment. mergeIdealStateWithResourceConfig uses setIntFieldIfAbsent, so a value set on the ResourceConfig wins and reading IdealState directly flips that. does the data scraping also cover RC znodes already persisted with the key? bcause that can change the behavior if this gets deployed

STATE_MODEL_FACTORY_NAME,
REPLICAS,
MIN_ACTIVE_REPLICAS,
MAX_PARTITIONS_PER_INSTANCE,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

just to confirm, description says 0/780 clusters, but minActiveReplica is a per resource setting and #267 counted 40,613 resources. did the scan walk every resource config inside those clusters?

…onfig copy

Remove only MIN_ACTIVE_REPLICAS from ResourceConfig and read the minimum from IdealState in delayed and WAGED rebalance paths, retaining the replica-count fallback. Preserve all other ResourceConfig settings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sjainit
sjainit force-pushed the sarjain/delete-resourceconfig-minactivereplica branch from d7cdbb3 to d91fdce Compare September 17, 2026 16:35
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.

2 participants