Skip to content

SOLR-18381: remove ClusterState.getReplicaNamesPerCollectionOnNode - #4768

Open
serhiy-bzhezytskyy wants to merge 8 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18381-un-deprecate-createfromcollectionmap
Open

SOLR-18381: remove ClusterState.getReplicaNamesPerCollectionOnNode#4768
serhiy-bzhezytskyy wants to merge 8 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18381-un-deprecate-createfromcollectionmap

Conversation

@serhiy-bzhezytskyy

@serhiy-bzhezytskyy serhiy-bzhezytskyy commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/SOLR-18381

Removes ClusterState.getReplicaNamesPerCollectionOnNode (0 callers left after migrating ZkController/ZkControllerTest to collectionStream() + getReplicasOnNode), and un-deprecates createFromCollectionMap instead of removing it as the title suggests -- it's still called from createFromJson (deprecated, tracked separately in the still-open SOLR-18149) plus two production call sites.

14 tests, 0 failures.

SOLR-18370 (local, not yet a PR) also touches ZkController.java, different region -- re-check once it opens a PR.

AI-assisted (Claude Sonnet 5)

…n-deprecate createFromCollectionMap

getReplicaNamesPerCollectionOnNode had 0 remaining callers after migrating
ZkController/ZkControllerTest to collectionStream() + getReplicasOnNode.

createFromCollectionMap is un-deprecated instead of removed, contrary to the
ticket's title: it's still called from createFromJson (deprecated, tracked
separately in the still-open SOLR-18149) plus two production call sites.

AI-assisted (Claude Sonnet 5)
Same shape as apache#4763/apache#4761 -- a narrow, single-purpose ClusterState
helper, no observable behavior change.
@epugh

epugh commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I wonder if we wait till the fix for SOLR-18149 lands before merging this?

@epugh

epugh commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

also, for purely internal type changes with no change log, you can just add the label no-changelog ;-)

createFromJson's own deprecation is being resolved separately
(SOLR-18149) -- this comment shouldn't assume its status either way.
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

I don't have permissions to add labels as an outside contributor -- could you add no-changelog if that's the route you'd prefer? Same applies to #4761.

@epugh

epugh commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I don't have permissions to add labels as an outside contributor -- could you add no-changelog if that's the route you'd prefer? Same applies to #4761.

argh, that's annonying. also, feel free to just slap in a comment to that effect and I can do the bookeeping.

@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

Opened #4777 -- un-deprecates createFromJson instead of waiting on a removal, so no ordering dependency between the two anymore.

}

@Deprecated
/** Still used by {@link #createFromJson}. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

createFromJson has been removed. We can remove this one. Ideally should have folded both together into the same change to tackle ClusterState API IMO.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Checked — it has its own independent callers (BackupManager, DistributedClusterStateUpdater, ZkStateReader in production, plus 4 test files), unrelated to createFromJson. Can't remove it; createFromJson was just a thin wrapper over it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looking at this, it's apparent the logic should be simplified to only get the list of replicas on this node for the collection the test cares about. No need for a Map; only a List. Could build in a single Stream.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Already resolved -- main picked this up via #4760 (unrelated SOLR-18382 cleanup), and I just merged main into this branch. Current code is exactly what you described: no Map, just clusterState.getCollection(collectionName).getReplicasOnNode(nodeName).

…te-createfromcollectionmap

Resolves a conflict from SOLR-18149's createFromJson removal (main) colliding
with this branch's un-deprecation of createFromCollectionMap: drops the now-dead
createFromJson method/comment, keeps createFromCollectionMap un-deprecated.

Also addresses dsmiley's review: simplifies ZkControllerTest's replicasOnNode
lookup from a Map built over every collection to a direct getCollection() call
for the one collection the test actually checks.
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

Both addressed. Rebased on main (createFromJson is gone there per SOLR-18149/#4777, so dropped the now-dead method + the stale "Still used by createFromJson" comment). ZkControllerTest now does clusterState.getCollection(collectionName).getReplicasOnNode(nodeName) directly instead of building a Map over every collection -- ran testPublishAndWaitForDownStates locally, still passes.

@dsmiley dsmiley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@dsmiley dsmiley changed the title SOLR-18381: remove ClusterState.getReplicaNamesPerCollectionOnNode, un-deprecate createFromCollectionMap SOLR-18381: remove ClusterState.getReplicaNamesPerCollectionOnNode Aug 25, 2026
epugh and others added 3 commits August 25, 2026 16:54
…omcollectionmap' into SOLR-18381-un-deprecate-createfromcollectionmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants