dsmiley commented on code in PR #2571:
URL: https://github.com/apache/solr/pull/2571#discussion_r1694463314
##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java:
##########
@@ -246,6 +257,52 @@ public void testAliasHandling() throws Exception {
2, client.query(null,
paramsWithMixedCollectionAndAlias).getResults().getNumFound());
}
+ @Test
+ @LogLevel("org.apache.solr.servlet.HttpSolrCall=DEBUG")
+ public void testHttpCspPerf() throws Exception {
+
+ String collectionName = "HTTPCSPTEST";
+ CollectionAdminRequest.createCollection(collectionName, "conf", 2,
1).process(cluster.getSolrClient());
+ cluster.waitForActiveCollection(collectionName, 2, 2);
+
+ CloudSolrClient solrClient = null;
+ try (LogListener entireClusterStateLogs =
LogListener.info(HttpSolrCall.class).regex(PATTERN_WITHOUT_COLLECTION);
LogListener collectionClusterStateLogs =
LogListener.info(HttpSolrCall.class).regex(PATTERN_WITH_COLLECTION);
LogListener adminRequestLogs =
LogListener.info(HttpSolrCall.class).substring("[admin]")) {
Review Comment:
try-with-resources opportunity here for this CloudSolrClient
##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudHttp2SolrClientTest.java:
##########
@@ -246,6 +257,52 @@ public void testAliasHandling() throws Exception {
2, client.query(null,
paramsWithMixedCollectionAndAlias).getResults().getNumFound());
}
+ @Test
+ @LogLevel("org.apache.solr.servlet.HttpSolrCall=DEBUG")
+ public void testHttpCspPerf() throws Exception {
+
+ String collectionName = "HTTPCSPTEST";
+ CollectionAdminRequest.createCollection(collectionName, "conf", 2,
1).process(cluster.getSolrClient());
+ cluster.waitForActiveCollection(collectionName, 2, 2);
+
+ CloudSolrClient solrClient = null;
+ try (LogListener entireClusterStateLogs =
LogListener.info(HttpSolrCall.class).regex(PATTERN_WITHOUT_COLLECTION);
LogListener collectionClusterStateLogs =
LogListener.info(HttpSolrCall.class).regex(PATTERN_WITH_COLLECTION);
LogListener adminRequestLogs =
LogListener.info(HttpSolrCall.class).substring("[admin]")) {
+
+ solrClient = createHttpCSPBasedCloudSolrClient();
+
+ SolrInputDocument doc = new SolrInputDocument("id", "1", "title_s", "my
doc");
+ solrClient.add(collectionName, doc);
+ solrClient.commit(collectionName);
+ for (int i = 0; i < 3; i++) {
+ assertEquals(1, solrClient.query(collectionName, params("q",
"*:*")).getResults().getNumFound());
+ }
+
+ assertLogCount(adminRequestLogs, 12);
+ assertLogCount(collectionClusterStateLogs, 10);
+ assertLogCount(entireClusterStateLogs, 1);
Review Comment:
Could you add some comments explaining why these numbers are what they are?
I know the entireClusterStateLogs is to fetch live nodes, which is a TODO
that we can reference another JIRA on.
Why do we get collection cluster state 10 times? Shouldn't it be once?
I think admin should be the sum of the others but there's one more,
suggesting there's another request we didn't anticipate?
--
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]