-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLR-17582: Stream CLUSTERSTATUS API for SolrJ version >= 9.9 #3156
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,10 +131,11 @@ private void testModifyCollection() throws Exception { | |
.getResponse(); | ||
NamedList<?> cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<?> collections = (NamedList<?>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertEquals(1, collections.size()); | ||
assertEquals("25", collections._getStr(List.of(COLLECTION_NAME, "replicationFactor"), null)); | ||
Map<?, ?> collectionProperties = (Map<?, ?>) collections.get(COLLECTION_NAME); | ||
assertEquals("25", collectionProperties.get("replicationFactor")); | ||
|
||
params = new ModifiableSolrParams(); | ||
params.set("action", CollectionParams.CollectionAction.MODIFYCOLLECTION.toString()); | ||
|
@@ -153,10 +154,11 @@ private void testModifyCollection() throws Exception { | |
System.out.println(rsp); | ||
cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
collections = (NamedList<?>) cluster.get("collections"); | ||
collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertEquals(1, collections.size()); | ||
assertNull(collections._getStr(List.of(COLLECTION_NAME, "replicationFactor"), null)); | ||
collectionProperties = (Map<?, ?>) collections.get(COLLECTION_NAME); | ||
assertNull(collectionProperties.get("replicationFactor")); | ||
|
||
params = new ModifiableSolrParams(); | ||
params.set("action", CollectionParams.CollectionAction.MODIFYCOLLECTION.toString()); | ||
|
@@ -255,7 +257,7 @@ private void testNoConfigset() throws Exception { | |
NamedList<?> rsp = client.request(req); | ||
NamedList<?> cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<?> collections = (NamedList<?>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertNotNull( | ||
"Testing to insure collections are returned", collections.get(COLLECTION_NAME1)); | ||
|
@@ -282,7 +284,7 @@ private void assertCountsForRepFactorAndNrtReplicas(CloudSolrClient client, Stri | |
NamedList<Object> rsp = client.request(request); | ||
NamedList<?> cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<?> collections = (NamedList<?>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertEquals(1, collections.size()); | ||
@SuppressWarnings({"unchecked"}) | ||
|
@@ -304,7 +306,7 @@ private void clusterStatusWithCollectionAndShard() throws IOException, SolrServe | |
NamedList<Object> rsp = client.request(request); | ||
NamedList<?> cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<?> collections = (NamedList<?>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertNotNull(collections.get(COLLECTION_NAME)); | ||
assertEquals(1, collections.size()); | ||
|
@@ -330,7 +332,7 @@ private void clusterStatusWithCollectionAndMultipleShards() | |
NamedList<Object> rsp = request.process(client).getResponse(); | ||
NamedList<?> cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<?> collections = (NamedList<?>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertNotNull(collections.get(COLLECTION_NAME)); | ||
assertEquals(1, collections.size()); | ||
|
@@ -465,7 +467,7 @@ private void clusterStatusNoCollection() throws Exception { | |
NamedList<Object> rsp = client.request(request); | ||
NamedList<?> cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<?> collections = (NamedList<?>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertNotNull(collections.get(COLLECTION_NAME1)); | ||
assertEquals(4, collections.size()); | ||
|
@@ -487,7 +489,7 @@ private void clusterStatusWithCollection() throws IOException, SolrServerExcepti | |
NamedList<Object> rsp = client.request(request); | ||
NamedList<?> cluster = (NamedList<?>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<?> collections = (NamedList<?>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
Comment on lines
-490
to
+492
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very minor: consider use of |
||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertEquals(1, collections.size()); | ||
@SuppressWarnings({"unchecked"}) | ||
|
@@ -517,7 +519,7 @@ private void clusterStatusZNodeVersion() throws Exception { | |
NamedList<Object> rsp = client.request(request); | ||
NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
NamedList<Object> collections = (NamedList<Object>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertEquals(1, collections.size()); | ||
Map<String, Object> collection = (Map<String, Object>) collections.get(cname); | ||
|
@@ -533,7 +535,7 @@ private void clusterStatusZNodeVersion() throws Exception { | |
|
||
rsp = client.request(request); | ||
cluster = (NamedList<Object>) rsp.get("cluster"); | ||
collections = (NamedList<Object>) cluster.get("collections"); | ||
collections = (Map<?, ?>) cluster.get("collections"); | ||
collection = (Map<String, Object>) collections.get(cname); | ||
Integer newVersion = (Integer) collection.get("znodeVersion"); | ||
assertNotNull(newVersion); | ||
|
@@ -560,7 +562,7 @@ private void clusterStatusWithRouteKey() throws IOException, SolrServerException | |
NamedList<Object> cluster = (NamedList<Object>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
@SuppressWarnings({"unchecked"}) | ||
NamedList<Object> collections = (NamedList<Object>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertNotNull(collections.get(DEFAULT_COLLECTION)); | ||
assertEquals(1, collections.size()); | ||
|
@@ -607,7 +609,7 @@ private void clusterStatusAliasTest() throws Exception { | |
DEFAULT_COLLECTION + "," + COLLECTION_NAME, | ||
aliases.get("myalias")); | ||
|
||
NamedList<Object> collections = (NamedList<Object>) cluster.get("collections"); | ||
Map<?, ?> collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertNotNull(collections.get(DEFAULT_COLLECTION)); | ||
Map<String, Object> collection = (Map<String, Object>) collections.get(DEFAULT_COLLECTION); | ||
|
@@ -627,7 +629,7 @@ private void clusterStatusAliasTest() throws Exception { | |
|
||
cluster = (NamedList<Object>) rsp.get("cluster"); | ||
assertNotNull("Cluster state should not be null", cluster); | ||
collections = (NamedList<Object>) cluster.get("collections"); | ||
collections = (Map<?, ?>) cluster.get("collections"); | ||
assertNotNull("Collections should not be null in cluster state", collections); | ||
assertNotNull(collections.get(DEFAULT_COLLECTION)); | ||
assertNotNull(collections.get(COLLECTION_NAME)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I appreciate your thoroughness. I should merge this as-is. But... In an ideal world, you wouldn't have had any need to do this -- no time spent for you or an explicit test here to maintain in perpetuity. Solr is lacking backwards-compatibility test infrastructure. A hello-world SolrCloud would have caught this problem. Such a thing would nowadays almost certainly use Docker (to run old Solr versions) and use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood. Would you prefer I just remove these backwards compatibility tests I wrote? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm; I wonder if HttpSolrCall could be null. No; we don't use CollectionsHandler in SolrCloud with an EmbeddedSolrServer. I really wish Java had a null-safe navigation operator as used in Kotlin --
?.
. I suppose leave this be; not worth adding verbosity for an exotic / hypothetical case.