Skip to content

Conversation

@mhl-b
Copy link
Contributor

@mhl-b mhl-b commented Jul 8, 2025

Refactor org.elasticsearch.cluster.routing.allocation.decider.Decision. Change to sealed interface and use records for Single and Multi. Also remove recursive Multi decision support.

@mhl-b mhl-b added >non-issue :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) Team:Distributed Coordination Meta label for Distributed Coordination team v9.2.0 labels Jul 8, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

}

final Decision decision = new Decision.Multi().add(allocationDecision).add(rebalanceDecision);
final Decision.Type canAllocateOrRebalance = Decision.Type.min(allocationDecision.type(), rebalanceDecision.type());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this place could create nested multi decision

Copy link
Contributor

@DiannaHohensee DiannaHohensee left a comment

Choose a reason for hiding this comment

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

LGTM

return true;
}
return false;
} else return other == THROTTLE && this == YES;
Copy link
Contributor

Choose a reason for hiding this comment

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

slight nit that this isn't our usual style for if-else statements, skipping the {} brackets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm intellij auto-format did that and spotless didn't complain either.

}

@Override
public boolean equals(Object object) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you remove this because equality is unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I keep toString for bwc. If exact format is not important can remove it too.

Copy link
Contributor

@DiannaHohensee DiannaHohensee Jul 11, 2025

Choose a reason for hiding this comment

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

I think a change might affect the allocation explain response? I'd leave it for bwc, as you say.

@mhl-b mhl-b merged commit 5453a2d into elastic:main Jul 12, 2025
33 checks passed
szybia added a commit to szybia/elasticsearch that referenced this pull request Jul 14, 2025
…king

* upstream/main: (33 commits)
  Allow both WithEntitlementsOnTestCode and EntitledTestPackages together (elastic#130826)
  Move streams status actions to cluster:monitor group (elastic#131015)
  Update JDK base image for OIDC fixture (elastic#131176)
  Mute org.elasticsearch.xpack.esql.ccq.MultiClustersIT testLookupJoinAliases elastic#131166
  Mute org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceDiskSpaceTests testEnqueuedMergeTasksAreUnblockedWhenEstimatedMergeSizeChanges elastic#131165
  Mute org.elasticsearch.xpack.esql.ccq.MultiClustersIT testNotLikeListKeyword elastic#131155
  Mute org.elasticsearch.xpack.esql.qa.multi_node.GenerativeIT test elastic#131154
  Check file entitlements on the Lucene FilterFileSystem in tests (elastic#130825)
  Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {lookup-join.MvJoinKeyOnFromAfterStats ASYNC} elastic#131148
  Move FrequencyCappedAction to common package (elastic#131060)
  Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT testStopQueryLocal elastic#121672
  Remove nesting from multi allocation decision (elastic#130844)
  Disable async search rest tests in release builds (elastic#131132)
  Fix testStopQueryLocal (elastic#131130)
  Fixes based on resharding disruption tests (elastic#130870)
  Remove inactive logger (elastic#131121)
  Add wait for remote start for the test (elastic#131124)
  Add existing shards allocator settings to failure store allowed list. (elastic#131056)
  Don't allow field caps to use semantic queries as index filters (elastic#131111)
  issue should be already fixed by elastic#121466 (elastic#130860)
  ...
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 17, 2025
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >non-issue Team:Distributed Coordination Meta label for Distributed Coordination team v9.2.0