-
Notifications
You must be signed in to change notification settings - Fork 739
Introduce GenericCollectionRequest #3423
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
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 |
---|---|---|
|
@@ -31,8 +31,7 @@ | |
import org.apache.solr.client.solrj.SolrRequest; | ||
import org.apache.solr.client.solrj.SolrRequest.METHOD; | ||
import org.apache.solr.client.solrj.SolrServerException; | ||
import org.apache.solr.client.solrj.request.GenericSolrRequest; | ||
import org.apache.solr.client.solrj.response.SimpleSolrResponse; | ||
import org.apache.solr.client.solrj.request.GenericCollectionRequest; | ||
import org.apache.solr.common.SolrException; | ||
import org.apache.solr.common.SolrException.ErrorCode; | ||
import org.apache.solr.common.SolrInputDocument; | ||
|
@@ -681,8 +680,8 @@ private UpdateCommand fetchFullUpdateFromLeader(AddUpdateCommand inplaceAdd, lon | |
params.set(DISTRIB, false); | ||
params.set("getInputDocument", id); | ||
params.set("onlyIfActive", true); | ||
SolrRequest<SimpleSolrResponse> ur = | ||
new GenericSolrRequest(METHOD.GET, "/get", params).setRequiresCollection(true); | ||
var ur = | ||
new GenericCollectionRequest(METHOD.GET, "/get", SolrRequest.SolrRequestType.ADMIN, params); | ||
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. making the request type mandatory; force you to think about it. RTG is used for internal purposes; maybe QUERY would get throttled? Or maybe not; I recall the rate limiter would ignore internal requests. LBSolrClient should retry a QUERY but not ADMIN; maybe this should be QUERY. |
||
|
||
String leaderUrl = getLeaderUrl(id); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
import org.apache.solr.client.solrj.SolrRequest; | ||
import org.apache.solr.client.solrj.SolrServerException; | ||
import org.apache.solr.client.solrj.request.CollectionAdminRequest; | ||
import org.apache.solr.client.solrj.request.GenericSolrRequest; | ||
import org.apache.solr.client.solrj.request.GenericCollectionRequest; | ||
import org.apache.solr.client.solrj.request.QueryRequest; | ||
import org.apache.solr.cloud.SolrCloudTestCase; | ||
import org.apache.solr.common.SolrInputDocument; | ||
|
@@ -106,9 +106,9 @@ public void testNonExistentQuery() throws Exception { | |
ModifiableSolrParams params = new ModifiableSolrParams(); | ||
params.set("queryUUID", "foobar"); | ||
|
||
GenericSolrRequest request = | ||
new GenericSolrRequest(SolrRequest.METHOD.GET, "/tasks/cancel", params) | ||
.setRequiresCollection(true); | ||
var request = | ||
new GenericCollectionRequest( | ||
SolrRequest.METHOD.GET, "/tasks/cancel", SolrRequest.SolrRequestType.ADMIN, params); | ||
NamedList<Object> queryResponse = cluster.getSolrClient(COLLECTION_NAME).request(request); | ||
|
||
assertEquals("Query with queryID foobar not found", queryResponse.get("status")); | ||
|
@@ -185,8 +185,11 @@ private NamedList<String> listTasks() throws SolrServerException, IOException { | |
cluster | ||
.getSolrClient(COLLECTION_NAME) | ||
.request( | ||
new GenericSolrRequest(SolrRequest.METHOD.GET, "/tasks/list") | ||
.setRequiresCollection(true)); | ||
new GenericCollectionRequest( | ||
SolrRequest.METHOD.GET, | ||
"/tasks/list", | ||
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. it was a little eye-opening to see we have a handler that doesn't "look" like an admin handler but is one |
||
SolrRequest.SolrRequestType.ADMIN, | ||
new ModifiableSolrParams())); | ||
return (NamedList<String>) response.get("taskList"); | ||
} | ||
|
||
|
@@ -195,9 +198,9 @@ public void testCheckSpecificQueryStatus() throws Exception { | |
ModifiableSolrParams params = new ModifiableSolrParams(); | ||
params.set("taskUUID", "25"); | ||
|
||
GenericSolrRequest request = | ||
new GenericSolrRequest(SolrRequest.METHOD.GET, "/tasks/list", params) | ||
.setRequiresCollection(true); | ||
var request = | ||
new GenericCollectionRequest( | ||
SolrRequest.METHOD.GET, "/tasks/list", SolrRequest.SolrRequestType.ADMIN, params); | ||
NamedList<Object> queryResponse = cluster.getSolrClient(COLLECTION_NAME).request(request); | ||
|
||
String result = (String) queryResponse.get("taskStatus"); | ||
|
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.
I don't love that collection param; moved to the request path