-
Notifications
You must be signed in to change notification settings - Fork 821
Migrate SplitCore and SplitShard to Jax-rs #4179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f4b6a3f
c00a0c6
97032bd
032f4e7
2fd70c2
6d6650b
23fe06a
7871ac6
b10db93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| title: Migrate SplitCore and SplitShard to JAX-RS. SplitCore and SplitShard now have OpenAPI and SolrJ support. | ||
| type: changed | ||
| authors: | ||
| - name: Eric Pugh | ||
| links: | ||
| - name: PR#4179 | ||
| url: https://github.com/apache/solr/pull/4179 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * 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 jakarta.ws.rs.POST; | ||
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.PathParam; | ||
| import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
| import org.apache.solr.client.api.model.SplitCoreRequestBody; | ||
|
|
||
| /** | ||
| * V2 API definition for splitting a Solr core. | ||
| * | ||
| * <p>The new API (POST /api/cores/{coreName}/split) is equivalent to the v1 | ||
| * /admin/cores?action=split command. | ||
| */ | ||
| @Path("/cores/{coreName}/split") | ||
| public interface SplitCoreApi { | ||
| @POST | ||
| @Operation( | ||
| summary = "Splits a core index into two or more indexes.", | ||
| tags = {"cores"}) | ||
| SolrJerseyResponse splitCore( | ||
| @Parameter(description = "The name of the core to split.", required = true) | ||
| @PathParam("coreName") | ||
| String coreName, | ||
| @RequestBody(description = "Additional properties for the split operation.") | ||
| SplitCoreRequestBody requestBody) | ||
| throws Exception; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * 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 jakarta.ws.rs.POST; | ||
| import jakarta.ws.rs.Path; | ||
| import jakarta.ws.rs.PathParam; | ||
| import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
| import org.apache.solr.client.api.model.SplitShardRequestBody; | ||
|
|
||
| /** | ||
| * V2 API definition for splitting an existing shard into multiple pieces. | ||
| * | ||
| * <p>The new API (POST /api/collections/{collectionName}/shards/split) is equivalent to the v1 | ||
| * /admin/collections?action=SPLITSHARD command. | ||
| */ | ||
| @Path("/collections/{collectionName}/shards/split") | ||
| public interface SplitShardApi { | ||
| @POST | ||
| @Operation( | ||
| summary = "Splits a shard in an existing collection into two or more shards.", | ||
| tags = {"shards"}) | ||
| SolrJerseyResponse splitShard( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [-1] SolrJerseyResponse is a very minimal POJO that pretty much just includes the responseHeader section. If you look at our actual split-shard implementation it can include a good bit more than that. Today's split-shard response can optionally include timing information about stages of the split, etc. So we probably need a split-shard specific response POJO |
||
| @Parameter(description = "The name of the collection containing the shard.", required = true) | ||
| @PathParam("collectionName") | ||
| String collectionName, | ||
| @RequestBody(description = "Additional properties for the shard split operation.") | ||
| SplitShardRequestBody requestBody) | ||
| throws Exception; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Request body for splitting a Solr core via {@link | ||
| * org.apache.solr.client.api.endpoint.SplitCoreApi} | ||
| */ | ||
| public class SplitCoreRequestBody { | ||
| @Schema(description = "Multi-valued, file system paths to write the split pieces to.") | ||
| @JsonProperty | ||
| public List<String> path; | ||
|
|
||
| @Schema(description = "Multi-valued, names of the cores to split the index into.") | ||
| @JsonProperty | ||
| public List<String> targetCore; | ||
|
|
||
| @Schema(description = "A route key to be used for splitting the index.") | ||
| @JsonProperty | ||
| public String splitKey; | ||
|
|
||
| @Schema(description = "The method to use for splitting the index (e.g. 'rewrite' or 'link').") | ||
| @JsonProperty | ||
| public String splitMethod; | ||
|
|
||
| @Schema(description = "When true, returns the range recommendations for splitting the index.") | ||
| @JsonProperty | ||
| public Boolean getRanges; | ||
|
|
||
| @Schema(description = "Comma-separated hash ranges to split the index into (e.g. 'a-b,c-d').") | ||
| @JsonProperty | ||
| public String ranges; | ||
|
|
||
| @Schema(description = "Request ID to track this action which will be processed asynchronously.") | ||
| @JsonProperty | ||
| public String async; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /* | ||
| * 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; | ||
|
|
||
| /** | ||
| * Request body for splitting a shard via {@link org.apache.solr.client.api.endpoint.SplitShardApi} | ||
| */ | ||
| public class SplitShardRequestBody { | ||
| @Schema(description = "The name of the shard to be split.") | ||
| @JsonProperty | ||
| public String shard; | ||
|
|
||
| @Schema(description = "Comma-separated hash ranges to split the shard into (e.g. 'a-b,c-d').") | ||
| @JsonProperty | ||
| public String ranges; | ||
|
|
||
| @Schema(description = "A route key to be used for splitting the index.") | ||
| @JsonProperty | ||
| public String splitKey; | ||
|
|
||
| @Schema(description = "The number of sub-shards to create from the shard.") | ||
| @JsonProperty | ||
| public Integer numSubShards; | ||
|
|
||
| @Schema(description = "A fuzzy factor for the split (e.g. '0.2').") | ||
| @JsonProperty | ||
| public String splitFuzz; | ||
|
|
||
| @Schema(description = "When true, timing information is included in the response.") | ||
| @JsonProperty | ||
| public Boolean timing; | ||
|
|
||
| @Schema(description = "When true, split ranges are determined based on prefix distribution.") | ||
| @JsonProperty | ||
| public Boolean splitByPrefix; | ||
|
|
||
| @Schema(description = "When true, aliases are followed to find the actual collection name.") | ||
| @JsonProperty | ||
| public Boolean followAliases; | ||
|
|
||
| @Schema(description = "The method to use for splitting the index (e.g. 'rewrite' or 'link').") | ||
| @JsonProperty | ||
| public String splitMethod; | ||
|
|
||
| @Schema(description = "Core properties to set on the sub-shards.") | ||
| @JsonProperty | ||
| public Map<String, Object> coreProperties; | ||
|
|
||
| @Schema(description = "Request ID to track this action which will be processed asynchronously.") | ||
| @JsonProperty | ||
| public String async; | ||
|
|
||
| @Deprecated(since = "9.10") | ||
| @Schema(description = "Deprecated. When true, waits for the final state before returning.") | ||
| @JsonProperty | ||
| public Boolean waitForFinalState; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[0] Drop the JAX-RS bit - users don't care about that IMO. What I'd focus on is the new auto-generated SolrJ classes that client users will have access to.