dsmiley commented on code in PR #3238:
URL: https://github.com/apache/solr/pull/3238#discussion_r1985660911
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java:
##########
@@ -210,6 +236,16 @@ public boolean requiresCollection() {
return false;
}
+ /**
+ * Indicates if clients should make attempts to route this request to a
shard leader, overriding
+ * typical client routing preferences for requests. Defaults to true.
+ *
+ * @see CloudSolrClient#isUpdatesToLeaders
+ */
+ public boolean shouldSendToLeaders() {
Review Comment:
I question that we want this. Maybe this pre-dated
`org.apache.solr.common.params.ShardParams#SHARDS_PREFERENCE` where you can
accomplish the same thing. Ideally this method goes away (and goes away from
AbstractUpdateRequest).
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java:
##########
@@ -787,7 +786,7 @@ protected NamedList<Object> requestWithRetryOnStaleState(
if (request instanceof V2Request) {
isCollectionRequestOfV2 = ((V2Request) request).isPerCollectionRequest();
}
- boolean isAdmin = ADMIN_PATHS.contains(request.getPath());
+ boolean isAdmin = request.getRequestType() == SolrRequestType.ADMIN;
Review Comment:
awesome
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java:
##########
@@ -185,8 +188,31 @@ public void setQueryParams(Set<String> queryParams) {
this.queryParams = queryParams;
}
- /** This method defines the type of this Solr request. */
- public abstract String getRequestType();
+ /**
+ * Defines the intended type of this Solr request.
+ *
+ * <p>Subclasses should typically override this method instead of {@link
+ * SolrRequest#getRequestType}. Note that changing request type can
break/impact request routing
+ * within various clients (i.e. {@link CloudSolrClient}).
+ */
+ protected SolrRequestType getBaseRequestType() {
Review Comment:
`getBaseRequestType` seems sad to me; and I sympathize with Luke's musings.
I'd like to see this method go away. I like's Luke's suggestion on a field.
But going towards immutable is a bit much IMO.
##########
solr/solrj/src/java/org/apache/solr/client/solrj/request/SolrPing.java:
##########
@@ -53,8 +53,9 @@ public ModifiableSolrParams getParams() {
}
@Override
- public String getRequestType() {
- return SolrRequestType.ADMIN.toString();
+ /* This request is not processed as an ADMIN request. */
+ protected SolrRequestType getBaseRequestType() {
+ return SolrRequestType.UNSPECIFIED;
Review Comment:
Can we make changes like this in a follow-up PR so that this PR is more
focused on the refactoring instead of the choice of classifications?
--
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]