serhiy-bzhezytskyy commented on code in PR #4760:
URL: https://github.com/apache/solr/pull/4760#discussion_r3821470680
##########
solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java:
##########
@@ -285,39 +285,41 @@ private Map<String, ReplicaData>
getTestDataForAllReplicas()
DocCollection collectionState =
cluster.getSolrClient().getClusterState().getCollection(COLLECTION);
- for (Replica replica : collectionState.getReplicas()) {
-
- String coreName = replica.getCoreName();
- try (SolrClient client = getHttpSolrClient(replica)) {
-
- ModifiableSolrParams params = new ModifiableSolrParams();
- params.set("command", "indexversion");
- params.set("_trace", "getIndexVersion");
- QueryRequest req = setAuthIfNeeded(new
QueryRequest(ReplicationHandler.PATH, params));
-
- NamedList<Object> res = client.request(req);
- assertNotNull("null response from server: " + coreName, res);
-
- Object version = res.get("indexversion");
- assertNotNull("null version from server: " + coreName, version);
- assertTrue("version isn't a long: " + coreName, version instanceof
Long);
-
- long numDocs =
- setAuthIfNeeded(
- new QueryRequest(
- params(
- "q", "*:*",
- "distrib", "false",
- "rows", "0",
- "_trace", "counting_docs")))
- .process(client)
- .getResults()
- .getNumFound();
-
- final ReplicaData data =
- new ReplicaData(replica.getShard(), coreName, (Long) version,
numDocs);
- log.info("{}", data);
- results.put(coreName, data);
+ for (Slice slice : collectionState) {
Review Comment:
Done as a separate commit -- renamed the 4 outlier `coll`/`c`/`colState`
names to `collectionState` across the sites this PR touches. Also noticed the
`CollectionTooManyReplicasTest` one you commented on had no extra logic beyond
the check, so collapsed it to `getReplicaStream().allMatch(...)` instead,
matching what the majority of sites already do.
AI-assisted (Claude Sonnet 5)
##########
solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionTooManyReplicasTest.java:
##########
@@ -113,8 +113,10 @@ public void testAddTooManyReplicas() throws Exception {
"Expected to see all replicas active",
collectionName,
c -> {
- for (Replica r : c.getReplicas()) {
- if (r.getState() != Replica.State.ACTIVE) return false;
+ for (Slice s : c) {
Review Comment:
Follow-up: simplified this one further to
`docCollection.getReplicaStream().allMatch(r -> r.getState() ==
Replica.State.ACTIVE)` -- no extra logic here beyond the check, so it collapses
cleanly.
AI-assisted (Claude Sonnet 5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]