diff --git a/dev-docs/apis.adoc b/dev-docs/apis.adoc new file mode 100644 index 00000000000..49ff7df5a11 --- /dev/null +++ b/dev-docs/apis.adoc @@ -0,0 +1,83 @@ += APIs in Solr +:toc: left + +Solr's codebase currently has a handful of ways of defining APIs. +This complexity stems largely from two ongoing transitions: +1. Away from our "v1" APIs and towards the new "v2" API. +2. Away from a legacy API framework towards the off-the-shelf JAX-RS library for implementing our v2 APIs + +As we finish these transitions, this complexity should simplify considerably. +But in the interim, this document can help guide developers who need to understand or modify APIs in Solr. + +== API Types + +APIs in Solr (regardless of whether v1 or v2) can typically be classified as either "per-core" or "cluster" APIs. + +Per-core APIs, as the name suggests, typically affect only a single core or collection, usually used to search or analyze that core's contents in some way. +Implementation-wise, they're registered on the `SolrCore` object itself. +They are configured in solrconfig.xml, which also means they can differ from one core to another based on the configset being used. + +Alternatively "cluster" APIs potentially affect the entire Solr instance or cluster. +They're registered on the `CoreContainer` object itself. +It's much less common to provide configuration for these APIs, but it is possible to do so using `solr.xml`. + +== V1 APIs + +v1 APIs are the primary way that users consume Solr, as our v2 APIs remain "experimental". +Many new APIs are added as "v2 only", however updates to existing v1 APIs still happen frequently. + +v1 APIs exist in Solr as implementations of the `SolrRequestHandler` interface, usually making use of the `RequestHandlerBase` base class. +RequestHandlers have two methods of primary interest: +1. `init`, often used to parse per-API configuration or otherwise setup the class +2. `handleRequest` (or `handleRequestBody` if using `RequestHandlerBase`), the main entrypoint for the API, containing the business logic and constructing the response. + +While they do define many aspects of the endpoint's interface (e.g. query parameters, request body format, response format, etc.), RequestHandler's don't actually specify the URL path that they're located at. +These paths are instead either hardcoded at registration time (see `CoreContainer.load` and `ImplicitPlugins.json`), or specified by users in configuration files (typically `solrconfig.xml`). + +== V2 APIs + +v2 APIs are currently still "experimental", and not necessarily recommended yet for users. +But they're approaching parity with v1 and will eventually replace Solr's "RequestHandler"-based APIs. + +=== New "JAX-RS" APIs + +New v2 APIs in Solr are written in compliance with "JAX-RS", a library and specification that uses annotations to define APIs. +Many libraries implement the JAX-RS spec: Solr currently uses the implementation provided by the "Jersey" project. + +These v2 API definitions consist of two parts: a JAX-RS annotated interface in the `api` module "defining" the API, and a class in `core` "implementing" the interface. +Separating the API "definition" and "implementation" in this way allows us to only define each API in a single place, and use code generators to produce other API-related bits such as SolrJ code and ref-guide documentation. + +=== Writing JAX-RS APIs + +Writing a new v2 API may appear daunting, but additions in reality are actually pretty simple: + +1. *Create POJO ("Plain Old Java Object") classes as needed to represent the API's request and response*: +** POJOs are used to represent both the body of the API request (for some `POST` and `PUT` endpoints), as well as the response from the API. +** Re-use of existing classes here is preferred where possible. A library of available POJOs can be found in the `org.apache.solr.client.api.model` package of the `api` gradle project. +** POJO class fields are typically "public" and annotated with the Jackson `@JsonProperty` annotations to allow serialization/deserialization. +** POJO class fields should also have a Swagger `@Schema` annotation where possible, describing the purpose of the field. These descriptions are technically non-functional, but add lots of value to our OpenAPI spec and any artifacts generated downstream. +2. *Find or create an interface to hold the v2 API definition*: +** API interfaces live in the `org.apache.solr.client.api.endpoint` package of the `api` gradle project. Interfaces are usually given an "-Api" suffix to indicate their role. +** If a new API is similar enough to existing APIs, it may make sense to add the new API definition into an existing interface instead of creating a wholly new one. Use your best judgement. +3. *Add a method to the chosen interface representing the API*: +** The method should take an argument representing each path and query parameter (annotated with `@PathParam` or `@QueryParam` as appropriate). If the API is a `PUT` or `POST` that expects a request body, the method should take the request body POJO as its final argument, annotated with `@RequestBody`. +** Each method parameter should also be annotated with the Swagger `@Parameter` annotation. Like the `@Schema` annotation mentioned above, `@Parameter` isn't strictly required for correct operation, but they add lots of value to our OpenAPI spec and generated artifacts. +** As a return value, the method should return the response-body POJO. +4. *Futher JAX-RS Annotation*: The interface method in step (3) has specified its inputs and outputs, but several additional annotations are needed to define how users access the API, and to make it play nice with the code-generation done by Solr's build. +** Each interface must have a `@Path` annotation describing the path that the API is accessed from. Specific interface methods can also be given `@Path` annotations, making the "effective path" a concatenation of the interface and method-level values. `@Path` supports a limited regex syntax, and curly-brackets can be used to create named placeholders for path-parameters. +** Each interface method should be given an HTTP-method annotation (e.g. `@GET`, `@POST`, etc.) +** Each interface method must be marked with a Swagger `@Operation` annotation. This annotation is used to provide metadata about the API that appears in the OpenAPI specification and in any artifacts generated from that downstream. At a minimum, `summary` and `tags` values should be specified on the annotation. (`tags` is used by our SolrJ code generation to group similar APIs together. Typically APIs are only given a single tag representing the plural name of the most relevant "resource" (e.g. `tags = {"aliases"}`, `tags = {"replica-properties"}`) +5. *Create a class implementing the API interface*: Implementation classes live in the `core` gradle project, typically in the `org.apache.solr.handler` package or one of its descendants. +** Implementing classes must extent `JerseyResource`, and are typically named similarly to the API interface created in (2) above without the "-Api" suffix. e.g. `class AddReplicaProperty extends JerseyResource implements AddReplicaPropertyApi`) +** Solr's use of Jersey offers us some limited dependency-injection ("DI") capabilities. Class constructors annotated with `@Inject` can depend on a selection of types made available through DI, such as `CoreContainer`, `SolrQueryRequest`, `SolrCore`, etc. See the factory-bindings in `JerseyApplications` (or other API classes) for a sense of which types are available for constructor injection. +** Add a body to your classes method(s). For the most part this is "normal" Java development. +6. *Register your API*: APIs must be registered to be available at runtime. If the v2 API is associated with an existing v1 RequestHandler, the API class name can be added to the handler's `getJerseyResources` method. If there is no associated RequestHandler, the API should be registered similar to other APIs in `CoreContainer.load`. + +A good example for each of these steps can be seen in Solr's v2 "add-replica-property" API, which has a defining interface https://github.com/apache/solr/blob/9426902acb7081a2e9a1fa29699c5286459e1365/solr/api/src/java/org/apache/solr/client/api/endpoint/AddReplicaPropertyApi.java[AddReplicaPropertyApi], an implementing class https://github.com/apache/solr/blob/9426902acb7081a2e9a1fa29699c5286459e1365/solr/core/src/java/org/apache/solr/handler/admin/api/AddReplicaProperty.java[AddReplicaProperty], and the two POJOs https://github.com/apache/solr/blob/main/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java[AddReplicaPropertyRequestBody] and https://github.com/apache/solr/blob/main/solr/api/src/java/org/apache/solr/client/api/model/SolrJerseyResponse.java[SolrJerseyResponse]. + +=== Legacy v2 API Framework + +While we've settled on JAX-RS as our framework for defining v2 APIs going forward, Solr still retains many v2 APIs that were written using an older homegrown framework. +This framework defines APIs using annotations (e.g. `@EndPoint`) similar to those used by JAX-RS, but lacks the full range of features and 3rd-party tooling. +We're in the process of migrating these API definitions to JAX-RS and hope to remove all support for this legacy framework in a future release. + diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index e09b1849394..7f36982d3ab 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -19,6 +19,8 @@ Improvements * SOLR-16536: Replace OpenTracing instrumentation with OpenTelemetry (Alex Deparvu, janhoy) +* SOLR-15367: Convert "rid" functionality into a default Tracer (Alex Deparvu, David Smiley) + Optimizations --------------------- (No changes) @@ -68,7 +70,9 @@ Other Changes ================== 9.4.0 ================== New Features --------------------- -(No changes) +* SOLR-16654: Add support for node-level caches (Michael Gibney) + +* SOLR-16954: Make Circuit Breakers available for Update Requests (janhoy, Christine Poerschke, Pierre Salagnac) Improvements --------------------- @@ -101,8 +105,23 @@ Improvements * SOLR-16940: Users can pass Java system properties to the SolrCLI via the SOLR_TOOL_OPTS environment variable. (Houston Putman) +* SOLR-15474: Make Circuit breakers individually pluggable (Atri Sharma, Christine Poerschke, janhoy) + * SOLR-16927: Allow SolrClientCache clients to use Jetty HTTP2 clients (Alex Deparvu, David Smiley) +* SOLR-16896, SOLR-16897: Add support of OAuth 2.0/OIDC 'code with PKCE' flow (Lamine Idjeraoui, janhoy, Kevin Risden) + +* SOLR-16879: Limit the number of concurrent expensive core admin operations by running them in a + dedicated thread pool. Backup, Restore and Split are expensive operations. + (Pierre Salagnac, David Smiley) + +* SOLR-16964: The solr.jetty.ssl.sniHostCheck option now defaults to the value of SOLR_SSL_CHECK_PEER_NAME, if it is provided. + This will enable client and server hostName check settings to be governed by the same environment variable. + If users want separate client/server settings, they can manually override the solr.jetty.ssl.sniHostCheck option in SOLR_OPTS. (Houston Putman) + +* SOLR-16970: SOLR_OPTS is now able to override options set by the Solr control scripts, "bin/solr" and "bin/solr.cmd". (Houston Putman) + + Optimizations --------------------- @@ -128,8 +147,30 @@ Bug Fixes * PR#1826: Allow looking up Solr Package repo when that URL references a raw repository.json hosted on Github when the file is JSON but the mimetype used is text/plain. (Eric Pugh) +* SOLR-16944: V2 API /api/node/health should be governed by "health" permission, not "config-read" (janhoy) + * SOLR-16859: Missing Proxy support for Http2SolrClient (Alex Deparvu) +* SOLR-16929: SolrStream propagates undecoded error message (Alex Deparvu) + +* SOLR-16934: Allow Solr to read client (javax.net.ssl.*) trustStores and keyStores via SecurityManager. (Houston Putman) + +* SOLR-16946: Updated Cluster Singleton plugins are stopped correctly when the Overseer is closed. (Paul McArthur) + +* SOLR-16933: Include the full query response when using the API tool, and fix serialization issues for SolrDocumentList. (Houston Putman) + +* SOLR-16916: Use of the JSON Query DSL should ignore the defType parameter + (Christina Chortaria, Max Kadel, Ryan Laddusaw, Jane Sandberg, David Smiley) + +* SOLR-16958: Fix spurious warning about LATEST luceneMatchVersion (Colvin Cowie) + +* SOLR-16955: Tracing v2 apis breaks SecurityConfHandler (Alex Deparvu, David Smiley) + +* SOLR-16044: SlowRequest logging is no longer disabled if SolrCore logger set to ERROR (janhoy, hossman) + +* SOLR-16415: asyncId must not have '/'; enforce this. Enhance ZK cleanup to process directories + instead of fail. (David Smiley, Paul McArthur) + Dependency Upgrades --------------------- @@ -148,6 +189,8 @@ Other Changes * SOLR-16915: Lower the AffinityPlacementPlugin's default minimalFreeDiskGB to 5 GB (Houston Putman) +* SOLR-16623: new SolrJettyTestRule for tests needing HTTP or Jetty. (David Smiley, Joshua Ouma) + ================== 9.3.0 ================== Upgrade Notes @@ -271,7 +314,7 @@ Improvements * SOLR-16687: Add support of SolrClassLoader to SolrZkClient (Lamine Idjeraoui via Jason Gerlowski & Houston Putman) -* SOLR-9378: Internal shard requests no longer include the wasteful shard.url param. [shard] transformer now defaults to returning +* SOLR-9378: Internal shard requests no longer include the wasteful shard.url param. [shard] transformer now defaults to returning only the shard id (based on luceneMatchVersion), but can be configured to return the legacy list of replicas. (hossman) * SOLR-16816: Update node metrics while making affinityPlacement selections. Therefore selections can be made given the expected cluster diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/AddReplicaPropertyApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/AddReplicaPropertyApi.java index d29ee057502..8dce6a28e54 100644 --- a/solr/api/src/java/org/apache/solr/client/api/endpoint/AddReplicaPropertyApi.java +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/AddReplicaPropertyApi.java @@ -17,15 +17,12 @@ package org.apache.solr.client.api.endpoint; -import static org.apache.solr.client.api.util.Constants.BINARY_CONTENT_TYPE_V2; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.parameters.RequestBody; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; import org.apache.solr.client.api.model.AddReplicaPropertyRequestBody; import org.apache.solr.client.api.model.SolrJerseyResponse; @@ -33,10 +30,9 @@ public interface AddReplicaPropertyApi { @PUT - @Produces({"application/json", "application/xml", BINARY_CONTENT_TYPE_V2}) @Operation( summary = "Adds a property to the specified replica", - tags = {"replicas"}) + tags = {"replica-properties"}) public SolrJerseyResponse addReplicaProperty( @Parameter( description = "The name of the collection the replica belongs to.", diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/AliasPropertyApis.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/AliasPropertyApis.java new file mode 100644 index 00000000000..7bc167a2b36 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/AliasPropertyApis.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.GetAliasPropertyResponse; +import org.apache.solr.client.api.model.GetAllAliasPropertiesResponse; +import org.apache.solr.client.api.model.SolrJerseyResponse; +import org.apache.solr.client.api.model.UpdateAliasPropertiesRequestBody; +import org.apache.solr.client.api.model.UpdateAliasPropertyRequestBody; + +/** V2 API definitions for managing and inspecting properties for collection aliases */ +@Path("/aliases/{aliasName}/properties") +public interface AliasPropertyApis { + + @GET + @Operation( + summary = "Get properties for a collection alias.", + tags = {"alias-properties"}) + GetAllAliasPropertiesResponse getAllAliasProperties( + @Parameter(description = "Alias Name") @PathParam("aliasName") String aliasName) + throws Exception; + + @GET + @Path("/{propName}") + @Operation( + summary = "Get a specific property for a collection alias.", + tags = {"alias-properties"}) + GetAliasPropertyResponse getAliasProperty( + @Parameter(description = "Alias Name") @PathParam("aliasName") String aliasName, + @Parameter(description = "Property Name") @PathParam("propName") String propName) + throws Exception; + + @PUT + @Operation( + summary = "Update properties for a collection alias.", + tags = {"alias-properties"}) + SolrJerseyResponse updateAliasProperties( + @Parameter(description = "Alias Name") @PathParam("aliasName") String aliasName, + @RequestBody(description = "Properties that need to be updated", required = true) + UpdateAliasPropertiesRequestBody requestBody) + throws Exception; + + @PUT + @Path("/{propName}") + @Operation( + summary = "Update a specific property for a collection alias.", + tags = {"alias-properties"}) + SolrJerseyResponse createOrUpdateAliasProperty( + @Parameter(description = "Alias Name") @PathParam("aliasName") String aliasName, + @Parameter(description = "Property Name") @PathParam("propName") String propName, + @RequestBody(description = "Property value that needs to be updated", required = true) + UpdateAliasPropertyRequestBody requestBody) + throws Exception; + + @DELETE + @Path("/{propName}") + @Operation( + summary = "Delete a specific property for a collection alias.", + tags = {"alias-properties"}) + SolrJerseyResponse deleteAliasProperty( + @Parameter(description = "Alias Name") @PathParam("aliasName") String aliasName, + @Parameter(description = "Property Name") @PathParam("propName") String propName) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/BalanceReplicasApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/BalanceReplicasApi.java new file mode 100644 index 00000000000..d05719efea8 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/BalanceReplicasApi.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import org.apache.solr.client.api.model.BalanceReplicasRequestBody; +import org.apache.solr.client.api.model.SolrJerseyResponse; + +@Path("cluster/replicas/balance") +public interface BalanceReplicasApi { + @POST + @Operation( + summary = "Balance Replicas across the given set of Nodes.", + tags = {"cluster"}) + SolrJerseyResponse balanceReplicas( + @RequestBody(description = "Contains user provided parameters") + BalanceReplicasRequestBody requestBody) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteAliasApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteAliasApi.java index 24759ead2ad..05d32068683 100644 --- a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteAliasApi.java +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteAliasApi.java @@ -17,14 +17,11 @@ package org.apache.solr.client.api.endpoint; -import static org.apache.solr.client.api.util.Constants.BINARY_CONTENT_TYPE_V2; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import javax.ws.rs.DELETE; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import org.apache.solr.client.api.model.SolrJerseyResponse; @@ -32,7 +29,6 @@ public interface DeleteAliasApi { @DELETE - @Produces({"application/json", "application/xml", BINARY_CONTENT_TYPE_V2}) @Operation( summary = "Deletes an alias by its name", tags = {"aliases"}) diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionApi.java index 9e28e7b1722..8cf0010066e 100644 --- a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionApi.java +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionApi.java @@ -17,14 +17,11 @@ package org.apache.solr.client.api.endpoint; -import static org.apache.solr.client.api.util.Constants.BINARY_CONTENT_TYPE_V2; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import javax.ws.rs.DELETE; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import org.apache.solr.client.api.model.SubResponseAccumulatingJerseyResponse; @@ -32,7 +29,6 @@ public interface DeleteCollectionApi { @DELETE - @Produces({"application/json", "application/xml", BINARY_CONTENT_TYPE_V2}) @Operation( summary = "Deletes a collection from SolrCloud", tags = {"collections"}) diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionBackupApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionBackupApi.java new file mode 100644 index 00000000000..e53f8ea96d7 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionBackupApi.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.endpoint; + +import static org.apache.solr.client.api.model.Constants.ASYNC; +import static org.apache.solr.client.api.model.Constants.BACKUP_LOCATION; +import static org.apache.solr.client.api.model.Constants.BACKUP_REPOSITORY; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import javax.ws.rs.DELETE; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import org.apache.solr.client.api.model.BackupDeletionResponseBody; +import org.apache.solr.client.api.model.PurgeUnusedFilesRequestBody; +import org.apache.solr.client.api.model.PurgeUnusedResponse; + +@Path("/backups/{backupName}") +public interface DeleteCollectionBackupApi { + + @Path("/versions/{backupId}") + @DELETE + @Operation( + summary = "Delete incremental backup point by ID", + tags = {"collection-backups"}) + BackupDeletionResponseBody deleteSingleBackupById( + @PathParam("backupName") String backupName, + @PathParam("backupId") String backupId, + // Optional parameters below + @QueryParam(BACKUP_LOCATION) String location, + @QueryParam(BACKUP_REPOSITORY) String repositoryName, + @QueryParam(ASYNC) String asyncId) + throws Exception; + + @Path("/versions") + @DELETE + @Operation( + summary = "Delete all incremental backup points older than the most recent N", + tags = {"collection-backups"}) + BackupDeletionResponseBody deleteMultipleBackupsByRecency( + @PathParam("backupName") String backupName, + @QueryParam("retainLatest") Integer versionsToRetain, + // Optional parameters below + @QueryParam(BACKUP_LOCATION) String location, + @QueryParam(BACKUP_REPOSITORY) String repositoryName, + @QueryParam(ASYNC) String asyncId) + throws Exception; + + @Path("/purgeUnused") + @PUT + @Operation( + summary = "Garbage collect orphaned incremental backup files", + tags = {"collection-backups"}) + PurgeUnusedResponse garbageCollectUnusedBackupFiles( + @PathParam("backupName") String backupName, + @RequestBody( + description = "Request body parameters for the orphaned file cleanup", + required = false) + PurgeUnusedFilesRequestBody requestBody) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionSnapshotApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionSnapshotApi.java new file mode 100644 index 00000000000..fb77fbd6dc8 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteCollectionSnapshotApi.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Parameter; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import org.apache.solr.client.api.model.DeleteCollectionSnapshotResponse; + +public interface DeleteCollectionSnapshotApi { + + /** This API is analogous to V1's (POST /solr/admin/collections?action=DELETESNAPSHOT) */ + @DELETE + @Path("/collections/{collName}/snapshots/{snapshotName}") + DeleteCollectionSnapshotResponse deleteSnapshot( + @Parameter(description = "The name of the collection.", required = true) + @PathParam("collName") + String collName, + @Parameter(description = "The name of the snapshot to be deleted.", required = true) + @PathParam("snapshotName") + String snapshotName, + @Parameter(description = "A flag that treats the collName parameter as a collection alias.") + @DefaultValue("false") + @QueryParam("followAliases") + boolean followAliases, + @QueryParam("async") String asyncId) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteNodeApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteNodeApi.java new file mode 100644 index 00000000000..0495d298cb9 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteNodeApi.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.DeleteNodeRequestBody; +import org.apache.solr.client.api.model.SolrJerseyResponse; + +@Path("cluster/nodes/{nodeName}/clear/") +public interface DeleteNodeApi { + + @POST + @Operation( + summary = "Delete all replicas off of the specified SolrCloud node", + tags = {"node"}) + SolrJerseyResponse deleteNode( + @Parameter( + description = + "The name of the node to be cleared. Usually of the form 'host:1234_solr'.", + required = true) + @PathParam("nodeName") + String nodeName, + @RequestBody(description = "Contains user provided parameters", required = true) + DeleteNodeRequestBody requestBody) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteReplicaApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteReplicaApi.java new file mode 100644 index 00000000000..f17abdfab26 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteReplicaApi.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.endpoint; + +import static org.apache.solr.client.api.model.Constants.ASYNC; +import static org.apache.solr.client.api.model.Constants.COUNT_PROP; +import static org.apache.solr.client.api.model.Constants.DELETE_DATA_DIR; +import static org.apache.solr.client.api.model.Constants.DELETE_INDEX; +import static org.apache.solr.client.api.model.Constants.DELETE_INSTANCE_DIR; +import static org.apache.solr.client.api.model.Constants.FOLLOW_ALIASES; +import static org.apache.solr.client.api.model.Constants.ONLY_IF_DOWN; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.DELETE; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import org.apache.solr.client.api.model.ScaleCollectionRequestBody; +import org.apache.solr.client.api.model.SubResponseAccumulatingJerseyResponse; + +/** + * V2 API definition for deleting one or more existing replicas from one or more shards. + * + *

These APIs are analogous to the v1 /admin/collections?action=DELETEREPLICA command. + */ +@Path("/collections/{collectionName}") +public interface DeleteReplicaApi { + + @DELETE + @Path("/shards/{shardName}/replicas/{replicaName}") + @Operation( + summary = "Delete an single replica by name", + tags = {"replicas"}) + SubResponseAccumulatingJerseyResponse deleteReplicaByName( + @PathParam("collectionName") String collectionName, + @PathParam("shardName") String shardName, + @PathParam("replicaName") String replicaName, + // Optional params below + @QueryParam(FOLLOW_ALIASES) Boolean followAliases, + @QueryParam(DELETE_INSTANCE_DIR) Boolean deleteInstanceDir, + @QueryParam(DELETE_DATA_DIR) Boolean deleteDataDir, + @QueryParam(DELETE_INDEX) Boolean deleteIndex, + @QueryParam(ONLY_IF_DOWN) Boolean onlyIfDown, + @QueryParam(ASYNC) String async) + throws Exception; + + @DELETE + @Path("/shards/{shardName}/replicas") + @Operation( + summary = "Delete one or more replicas from the specified collection and shard", + tags = {"replicas"}) + SubResponseAccumulatingJerseyResponse deleteReplicasByCount( + @PathParam("collectionName") String collectionName, + @PathParam("shardName") String shardName, + @QueryParam(COUNT_PROP) Integer numToDelete, + // Optional params below + @QueryParam(FOLLOW_ALIASES) Boolean followAliases, + @QueryParam(DELETE_INSTANCE_DIR) Boolean deleteInstanceDir, + @QueryParam(DELETE_DATA_DIR) Boolean deleteDataDir, + @QueryParam(DELETE_INDEX) Boolean deleteIndex, + @QueryParam(ONLY_IF_DOWN) Boolean onlyIfDown, + @QueryParam(ASYNC) String async) + throws Exception; + + @PUT + @Path("/scale") + @Operation( + summary = "Scale the replica count for all shards in the specified collection", + tags = {"replicas"}) + SubResponseAccumulatingJerseyResponse deleteReplicasByCountAllShards( + @PathParam("collectionName") String collectionName, ScaleCollectionRequestBody requestBody) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteReplicaPropertyApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteReplicaPropertyApi.java new file mode 100644 index 00000000000..8e8f52fd33a --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/DeleteReplicaPropertyApi.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import javax.ws.rs.DELETE; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.SolrJerseyResponse; + +/** + * V2 API definition for removing a property from a collection replica + * + *

This API is analogous to the v1 /admin/collections?action=DELETEREPLICAPROP command. + */ +@Path("/collections/{collName}/shards/{shardName}/replicas/{replicaName}/properties/{propName}") +public interface DeleteReplicaPropertyApi { + + @DELETE + @Operation( + summary = "Delete an existing replica property", + tags = {"replica-properties"}) + SolrJerseyResponse deleteReplicaProperty( + @Parameter( + description = "The name of the collection the replica belongs to.", + required = true) + @PathParam("collName") + String collName, + @Parameter(description = "The name of the shard the replica belongs to.", required = true) + @PathParam("shardName") + String shardName, + @Parameter(description = "The replica, e.g., `core_node1`.", required = true) + @PathParam("replicaName") + String replicaName, + @Parameter(description = "The name of the property to delete.", required = true) + @PathParam("propName") + String propertyName) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/ForceLeaderApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/ForceLeaderApi.java new file mode 100644 index 00000000000..2a0336a2d3d --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/ForceLeaderApi.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.SolrJerseyResponse; + +/** V2 API definition for triggering a leader election on a particular collection and shard. */ +@Path("/collections/{collectionName}/shards/{shardName}/force-leader") +public interface ForceLeaderApi { + @POST + @Operation( + summary = "Force leader election to occur on the specified collection and shard", + tags = {"shards"}) + SolrJerseyResponse forceShardLeader( + @PathParam("collectionName") String collectionName, @PathParam("shardName") String shardName); +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/GetPublicKeyApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/GetPublicKeyApi.java new file mode 100644 index 00000000000..562a2945d9e --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/GetPublicKeyApi.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import org.apache.solr.client.api.model.PublicKeyResponse; + +/** V2 API definition to fetch the public key of the receiving node. */ +@Path("/node/key") +public interface GetPublicKeyApi { + + @GET + @Operation( + summary = "Retrieve the public key of the receiving Solr node.", + tags = {"node"}) + PublicKeyResponse getPublicKey(); +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/ListAliasesApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListAliasesApi.java new file mode 100644 index 00000000000..3f786b9d5e7 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListAliasesApi.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.GetAliasByNameResponse; +import org.apache.solr.client.api.model.ListAliasesResponse; + +/** V2 API definition for listing and inspecting collection aliases */ +@Path("/aliases") +public interface ListAliasesApi { + + @GET + @Operation( + summary = "List the existing collection aliases.", + tags = {"aliases"}) + ListAliasesResponse getAliases() throws Exception; + + @GET + @Path("/{aliasName}") + @Operation( + summary = "Get details for a specific collection alias.", + tags = {"aliases"}) + GetAliasByNameResponse getAliasByName( + @Parameter(description = "Alias name.", required = true) @PathParam("aliasName") + String aliasName) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/ListCollectionBackupsApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListCollectionBackupsApi.java new file mode 100644 index 00000000000..59657085b95 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListCollectionBackupsApi.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import static org.apache.solr.client.api.model.Constants.BACKUP_LOCATION; +import static org.apache.solr.client.api.model.Constants.BACKUP_REPOSITORY; + +import io.swagger.v3.oas.annotations.Operation; +import java.io.IOException; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.QueryParam; +import org.apache.solr.client.api.model.ListCollectionBackupsResponse; + +/** V2 API definitions for collection-backup "listing". */ +@Path("/backups/{backupName}/versions") +public interface ListCollectionBackupsApi { + + @GET + @Operation( + summary = "List existing incremental backups at the specified location.", + tags = {"collection-backups"}) + ListCollectionBackupsResponse listBackupsAtLocation( + @PathParam("backupName") String backupName, + @QueryParam(BACKUP_LOCATION) String location, + @QueryParam(BACKUP_REPOSITORY) String repositoryName) + throws IOException; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/ListCollectionsApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListCollectionsApi.java new file mode 100644 index 00000000000..bb8baa210f3 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListCollectionsApi.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import org.apache.solr.client.api.model.ListCollectionsResponse; + +@Path("/collections") +public interface ListCollectionsApi { + @GET + @Operation( + summary = "List all collections in this Solr cluster", + tags = {"collections"}) + ListCollectionsResponse listCollections(); +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/ListConfigsetsApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListConfigsetsApi.java new file mode 100644 index 00000000000..b00a47cac19 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/ListConfigsetsApi.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import org.apache.solr.client.api.model.ListConfigsetsResponse; + +/** V2 API definition for listing configsets. */ +@Path("/cluster/configs") +public interface ListConfigsetsApi { + @GET + @Operation( + summary = "List the configsets available to Solr.", + tags = {"configsets"}) + ListConfigsetsResponse listConfigSet() throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/ReloadCollectionApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/ReloadCollectionApi.java new file mode 100644 index 00000000000..2bf85b90626 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/ReloadCollectionApi.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.ReloadCollectionRequestBody; +import org.apache.solr.client.api.model.SubResponseAccumulatingJerseyResponse; + +/** V2 API definition for reloading collections. */ +@Path("/collections/{collectionName}/reload") +public interface ReloadCollectionApi { + @POST + @Operation( + summary = "Reload all cores in the specified collection.", + tags = {"collections"}) + SubResponseAccumulatingJerseyResponse reloadCollection( + @PathParam("collectionName") String collectionName, ReloadCollectionRequestBody requestBody) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/RenameCollectionApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/RenameCollectionApi.java new file mode 100644 index 00000000000..6eee0d431f2 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/RenameCollectionApi.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.RenameCollectionRequestBody; +import org.apache.solr.client.api.model.SubResponseAccumulatingJerseyResponse; + +/** V2 API definition for "renaming" an existing collection */ +@Path("/collections/{collectionName}/rename") +public interface RenameCollectionApi { + + @POST + @Operation( + summary = "Rename a SolrCloud collection", + tags = {"collections"}) + SubResponseAccumulatingJerseyResponse renameCollection( + @PathParam("collectionName") String collectionName, RenameCollectionRequestBody requestBody) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/ReplaceNodeApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/ReplaceNodeApi.java new file mode 100644 index 00000000000..56762fa524d --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/ReplaceNodeApi.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.ReplaceNodeRequestBody; +import org.apache.solr.client.api.model.SolrJerseyResponse; + +/** + * V2 API definition for recreating replicas in one node (the source) on another node(s) (the + * target). + */ +@Path("cluster/nodes/{sourceNodeName}/replace/") +public interface ReplaceNodeApi { + @POST + @Operation( + summary = "'Replace' a specified node by moving all replicas elsewhere", + tags = {"node"}) + SolrJerseyResponse replaceNode( + @Parameter(description = "The name of the node to be replaced.", required = true) + @PathParam("sourceNodeName") + String sourceNodeName, + @RequestBody(description = "Contains user provided parameters", required = true) + ReplaceNodeRequestBody requestBody) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/SyncShardApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/SyncShardApi.java new file mode 100644 index 00000000000..1e9805be65a --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/SyncShardApi.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import org.apache.solr.client.api.model.SolrJerseyResponse; + +/** + * V2 API definition for triggering a shard-sync operation within a particular collection and shard. + */ +@Path("/collections/{collectionName}/shards/{shardName}/sync") +public interface SyncShardApi { + @POST + @Operation( + summary = "Trigger a 'sync' operation for the specified shard", + tags = {"shards"}) + SolrJerseyResponse syncShard( + @PathParam("collectionName") String collectionName, @PathParam("shardName") String shardName) + throws Exception; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java index f78c7bebd9c..603524e4ad1 100644 --- a/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java +++ b/solr/api/src/java/org/apache/solr/client/api/model/AddReplicaPropertyRequestBody.java @@ -19,9 +19,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; -import org.apache.solr.client.api.util.ReflectWritable; -public class AddReplicaPropertyRequestBody implements ReflectWritable { +public class AddReplicaPropertyRequestBody { public AddReplicaPropertyRequestBody() {} public AddReplicaPropertyRequestBody(String value) { diff --git a/solr/api/src/java/org/apache/solr/client/api/model/BackupDeletionData.java b/solr/api/src/java/org/apache/solr/client/api/model/BackupDeletionData.java new file mode 100644 index 00000000000..b27ce790c89 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/BackupDeletionData.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class BackupDeletionData { + @JsonProperty public String startTime; + @JsonProperty public Integer backupId; + @JsonProperty public Long size; + @JsonProperty public Integer numFiles; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/BackupDeletionResponseBody.java b/solr/api/src/java/org/apache/solr/client/api/model/BackupDeletionResponseBody.java new file mode 100644 index 00000000000..29563599ab2 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/BackupDeletionResponseBody.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +public class BackupDeletionResponseBody extends SubResponseAccumulatingJerseyResponse { + @JsonProperty public String collection; + @JsonProperty public List deleted; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/BalanceReplicasRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/BalanceReplicasRequestBody.java new file mode 100644 index 00000000000..f270a48b269 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/BalanceReplicasRequestBody.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Set; + +public class BalanceReplicasRequestBody { + + public BalanceReplicasRequestBody() {} + + public BalanceReplicasRequestBody(Set nodes, Boolean waitForFinalState, String async) { + this.nodes = nodes; + this.waitForFinalState = waitForFinalState; + this.async = async; + } + + @Schema( + description = + "The set of nodes across which replicas will be balanced. Defaults to all live data nodes.") + @JsonProperty(value = "nodes") + public Set nodes; + + @Schema( + description = + "If true, the request will complete only when all affected replicas become active. " + + "If false, the API will return the status of the single action, which may be " + + "before the new replica is online and active.") + @JsonProperty("waitForFinalState") + public Boolean waitForFinalState = false; + + @Schema(description = "Request ID to track this action which will be processed asynchronously.") + @JsonProperty("async") + public String async; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/CollectionBackupDetails.java b/solr/api/src/java/org/apache/solr/client/api/model/CollectionBackupDetails.java new file mode 100644 index 00000000000..a46529baab4 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/CollectionBackupDetails.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import static org.apache.solr.client.api.model.Constants.COLL_CONF; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +public class CollectionBackupDetails { + @JsonProperty public Integer backupId; + @JsonProperty public String indexVersion; + @JsonProperty public String startTime; + @JsonProperty public String endTime; + @JsonProperty public Integer indexFileCount; + @JsonProperty public Double indexSizeMB; + + @JsonProperty public Map shardBackupIds; + + @JsonProperty(COLL_CONF) + public String configsetName; + + @JsonProperty public String collectionAlias; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/Constants.java b/solr/api/src/java/org/apache/solr/client/api/model/Constants.java new file mode 100644 index 00000000000..0992c2c3a17 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/Constants.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.model; + +public class Constants { + + private Constants() { + /* Private ctor prevents instantiation */ + } + + /** A parameter to specify the name of the backup repository to be used. */ + public static final String BACKUP_REPOSITORY = "repository"; + + /** A parameter to specify the location where the backup should be stored. */ + public static final String BACKUP_LOCATION = "location"; + + /** Async or not? * */ + public static final String ASYNC = "async"; + + /** The name of a collection referenced by an API call */ + public static final String COLLECTION = "collection"; + + public static final String COUNT_PROP = "count"; + + /** Option to follow aliases when deciding the target of a collection admin command. */ + public static final String FOLLOW_ALIASES = "followAliases"; + + /** If you unload a core, delete the index too */ + public static final String DELETE_INDEX = "deleteIndex"; + + public static final String DELETE_DATA_DIR = "deleteDataDir"; + + public static final String DELETE_INSTANCE_DIR = "deleteInstanceDir"; + + public static final String ONLY_IF_DOWN = "onlyIfDown"; + + /** The name of the config set to be used for a collection */ + public static final String COLL_CONF = "collection.configName"; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/DeleteCollectionSnapshotResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/DeleteCollectionSnapshotResponse.java new file mode 100644 index 00000000000..2b134a2877c --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/DeleteCollectionSnapshotResponse.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.model; + +import static org.apache.solr.client.api.model.Constants.COLLECTION; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import org.apache.solr.client.api.endpoint.DeleteCollectionSnapshotApi; + +/** + * The Response for {@link DeleteCollectionSnapshotApi#deleteSnapshot(String, String, boolean, + * String)} + */ +public class DeleteCollectionSnapshotResponse extends AsyncJerseyResponse { + @Schema(description = "The name of the collection.") + @JsonProperty(COLLECTION) + public String collection; + + @Schema(description = "The name of the snapshot to be deleted.") + @JsonProperty("snapshot") + public String snapshotName; + + @Schema(description = "A flag that treats the collName parameter as a collection alias.") + @JsonProperty("followAliases") + public boolean followAliases; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/DeleteNodeRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/DeleteNodeRequestBody.java new file mode 100644 index 00000000000..4b05f2f04e9 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/DeleteNodeRequestBody.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +public class DeleteNodeRequestBody { + @Schema(description = "Request ID to track this action which will be processed asynchronously.") + @JsonProperty("async") + public String async; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/GetAliasByNameResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/GetAliasByNameResponse.java new file mode 100644 index 00000000000..df0498d9f12 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/GetAliasByNameResponse.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +public class GetAliasByNameResponse extends SolrJerseyResponse { + @JsonProperty("name") + public String alias; + + @JsonProperty("collections") + public List collections; + + @JsonProperty("properties") + public Map properties; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/GetAliasPropertyResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/GetAliasPropertyResponse.java new file mode 100644 index 00000000000..93e62ba04c6 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/GetAliasPropertyResponse.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +public class GetAliasPropertyResponse extends SolrJerseyResponse { + @JsonProperty("value") + @Schema(description = "Property value.") + public String value; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/GetAllAliasPropertiesResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/GetAllAliasPropertiesResponse.java new file mode 100644 index 00000000000..17b93d45471 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/GetAllAliasPropertiesResponse.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Map; + +public class GetAllAliasPropertiesResponse extends SolrJerseyResponse { + @JsonProperty("properties") + @Schema(description = "Properties and values associated with alias.") + public Map properties; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/ListAliasesResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/ListAliasesResponse.java new file mode 100644 index 00000000000..3d9c93af85e --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/ListAliasesResponse.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +public class ListAliasesResponse extends SolrJerseyResponse { + @JsonProperty("aliases") + public Map aliases; + + @JsonProperty("properties") + public Map> properties; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/ListCollectionBackupsResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/ListCollectionBackupsResponse.java new file mode 100644 index 00000000000..038a3df2ff4 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/ListCollectionBackupsResponse.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +public class ListCollectionBackupsResponse extends SolrJerseyResponse { + @JsonProperty public String collection; + @JsonProperty public List backups; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/ListCollectionsResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/ListCollectionsResponse.java new file mode 100644 index 00000000000..17bf44c44ec --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/ListCollectionsResponse.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +public class ListCollectionsResponse extends SolrJerseyResponse { + @JsonProperty("collections") + public List collections; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/ListConfigsetsResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/ListConfigsetsResponse.java new file mode 100644 index 00000000000..09b99dfbdc9 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/ListConfigsetsResponse.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +public class ListConfigsetsResponse extends SolrJerseyResponse { + + @JsonProperty("configSets") + public List configSets; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/PublicKeyResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/PublicKeyResponse.java new file mode 100644 index 00000000000..d561b16fcbb --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/PublicKeyResponse.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +public class PublicKeyResponse extends SolrJerseyResponse { + @JsonProperty("key") + @Schema(description = "The public key of the receiving Solr node.") + public String key; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/PurgeUnusedFilesRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/PurgeUnusedFilesRequestBody.java new file mode 100644 index 00000000000..1e3c6a26324 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/PurgeUnusedFilesRequestBody.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.model; + +import static org.apache.solr.client.api.model.Constants.ASYNC; +import static org.apache.solr.client.api.model.Constants.BACKUP_LOCATION; +import static org.apache.solr.client.api.model.Constants.BACKUP_REPOSITORY; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import org.apache.solr.client.api.endpoint.DeleteCollectionBackupApi; + +/** + * Request body for the {@link DeleteCollectionBackupApi#garbageCollectUnusedBackupFiles(String, + * PurgeUnusedFilesRequestBody)} API. + */ +public class PurgeUnusedFilesRequestBody { + @JsonProperty(BACKUP_LOCATION) + public String location; + + @Schema(name = "repositoryName") + @JsonProperty(BACKUP_REPOSITORY) + public String repositoryName; + + @JsonProperty(ASYNC) + public String async; +} diff --git a/solr/solrj/src/java/org/apache/solr/common/DelegateMapWriter.java b/solr/api/src/java/org/apache/solr/client/api/model/PurgeUnusedResponse.java similarity index 51% rename from solr/solrj/src/java/org/apache/solr/common/DelegateMapWriter.java rename to solr/api/src/java/org/apache/solr/client/api/model/PurgeUnusedResponse.java index 9fe01b09b14..5415060149c 100644 --- a/solr/solrj/src/java/org/apache/solr/common/DelegateMapWriter.java +++ b/solr/api/src/java/org/apache/solr/client/api/model/PurgeUnusedResponse.java @@ -15,32 +15,16 @@ * limitations under the License. */ -package org.apache.solr.common; +package org.apache.solr.client.api.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonProperty; -import java.io.IOException; -import org.apache.solr.common.util.Utils; -public class DelegateMapWriter implements MapWriter { +public class PurgeUnusedResponse extends SubResponseAccumulatingJerseyResponse { + @JsonProperty public PurgeUnusedStats deleted; - private final Object delegate; - - public DelegateMapWriter(Object delegate) { - this.delegate = delegate; - } - - @Override - public void writeMap(EntryWriter ew) throws IOException { - Utils.reflectWrite( - ew, - delegate, - // TODO Should we be lenient here and accept both the Jackson and our homegrown annotation? - field -> field.getAnnotation(JsonProperty.class) != null, - JsonAnyGetter.class, - field -> { - final JsonProperty prop = field.getAnnotation(JsonProperty.class); - return prop.value().isEmpty() ? field.getName() : prop.value(); - }); + public static class PurgeUnusedStats { + @JsonProperty public Integer numBackupIds; + @JsonProperty public Integer numShardBackupIds; + @JsonProperty public Integer numIndexFiles; } } diff --git a/solr/api/src/java/org/apache/solr/client/api/model/ReloadCollectionRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/ReloadCollectionRequestBody.java new file mode 100644 index 00000000000..287e5453381 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/ReloadCollectionRequestBody.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import static org.apache.solr.client.api.model.Constants.ASYNC; + +import com.fasterxml.jackson.annotation.JsonProperty; + +// TODO Is it worth having this in a request body, or should we just make it a query param? +public class ReloadCollectionRequestBody { + @JsonProperty(ASYNC) + public String async; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/RenameCollectionRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/RenameCollectionRequestBody.java new file mode 100644 index 00000000000..145618d029e --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/RenameCollectionRequestBody.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import static org.apache.solr.client.api.model.Constants.ASYNC; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RenameCollectionRequestBody { + @JsonProperty(required = true) + public String to; + + @JsonProperty(ASYNC) + public String async; + + @JsonProperty public Boolean followAliases; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/ReplaceNodeRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/ReplaceNodeRequestBody.java new file mode 100644 index 00000000000..303fd64e8db --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/ReplaceNodeRequestBody.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +public class ReplaceNodeRequestBody { + + public ReplaceNodeRequestBody() {} + + public ReplaceNodeRequestBody(String targetNodeName, Boolean waitForFinalState, String async) { + this.targetNodeName = targetNodeName; + this.waitForFinalState = waitForFinalState; + this.async = async; + } + + @Schema( + description = + "The target node where replicas will be copied. If this parameter is not provided, Solr " + + "will identify nodes automatically based on policies or number of cores in each node.") + @JsonProperty("targetNodeName") + public String targetNodeName; + + @Schema( + description = + "If true, the request will complete only when all affected replicas become active. " + + "If false, the API will return the status of the single action, which may be " + + "before the new replica is online and active.") + @JsonProperty("waitForFinalState") + public Boolean waitForFinalState = false; + + @Schema(description = "Request ID to track this action which will be processed asynchronously.") + @JsonProperty("async") + public String async; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/ScaleCollectionRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/ScaleCollectionRequestBody.java new file mode 100644 index 00000000000..c1c84ca22e1 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/ScaleCollectionRequestBody.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.solr.client.api.model; + +import static org.apache.solr.client.api.model.Constants.ASYNC; +import static org.apache.solr.client.api.model.Constants.COUNT_PROP; +import static org.apache.solr.client.api.model.Constants.DELETE_DATA_DIR; +import static org.apache.solr.client.api.model.Constants.DELETE_INDEX; +import static org.apache.solr.client.api.model.Constants.DELETE_INSTANCE_DIR; +import static org.apache.solr.client.api.model.Constants.FOLLOW_ALIASES; +import static org.apache.solr.client.api.model.Constants.ONLY_IF_DOWN; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +/** Request body used by {@link org.apache.solr.client.api.endpoint.DeleteReplicaApi} */ +public class ScaleCollectionRequestBody { + public @JsonProperty(value = COUNT_PROP, required = true) @Schema(name = "numToDelete") Integer + numToDelete; + public @JsonProperty(FOLLOW_ALIASES) Boolean followAliases; + public @JsonProperty(DELETE_INSTANCE_DIR) Boolean deleteInstanceDir; + public @JsonProperty(DELETE_DATA_DIR) Boolean deleteDataDir; + public @JsonProperty(DELETE_INDEX) Boolean deleteIndex; + public @JsonProperty(ONLY_IF_DOWN) Boolean onlyIfDown; + public @JsonProperty(ASYNC) String async; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/UpdateAliasPropertiesRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/UpdateAliasPropertiesRequestBody.java new file mode 100644 index 00000000000..de6a48a0a50 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/UpdateAliasPropertiesRequestBody.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.Map; + +public class UpdateAliasPropertiesRequestBody { + + @Schema(description = "Properties and values to be updated on alias.") + @JsonProperty(value = "properties", required = true) + public Map properties; + + @Schema(description = "Request ID to track this action which will be processed asynchronously.") + @JsonProperty("async") + public String async; +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/UpdateAliasPropertyRequestBody.java b/solr/api/src/java/org/apache/solr/client/api/model/UpdateAliasPropertyRequestBody.java new file mode 100644 index 00000000000..a7a82536b71 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/UpdateAliasPropertyRequestBody.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class UpdateAliasPropertyRequestBody { + @JsonProperty(required = true) + public Object value; +} diff --git a/solr/bin/solr b/solr/bin/solr index a5073f32f60..0836a6d5639 100644 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -259,7 +259,7 @@ if [ "$SOLR_SSL_ENABLED" == "true" ]; then fi if [ -n "$SOLR_SSL_CHECK_PEER_NAME" ]; then - SOLR_SSL_OPTS+=" -Dsolr.ssl.checkPeerName=$SOLR_SSL_CHECK_PEER_NAME" + SOLR_SSL_OPTS+=" -Dsolr.ssl.checkPeerName=$SOLR_SSL_CHECK_PEER_NAME -Dsolr.jetty.ssl.sniHostCheck=$SOLR_SSL_CHECK_PEER_NAME" fi if [ -n "$SOLR_SSL_CLIENT_TRUST_STORE" ]; then @@ -628,7 +628,7 @@ function jetty_port() { function run_tool() { # shellcheck disable=SC2086 - "$JAVA" ${SOLR_TOOL_OPTS:-} $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_ZK_CREDS_AND_ACLS:-} -Dsolr.install.dir="$SOLR_TIP" \ + "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_ZK_CREDS_AND_ACLS:-} ${SOLR_TOOL_OPTS:-} -Dsolr.install.dir="$SOLR_TIP" \ -Dlog4j.configurationFile="$DEFAULT_SERVER_DIR/resources/log4j2-console.xml" \ -classpath "$DEFAULT_SERVER_DIR/solr-webapp/webapp/WEB-INF/lib/*:$DEFAULT_SERVER_DIR/lib/ext/*:$DEFAULT_SERVER_DIR/lib/*" \ org.apache.solr.cli.SolrCLI "$@" @@ -742,7 +742,7 @@ function stop_solr() { if [ -n "$SOLR_PID" ]; then echo -e "Sending stop command to Solr running on port $SOLR_PORT ... waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop gracefully." # shellcheck disable=SC2086 - "$JAVA" ${SOLR_TOOL_OPTS:-} $SOLR_SSL_OPTS $AUTHC_OPTS -jar "$DIR/start.jar" "STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true + "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_TOOL_OPTS:-} -jar "$DIR/start.jar" "STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true (loops=0 while true do @@ -1222,6 +1222,7 @@ fi FG="false" FORCE=false SOLR_OPTS=(${SOLR_OPTS:-}) +SCRIPT_SOLR_OPTS=() PASS_TO_RUN_EXAMPLE=() if [ $# -gt 0 ]; then @@ -1302,6 +1303,7 @@ if [ $# -gt 0 ]; then exit 1 fi SOLR_PORT="$2" + PROVIDED_SOLR_PORT="${SOLR_PORT}" PASS_TO_RUN_EXAMPLE+=("-p" "$SOLR_PORT") shift 2 ;; @@ -1370,6 +1372,7 @@ if [ $# -gt 0 ]; then break # out-of-args, stop looping elif [ "${1:0:2}" == "-D" ]; then # pass thru any opts that begin with -D (java system props) + # These should go to the end of SOLR_OPTS, as they should override everything else SOLR_OPTS+=("$1") PASS_TO_RUN_EXAMPLE+=("$1") shift @@ -1388,20 +1391,20 @@ fi # Solr modules option if [[ -n "${SOLR_MODULES:-}" ]] ; then - SOLR_OPTS+=("-Dsolr.modules=$SOLR_MODULES") + SCRIPT_SOLR_OPTS+=("-Dsolr.modules=$SOLR_MODULES") fi # Default placement plugin if [[ -n "${SOLR_PLACEMENTPLUGIN_DEFAULT:-}" ]] ; then - SOLR_OPTS+=("-Dsolr.placementplugin.default=$SOLR_PLACEMENTPLUGIN_DEFAULT") + SCRIPT_SOLR_OPTS+=("-Dsolr.placementplugin.default=$SOLR_PLACEMENTPLUGIN_DEFAULT") fi # Remote streaming and stream body if [ "${SOLR_ENABLE_REMOTE_STREAMING:-false}" == "true" ]; then - SOLR_OPTS+=("-Dsolr.enableRemoteStreaming=true") + SCRIPT_SOLR_OPTS+=("-Dsolr.enableRemoteStreaming=true") fi if [ "${SOLR_ENABLE_STREAM_BODY:-false}" == "true" ]; then - SOLR_OPTS+=("-Dsolr.enableStreamBody=true") + SCRIPT_SOLR_OPTS+=("-Dsolr.enableStreamBody=true") fi : ${SOLR_SERVER_DIR:=$DEFAULT_SERVER_DIR} @@ -1494,15 +1497,15 @@ if [[ "$SCRIPT_CMD" == "stop" ]]; then fi if [ -n "${SOLR_PORT_ADVERTISE:-}" ]; then - SOLR_OPTS+=("-Dsolr.port.advertise=$SOLR_PORT_ADVERTISE") + SCRIPT_SOLR_OPTS+=("-Dsolr.port.advertise=$SOLR_PORT_ADVERTISE") fi if [ -n "${SOLR_JETTY_HOST:-}" ]; then - SOLR_OPTS+=("-Dsolr.jetty.host=$SOLR_JETTY_HOST") + SCRIPT_SOLR_OPTS+=("-Dsolr.jetty.host=$SOLR_JETTY_HOST") fi if [ -n "${SOLR_ZK_EMBEDDED_HOST:-}" ]; then - SOLR_OPTS+=("-Dsolr.zk.embedded.host=$SOLR_ZK_EMBEDDED_HOST") + SCRIPT_SOLR_OPTS+=("-Dsolr.zk.embedded.host=$SOLR_ZK_EMBEDDED_HOST") fi : "${STOP_PORT:=$((SOLR_PORT - 1000))}" @@ -1736,8 +1739,8 @@ else JAVA_MEM_OPTS=("-Xms$SOLR_HEAP" "-Xmx$SOLR_HEAP") fi -# Pick default for Java thread stack size, and then add to SOLR_OPTS -SOLR_OPTS+=(${SOLR_JAVA_STACK_SIZE:-"-Xss256k"}) +# Pick default for Java thread stack size, and then add to SCRIPT_SOLR_OPTS +SCRIPT_SOLR_OPTS+=(${SOLR_JAVA_STACK_SIZE:-"-Xss256k"}) : "${SOLR_TIMEZONE:=UTC}" @@ -1778,79 +1781,83 @@ function start_solr() { fi if [ -n "${SOLR_WAIT_FOR_ZK:-}" ]; then - SOLR_OPTS+=("-DwaitForZk=$SOLR_WAIT_FOR_ZK") + SCRIPT_SOLR_OPTS+=("-DwaitForZk=$SOLR_WAIT_FOR_ZK") fi if [ -n "${SOLR_DATA_HOME:-}" ]; then - SOLR_OPTS+=("-Dsolr.data.home=$SOLR_DATA_HOME") + SCRIPT_SOLR_OPTS+=("-Dsolr.data.home=$SOLR_DATA_HOME") fi if [ -n "${SOLR_DELETE_UNKNOWN_CORES:-}" ]; then - SOLR_OPTS+=("-Dsolr.deleteUnknownCores=$SOLR_DELETE_UNKNOWN_CORES") + SCRIPT_SOLR_OPTS+=("-Dsolr.deleteUnknownCores=$SOLR_DELETE_UNKNOWN_CORES") fi - # If SSL-related system props are set, add them to SOLR_OPTS + # If SSL-related system props are set, add them to SCRIPT_SOLR_OPTS if [ "$SOLR_SSL_ENABLED" == "true" ]; then # If using SSL and solr.jetty.https.port not set explicitly, use the jetty.port SSL_PORT_PROP="-Dsolr.jetty.https.port=$SOLR_PORT" - SOLR_OPTS+=($SOLR_SSL_OPTS "$SSL_PORT_PROP") + SCRIPT_SOLR_OPTS+=($SOLR_SSL_OPTS "$SSL_PORT_PROP") fi - # If authentication system props are set, add them to SOLR_OPTS + # If authentication system props are set, add them to SCRIPT_SOLR_OPTS if [ -n "$AUTHC_OPTS" ]; then - SOLR_OPTS+=($AUTHC_OPTS) + SCRIPT_SOLR_OPTS+=($AUTHC_OPTS) fi - # If there are internal options set by Solr (users should not use this variable), add them to SOLR_OPTS + # If there are internal options set by Solr (users should not use this variable), add them to SCRIPT_SOLR_OPTS if [ -n "$SOLR_OPTS_INTERNAL" ]; then - SOLR_OPTS+=($SOLR_OPTS_INTERNAL) + SCRIPT_SOLR_OPTS+=($SOLR_OPTS_INTERNAL) fi - # If a heap dump directory is specified, enable it in SOLR_OPTS + # If a heap dump directory is specified, enable it in SCRIPT_SOLR_OPTS if [[ -z "${SOLR_HEAP_DUMP_DIR:-}" ]] && [[ "${SOLR_HEAP_DUMP:-}" == "true" ]]; then SOLR_HEAP_DUMP_DIR="${SOLR_LOGS_DIR}/dumps" fi if [[ -n "${SOLR_HEAP_DUMP_DIR:-}" ]]; then - SOLR_OPTS+=("-XX:+HeapDumpOnOutOfMemoryError") - SOLR_OPTS+=("-XX:HeapDumpPath=$SOLR_HEAP_DUMP_DIR/solr-$(date +%s)-pid$$.hprof") + SCRIPT_SOLR_OPTS+=("-XX:+HeapDumpOnOutOfMemoryError") + SCRIPT_SOLR_OPTS+=("-XX:HeapDumpPath=$SOLR_HEAP_DUMP_DIR/solr-$(date +%s)-pid$$.hprof") fi if $verbose ; then echo -e "\nStarting Solr using the following settings:" - echo -e " JAVA = $JAVA" - echo -e " SOLR_SERVER_DIR = $SOLR_SERVER_DIR" - echo -e " SOLR_HOME = $SOLR_HOME" - echo -e " SOLR_HOST = ${SOLR_HOST:-}" - echo -e " SOLR_PORT = $SOLR_PORT" - echo -e " STOP_PORT = $STOP_PORT" - echo -e " JAVA_MEM_OPTS = ${JAVA_MEM_OPTS[*]}" - echo -e " GC_TUNE = ${GC_TUNE_ARR[*]}" - echo -e " GC_LOG_OPTS = ${GC_LOG_OPTS[*]}" - echo -e " SOLR_TIMEZONE = $SOLR_TIMEZONE" + echo -e " JAVA = $JAVA" + echo -e " SOLR_SERVER_DIR = $SOLR_SERVER_DIR" + echo -e " SOLR_HOME = $SOLR_HOME" + echo -e " SOLR_HOST = ${SOLR_HOST:-}" + echo -e " SOLR_PORT = $SOLR_PORT" + echo -e " STOP_PORT = $STOP_PORT" + echo -e " JAVA_MEM_OPTS = ${JAVA_MEM_OPTS[*]}" + echo -e " GC_TUNE = ${GC_TUNE_ARR[*]}" + echo -e " GC_LOG_OPTS = ${GC_LOG_OPTS[*]}" + echo -e " SOLR_TIMEZONE = $SOLR_TIMEZONE" if [ "$SOLR_MODE" == "solrcloud" ]; then - echo -e " CLOUD_MODE_OPTS = ${CLOUD_MODE_OPTS[*]}" + echo -e " CLOUD_MODE_OPTS = ${CLOUD_MODE_OPTS[*]}" fi if [ -n "${SOLR_OPTS:-}" ]; then - echo -e " SOLR_OPTS = ${SOLR_OPTS[*]}" + echo -e " SOLR_OPTS (USER) = ${SOLR_OPTS[*]}" + fi + + if [ -n "${SCRIPT_SOLR_OPTS:-}" ]; then + echo -e " SOLR_OPTS (SCRIPT) = ${SCRIPT_SOLR_OPTS[*]}" fi if [ -n "${SOLR_ADDL_ARGS:-}" ]; then - echo -e " SOLR_ADDL_ARGS = $SOLR_ADDL_ARGS" + echo -e " SOLR_ADDL_ARGS = $SOLR_ADDL_ARGS" fi if [ "${ENABLE_REMOTE_JMX_OPTS:-false}" == "true" ]; then - echo -e " RMI_PORT = ${RMI_PORT:-}" - echo -e " REMOTE_JMX_OPTS = ${REMOTE_JMX_OPTS[*]}" + echo -e " RMI_PORT = ${RMI_PORT:-}" + echo -e " REMOTE_JMX_OPTS = ${REMOTE_JMX_OPTS[*]}" fi if [ -n "${SOLR_LOG_LEVEL:-}" ]; then - echo -e " SOLR_LOG_LEVEL = $SOLR_LOG_LEVEL" + echo -e " SOLR_LOG_LEVEL = $SOLR_LOG_LEVEL" fi if [ -n "${SOLR_DATA_HOME:-}" ]; then - echo -e " SOLR_DATA_HOME = $SOLR_DATA_HOME" + echo -e " SOLR_DATA_HOME = $SOLR_DATA_HOME" fi echo fi @@ -1865,14 +1872,14 @@ function start_solr() { # Workaround for JIT crash, see https://issues.apache.org/jira/browse/SOLR-16463 if [[ "$JAVA_VER_NUM" -ge "17" ]] ; then - SOLR_OPTS+=("-XX:CompileCommand=exclude,com.github.benmanes.caffeine.cache.BoundedLocalCache::put") + SCRIPT_SOLR_OPTS+=("-XX:CompileCommand=exclude,com.github.benmanes.caffeine.cache.BoundedLocalCache::put") echo "Java $JAVA_VER_NUM detected. Enabled workaround for SOLR-16463" fi # Vector optimizations are only supported for Java 20 and 21 for now. # This will need to change as Lucene is upgraded and newer Java versions are released if [[ "$JAVA_VER_NUM" -ge "20" ]] && [[ "$JAVA_VER_NUM" -le "21" ]] ; then - SOLR_OPTS+=("--add-modules" "jdk.incubator.vector") + SCRIPT_SOLR_OPTS+=("--add-modules" "jdk.incubator.vector") echo "Java $JAVA_VER_NUM detected. Incubating Panama Vector APIs have been enabled" fi @@ -1886,7 +1893,7 @@ function start_solr() { # OOME is thrown. Program operation after OOME is unpredictable. "-XX:+CrashOnOutOfMemoryError" "-XX:ErrorFile=${SOLR_LOGS_DIR}/jvm_crash_%p.log" \ "-Djetty.home=$SOLR_SERVER_DIR" "-Dsolr.solr.home=$SOLR_HOME" "-Dsolr.install.dir=$SOLR_TIP" "-Dsolr.install.symDir=$SOLR_TIP_SYM" \ - "-Dsolr.default.confdir=$DEFAULT_CONFDIR" "${LOG4J_CONFIG[@]}" "${SOLR_OPTS[@]}" "${SECURITY_MANAGER_OPTS[@]}" "${SOLR_ADMIN_UI}") + "-Dsolr.default.confdir=$DEFAULT_CONFDIR" "${LOG4J_CONFIG[@]}" "${SCRIPT_SOLR_OPTS[@]}" "${SECURITY_MANAGER_OPTS[@]}" "${SOLR_ADMIN_UI}" "${SOLR_OPTS[@]}") mk_writable_dir "$SOLR_LOGS_DIR" "Logs" if [[ -n "${SOLR_HEAP_DUMP_DIR:-}" ]]; then diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index ce37a20d20e..bb297a64d62 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -146,7 +146,7 @@ IF "%SOLR_SSL_ENABLED%"=="true" ( ) ) IF DEFINED SOLR_SSL_CHECK_PEER_NAME ( - set "SOLR_SSL_OPTS=!SOLR_SSL_OPTS! -Dsolr.ssl.checkPeerName=%SOLR_SSL_CHECK_PEER_NAME%" + set "SOLR_SSL_OPTS=!SOLR_SSL_OPTS! -Dsolr.ssl.checkPeerName=%SOLR_SSL_CHECK_PEER_NAME% -Dsolr.jetty.ssl.sniHostCheck=%SOLR_SSL_CHECK_PEER_NAME%" ) ) ELSE ( set SOLR_SSL_OPTS= @@ -805,22 +805,24 @@ IF NOT "%SOLR_HOST%"=="" ( set SOLR_HOST_ARG= ) +set SCRIPT_SOLR_OPTS= + REM Solr modules option IF DEFINED SOLR_MODULES ( - set "SOLR_OPTS=%SOLR_OPTS% -Dsolr.modules=%SOLR_MODULES%" + set "SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -Dsolr.modules=%SOLR_MODULES%" ) REM Default placement plugin IF DEFINED SOLR_PLACEMENTPLUGIN_DEFAULT ( - set "SOLR_OPTS=%SOLR_OPTS% -Dsolr.placementplugin.default=%SOLR_PLACEMENTPLUGIN_DEFAULT%" + set "SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -Dsolr.placementplugin.default=%SOLR_PLACEMENTPLUGIN_DEFAULT%" ) REM Remote streaming and stream body IF "%SOLR_ENABLE_REMOTE_STREAMING%"=="true" ( - set "SOLR_OPTS=%SOLR_OPTS% -Dsolr.enableRemoteStreaming=true" + set "SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -Dsolr.enableRemoteStreaming=true" ) IF "%SOLR_ENABLE_STREAM_BODY%"=="true" ( - set "SOLR_OPTS=%SOLR_OPTS% -Dsolr.enableStreamBody=true" + set "SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -Dsolr.enableStreamBody=true" ) IF "%SOLR_SERVER_DIR%"=="" set "SOLR_SERVER_DIR=%DEFAULT_SERVER_DIR%" @@ -923,7 +925,7 @@ IF "%SCRIPT_CMD%"=="stop" ( set found_it=1 @echo Stopping Solr process %%N running on port %SOLR_PORT% IF "%STOP_PORT%"=="" set /A STOP_PORT=%SOLR_PORT% - 1000 - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% -Djetty.home="%SOLR_SERVER_DIR%" -jar "%SOLR_SERVER_DIR%\start.jar" %SOLR_JETTY_CONFIG% STOP.PORT=!STOP_PORT! STOP.KEY=%STOP_KEY% --stop + "%JAVA%" %SOLR_SSL_OPTS% %SOLR_TOOL_OPTS% -Djetty.home="%SOLR_SERVER_DIR%" -jar "%SOLR_SERVER_DIR%\start.jar" %SOLR_JETTY_CONFIG% STOP.PORT=!STOP_PORT! STOP.KEY=%STOP_KEY% --stop del "%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port REM wait for the process to terminate CALL :wait_for_process_exit %%N !SOLR_STOP_WAIT! @@ -948,15 +950,15 @@ IF "%SOLR_PORT%"=="" set SOLR_PORT=8983 IF "%STOP_PORT%"=="" set /A STOP_PORT=%SOLR_PORT% - 1000 IF DEFINED SOLR_PORT_ADVERTISE ( - set "SOLR_OPTS=%SOLR_OPTS% -Dsolr.port.advertise=%SOLR_PORT_ADVERTISE%" + set "SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -Dsolr.port.advertise=%SOLR_PORT_ADVERTISE%" ) IF DEFINED SOLR_JETTY_HOST ( - set "SOLR_OPTS=%SOLR_OPTS% -Dsolr.jetty.host=%SOLR_JETTY_HOST%" + set "SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -Dsolr.jetty.host=%SOLR_JETTY_HOST%" ) IF DEFINED SOLR_ZK_EMBEDDED_HOST ( - set "SOLR_OPTS=%SOLR_OPTS% -Dsolr.zk.embedded.host=%SOLR_ZK_EMBEDDED_HOST%" + set "SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -Dsolr.zk.embedded.host=%SOLR_ZK_EMBEDDED_HOST%" ) IF "%SCRIPT_CMD%"=="start" ( @@ -1097,7 +1099,7 @@ IF "%SOLR_ADMIN_UI_DISABLED%"=="true" ( IF NOT "%SOLR_HEAP%"=="" set SOLR_JAVA_MEM=-Xms%SOLR_HEAP% -Xmx%SOLR_HEAP% IF "%SOLR_JAVA_MEM%"=="" set SOLR_JAVA_MEM=-Xms512m -Xmx512m IF "%SOLR_JAVA_STACK_SIZE%"=="" set SOLR_JAVA_STACK_SIZE=-Xss256k -set SOLR_OPTS=%SOLR_JAVA_STACK_SIZE% %SOLR_OPTS% +set SCRIPT_SOLR_OPTS=%SOLR_JAVA_STACK_SIZE% %SCRIPT_SOLR_OPTS% IF "%SOLR_TIMEZONE%"=="" set SOLR_TIMEZONE=UTC IF "%GC_TUNE%"=="" ( @@ -1112,14 +1114,14 @@ IF "%GC_TUNE%"=="" ( REM Workaround for JIT crash, see https://issues.apache.org/jira/browse/SOLR-16463 if !JAVA_MAJOR_VERSION! GEQ 17 ( - set SOLR_OPTS=%SOLR_OPTS% -XX:CompileCommand=exclude,com.github.benmanes.caffeine.cache.BoundedLocalCache::put + set SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% -XX:CompileCommand=exclude,com.github.benmanes.caffeine.cache.BoundedLocalCache::put echo Java %JAVA_MAJOR_VERSION% detected. Enabled workaround for SOLR-16463 ) REM Vector optimizations are only supported for Java 20 and 21 for now. REM This will need to change as Lucene is upgraded and newer Java versions are released if !JAVA_MAJOR_VERSION! GEQ 20 if !JAVA_MAJOR_VERSION! LEQ 21 ( - set SOLR_OPTS=%SOLR_OPTS% --add-modules jdk.incubator.vector + set SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% --add-modules jdk.incubator.vector echo Java %JAVA_MAJOR_VERSION% detected. Incubating Panama Vector APIs have been enabled ) @@ -1149,44 +1151,48 @@ if !JAVA_MAJOR_VERSION! GEQ 9 if NOT "%JAVA_VENDOR%" == "OpenJ9" ( IF "%verbose%"=="1" ( @echo Starting Solr using the following settings: - CALL :safe_echo " JAVA = %JAVA%" - CALL :safe_echo " SOLR_SERVER_DIR = %SOLR_SERVER_DIR%" - CALL :safe_echo " SOLR_HOME = %SOLR_HOME%" - @echo SOLR_HOST = %SOLR_HOST% - @echo SOLR_PORT = %SOLR_PORT% - @echo STOP_PORT = %STOP_PORT% - @echo SOLR_JAVA_MEM = %SOLR_JAVA_MEM% - @echo GC_TUNE = !GC_TUNE! - @echo GC_LOG_OPTS = %GC_LOG_OPTS% - @echo SOLR_TIMEZONE = %SOLR_TIMEZONE% + CALL :safe_echo " JAVA = %JAVA%" + CALL :safe_echo " SOLR_SERVER_DIR = %SOLR_SERVER_DIR%" + CALL :safe_echo " SOLR_HOME = %SOLR_HOME%" + @echo SOLR_HOST = %SOLR_HOST% + @echo SOLR_PORT = %SOLR_PORT% + @echo STOP_PORT = %STOP_PORT% + @echo SOLR_JAVA_MEM = %SOLR_JAVA_MEM% + @echo GC_TUNE = !GC_TUNE! + @echo GC_LOG_OPTS = %GC_LOG_OPTS% + @echo SOLR_TIMEZONE = %SOLR_TIMEZONE% IF "%SOLR_MODE%"=="solrcloud" ( - @echo CLOUD_MODE_OPTS = %CLOUD_MODE_OPTS% + @echo CLOUD_MODE_OPTS = %CLOUD_MODE_OPTS% ) IF NOT "%SOLR_OPTS%"=="" ( - @echo SOLR_OPTS = %SOLR_OPTS% + @echo SOLR_OPTS (USER) = %SOLR_OPTS% + ) + + IF NOT "%SCRIPT_SOLR_OPTS%"=="" ( + @echo SOLR_OPTS (SCRIPT) = %SCRIPT_SOLR_OPTS% ) IF NOT "%SOLR_ADDL_ARGS%"=="" ( - CALL :safe_echo " SOLR_ADDL_ARGS = %SOLR_ADDL_ARGS%" + CALL :safe_echo " SOLR_ADDL_ARGS = %SOLR_ADDL_ARGS%" ) IF NOT "%SOLR_JETTY_ADDL_CONFIG%"=="" ( - CALL :safe_echo " SOLR_JETTY_ADDL_CONFIG = %SOLR_JETTY_ADDL_CONFIG%" + CALL :safe_echo " SOLR_JETTY_ADDL_CONFIG = %SOLR_JETTY_ADDL_CONFIG%" ) IF "%ENABLE_REMOTE_JMX_OPTS%"=="true" ( - @echo RMI_PORT = !RMI_PORT! - @echo REMOTE_JMX_OPTS = %REMOTE_JMX_OPTS% + @echo RMI_PORT = !RMI_PORT! + @echo REMOTE_JMX_OPTS = %REMOTE_JMX_OPTS% ) IF NOT "%SOLR_LOG_LEVEL%"=="" ( - @echo SOLR_LOG_LEVEL = !SOLR_LOG_LEVEL! + @echo SOLR_LOG_LEVEL = !SOLR_LOG_LEVEL! ) IF NOT "%SOLR_DATA_HOME%"=="" ( - @echo SOLR_DATA_HOME = !SOLR_DATA_HOME! + @echo SOLR_DATA_HOME = !SOLR_DATA_HOME! ) @echo. @@ -1207,7 +1213,7 @@ IF NOT "!IP_ACL_OPTS!"=="" set "START_OPTS=%START_OPTS% !IP_ACL_OPTS!" IF NOT "%REMOTE_JMX_OPTS%"=="" set "START_OPTS=%START_OPTS% %REMOTE_JMX_OPTS%" IF NOT "%SOLR_ADDL_ARGS%"=="" set "START_OPTS=%START_OPTS% %SOLR_ADDL_ARGS%" IF NOT "%SOLR_HOST_ARG%"=="" set "START_OPTS=%START_OPTS% %SOLR_HOST_ARG%" -IF NOT "%SOLR_OPTS%"=="" set "START_OPTS=%START_OPTS% %SOLR_OPTS%" +IF NOT "%SCRIPT_SOLR_OPTS%"=="" set "START_OPTS=%START_OPTS% %SCRIPT_SOLR_OPTS%" IF NOT "%SOLR_OPTS_INTERNAL%"=="" set "START_OPTS=%START_OPTS% %SOLR_OPTS_INTERNAL%" IF NOT "!SECURITY_MANAGER_OPTS!"=="" set "START_OPTS=%START_OPTS% !SECURITY_MANAGER_OPTS!" IF "%SOLR_SSL_ENABLED%"=="true" ( @@ -1223,6 +1229,9 @@ set "START_OPTS=%START_OPTS% -Dsolr.log.dir=%SOLR_LOGS_DIR_QUOTED% -Djava.util.l IF NOT "%SOLR_DATA_HOME%"=="" set "START_OPTS=%START_OPTS% -Dsolr.data.home=%SOLR_DATA_HOME_QUOTED%" IF NOT DEFINED LOG4J_CONFIG set "LOG4J_CONFIG=%SOLR_SERVER_DIR%\resources\log4j2.xml" +REM This should be the last thing added to START_OPTS, so that users can override as much as possible +IF NOT "%SOLR_OPTS%"=="" set "START_OPTS=%START_OPTS% %SOLR_OPTS%" + cd /d "%SOLR_SERVER_DIR%" IF NOT EXIST "%SOLR_LOGS_DIR%" ( @@ -1272,7 +1281,7 @@ IF "%FG%"=="1" ( set SOLR_START_WAIT=30 ) REM now wait to see Solr come online ... - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" -Dsolr.default.confdir="%DEFAULT_CONFDIR%"^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" -Dsolr.default.confdir="%DEFAULT_CONFDIR%"^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI status -maxWaitSecs !SOLR_START_WAIT! -solrUrl !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:%SOLR_PORT%/solr @@ -1287,7 +1296,7 @@ goto done :run_example REM Run the requested example -"%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ +"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -Dsolr.install.symDir="%SOLR_TIP%" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ @@ -1311,7 +1320,7 @@ for /f "usebackq" %%i in (`dir /b "%SOLR_TIP%\bin" ^| findstr /i "^solr-.*\.port set has_info=1 echo Found Solr process %%k running on port !SOME_SOLR_PORT! REM Passing in %2 (-h or -help) directly is captured by a custom help path for usage output - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI status -solrUrl !SOLR_URL_SCHEME!://%SOLR_TOOL_HOST%:!SOME_SOLR_PORT!/solr %2 @@ -1326,7 +1335,7 @@ set has_info= goto done :run_solrcli -"%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ +"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI %* @@ -1475,7 +1484,7 @@ IF "!ZK_OP!"=="upconfig" ( set ERROR_MSG="The -d option must be set for upconfig." goto zk_short_usage ) - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI !ZK_OP! -confname !CONFIGSET_NAME! -confdir !CONFIGSET_DIR! -zkHost !ZK_HOST! %ZK_VERBOSE%^ @@ -1489,7 +1498,7 @@ IF "!ZK_OP!"=="upconfig" ( set ERROR_MSG="The -d option must be set for downconfig." goto zk_short_usage ) - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI !ZK_OP! -confname !CONFIGSET_NAME! -confdir !CONFIGSET_DIR! -zkHost !ZK_HOST! %ZK_VERBOSE% @@ -1508,7 +1517,7 @@ IF "!ZK_OP!"=="upconfig" ( goto zk_short_usage ) ) - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -src !ZK_SRC! -dst !ZK_DST! -recurse !ZK_RECURSE! %ZK_VERBOSE% @@ -1521,7 +1530,7 @@ IF "!ZK_OP!"=="upconfig" ( set ERROR_MSG=" must be specified for 'mv' command" goto zk_short_usage ) - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -src !ZK_SRC! -dst !ZK_DST! %ZK_VERBOSE% @@ -1530,7 +1539,7 @@ IF "!ZK_OP!"=="upconfig" ( set ERROR_MSG="Zookeeper path to remove must be specified when using the 'rm' command" goto zk_short_usage ) - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -path !ZK_SRC! -recurse !ZK_RECURSE! %ZK_VERBOSE% @@ -1539,7 +1548,7 @@ IF "!ZK_OP!"=="upconfig" ( set ERROR_MSG="Zookeeper path to remove must be specified when using the 'ls' command" goto zk_short_usage ) - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -path !ZK_SRC! -recurse !ZK_RECURSE! %ZK_VERBOSE% @@ -1548,7 +1557,7 @@ IF "!ZK_OP!"=="upconfig" ( set ERROR_MSG="Zookeeper path to create must be specified when using the 'mkroot' command" goto zk_short_usage ) - "%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ + "%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%SOLR_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI !ZK_OP! -zkHost !ZK_HOST! -path !ZK_SRC! %ZK_VERBOSE% @@ -1609,7 +1618,7 @@ if "!AUTH_PORT!"=="" ( ) ) ) -"%JAVA%" %SOLR_TOOL_OPTS% %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% -Dsolr.install.dir="%SOLR_TIP%" ^ +"%JAVA%" %SOLR_SSL_OPTS% %AUTHC_OPTS% %SOLR_ZK_CREDS_AND_ACLS% %SOLR_TOOL_OPTS% -Dsolr.install.dir="%SOLR_TIP%" ^ -Dlog4j.configurationFile="file:///%DEFAULT_SERVER_DIR%\resources\log4j2-console.xml" ^ -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^ org.apache.solr.cli.SolrCLI auth %AUTH_PARAMS% -solrIncludeFile "%SOLR_INCLUDE%" -authConfDir "%SOLR_HOME%" ^ diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd index 5f982cb16b5..f9892d33d66 100755 --- a/solr/bin/solr.in.cmd +++ b/solr/bin/solr.in.cmd @@ -159,7 +159,8 @@ REM set SOLR_SSL_WANT_CLIENT_AUTH=false REM Verify client hostname during SSL handshake REM set SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=false REM SSL Certificates contain host/ip "peer name" information that is validated by default. Setting -REM this to false can be useful to disable these checks when re-using a certificate on many hosts +REM this to false can be useful to disable these checks when re-using a certificate on many hosts. +REM This will also be used for the default value of whether SNI Host checking should be enabled. REM set SOLR_SSL_CHECK_PEER_NAME=true REM Override Key/Trust Store types if necessary REM set SOLR_SSL_KEY_STORE_TYPE=PKCS12 diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.sh index 117ef1761a9..f6da91c2f3b 100644 --- a/solr/bin/solr.in.sh +++ b/solr/bin/solr.in.sh @@ -173,7 +173,8 @@ # Verify client's hostname during SSL handshake #SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=false # SSL Certificates contain host/ip "peer name" information that is validated by default. Setting -# this to false can be useful to disable these checks when re-using a certificate on many hosts +# this to false can be useful to disable these checks when re-using a certificate on many hosts. +# This will also be used for the default value of whether SNI Host checking should be enabled. #SOLR_SSL_CHECK_PEER_NAME=true # Override Key/Trust Store types if necessary #SOLR_SSL_KEY_STORE_TYPE=PKCS12 diff --git a/solr/core/src/java/org/apache/solr/api/V2HttpCall.java b/solr/core/src/java/org/apache/solr/api/V2HttpCall.java index 92008542a60..a57b286a9a3 100644 --- a/solr/core/src/java/org/apache/solr/api/V2HttpCall.java +++ b/solr/core/src/java/org/apache/solr/api/V2HttpCall.java @@ -44,7 +44,6 @@ import org.apache.solr.common.cloud.DocCollection; import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.params.CommonParams; -import org.apache.solr.common.util.CommandOperation; import org.apache.solr.common.util.JsonSchemaValidator; import org.apache.solr.common.util.PathTrie; import org.apache.solr.common.util.SuppressForbidden; @@ -503,22 +502,7 @@ protected void populateTracingSpan(Span span) { // Get the templatize-ed path, ex: "/c/{collection}" final String path = computeEndpointPath(); - - String verb = null; - // if this api has commands ... - final Map validators = getValidators(); // should be cached - if (validators != null && validators.isEmpty() == false && solrReq != null) { - boolean validateInput = true; // because getCommands caches it; and we want it validated later - // does this request have one command? - List cmds = solrReq.getCommands(validateInput); - if (cmds.size() == 1) { - verb = cmds.get(0).name; - } - } - if (verb == null) { - verb = req.getMethod().toLowerCase(Locale.ROOT); - } - + final String verb = req.getMethod().toLowerCase(Locale.ROOT); span.updateName(verb + ":" + path); } diff --git a/solr/core/src/java/org/apache/solr/cli/ApiTool.java b/solr/core/src/java/org/apache/solr/cli/ApiTool.java index 6122000211b..8ecfcd36a40 100644 --- a/solr/core/src/java/org/apache/solr/cli/ApiTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ApiTool.java @@ -23,6 +23,7 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.solr.client.solrj.SolrRequest; +import org.apache.solr.client.solrj.impl.JsonMapResponseParser; import org.apache.solr.client.solrj.request.GenericSolrRequest; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.util.NamedList; @@ -61,29 +62,42 @@ public List