In SolrJ, using the interface available for making COLSTATUS collection calls will return the collection status for all collections on the cluster as opposed to just one when specifying the collection.
The API in question is CollectionAdminRequest.collectionStatus(collection) in the class CollectionAdminRequest.java]. This will create and return a new CollectionAdminRequest#ColStatus instance that extends AsyncCollectionSpecificAdminRequest.
The constructor of that class will pass the collection passed in to the parent] class and keep it in a param “collection”.
When we call AsyncCollectionSpecificAdminRequest.getParams(), we return:
With “name” set to the collection name. In CollectionsHandler where Solr handles the collection API operation request, it only copies the follow params if they exist into a new map of properties. Notice how it is missing “name” so we'll never copy that param even if it's included.
We then call ColStatus.java#getColStatus in the same block, getColStatus method will try to retrieve "collection" but will always return null since it's not used in the solrj interfaces and therefore grab the status from all collections vs the one specified when using solrj.
This is unfortunate as the command will send a request to every leader replica per collection when that was not the intention.
This can be reproduced by spinning up a cluster with 2+ collections and a short snippet of code which will return the status for all collections as opposed to one:
I think the simplest fix is to just add "NAME" to the list of params that get copied in CollectionsHandler and can try that a bit later.