Skip to content

Delete unread NUM_PARTITIONS from ResourceConfig - #271

Merged
sjainit merged 1 commit into
linkedin:devfrom
sjainit:sarjain/delete-resourceconfig-numpartitions
Sep 17, 2026
Merged

sjainit merged 1 commit into
linkedin:devfrom
sjainit:sarjain/delete-resourceconfig-numpartitions

Conversation

@sjainit

@sjainit sjainit commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

What

Removes the NUM_PARTITIONS field from ResourceConfig, continuing the ResourceConfig config-surface cleanup that makes IdealState the single source of truth for structural fields.

Why

The partition count on ResourceConfig has no readers:

  • Every getNumPartitions() call in main source reads it off IdealState (ZKHelixAdmin ×2, ClusterStateVerifier) — never off ResourceConfig.
  • There are no direct ResourceConfigProperty.NUM_PARTITIONS reads anywhere.
  • JobConfig/WorkflowConfig (which extend ResourceConfig) don't touch it.

IdealState owns the partition count and has its own independent change detection via IdealStateTrimmer (whose non-trimmable set includes IdealStateProperty.NUM_PARTITIONS), so removing the ResourceConfig copy loses no signal.

Changes

Remove from ResourceConfig: the NUM_PARTITIONS enum constant, getNumPartitions() getter, Builder field + getNumPartitions/setNumPartitions, constructor param + field write, the validate() check, and the IdealStateResourceConfig merge line. Also drop the NUM_PARTITIONS entry from ResourceConfigTrimmer's non-trimmable set, and remove vestigial setNumPartitions calls from tests.

Why dropping it from ResourceConfigTrimmer is safe

The change detector trims the raw persisted ResourceConfig (ResourceChangeSnapshot trims dataProvider.getResourceConfigMap()), not the IdealState-merged one. Production ResourceConfig ZNodes never persist NUM_PARTITIONS, so trimming it changes nothing; IdealState partition-count changes are still detected via the separate IdealState path.

Testing Done

  • JDK 11: mvn -o -pl helix-rest -am test -Dtest=TestResourceConfig,TestClusterModelProvider,TestHelixPropoertyTimmer -Dsurefire.failIfNoSpecifiedTests=false — passes, including core and REST main/test compilation and all 23 selected test cases.
  • Constructor coverage checks surviving fields and the absence of retired raw fields, including NUM_PARTITIONS. The IdealState merge regression retains coverage that existing raw group metadata is preserved.

Scope and related PRs

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

@LZD-PratyushBhatt

LZD-PratyushBhatt commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

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

@sjainit
sjainit force-pushed the sarjain/delete-resourceconfig-numpartitions branch from 8a3a904 to 9add924 Compare September 16, 2026 17:20
@sjainit
sjainit changed the base branch from master to dev September 16, 2026 17:21

@LZD-PratyushBhatt LZD-PratyushBhatt left a comment

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.

one ask before the enum goes.

MONITORING_DISABLED, // Resource-level config, do not create Mbean and report any status for the resource.
NUM_PARTITIONS,
STATE_MODEL_DEF_REF,
STATE_MODEL_FACTORY_NAME,

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.

can we get the usage count for NUM_PARTITIONS on ResourceConfig like we did for other PRs as well, just for bookkeeping? the trimmer side already looks fine since IdealStateTrimmer keeps NUM_PARTITIONS, so change detection will work still.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No usage @LZD-PratyushBhatt, everybody sets it on IdealState

@sjainit
sjainit force-pushed the sarjain/delete-resourceconfig-numpartitions branch from 9add924 to 3ae1ba8 Compare September 17, 2026 16:00
Keep IdealState as the partition-count source of truth. Remove only the ResourceConfig partition-count field and its constructor, builder, merge, and trimmer handling; preserve all other ResourceConfig settings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sjainit
sjainit force-pushed the sarjain/delete-resourceconfig-numpartitions branch from 3ae1ba8 to 9612b62 Compare September 17, 2026 16:35
@sjainit
sjainit merged commit d36ff27 into linkedin:dev Sep 17, 2026
3 checks passed
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