From 06a3751c6984fd6572dc63f28eb4f9e0320d8fb3 Mon Sep 17 00:00:00 2001 From: Sanjay Dutt Date: Thu, 25 Jan 2024 21:26:48 +0530 Subject: [PATCH] SOLR-16397: Tweak v2 'REQUESTSTATUS' API to be more REST-ful (#2144) This commit changes the v2 "requeststatus" (core level) API to be more in line with the REST-ful design we're targeting for Solr's v2 APIs. Following these changes, the v2 API now appears as: `GET /api/node/commands/someCommandId` --------- Co-authored-by: iamsanjay --- solr/CHANGES.txt | 3 + .../api/endpoint/GetNodeCommandStatusApi.java | 50 ++++++++++ .../model/GetNodeCommandStatusResponse.java | 27 ++++++ .../solr/handler/admin/CoreAdminHandler.java | 6 +- .../handler/admin/CoreAdminOperation.java | 40 ++------ .../admin/api/GetNodeCommandStatus.java | 75 +++++++++++++++ .../api/RequestCoreCommandStatusAPI.java | 62 ------------ .../admin/api/GetNodeCommandStatusTest.java | 94 +++++++++++++++++++ .../admin/api/V2CoreAPIMappingTest.java | 13 --- .../pages/coreadmin-api.adoc | 21 ++++- 10 files changed, 280 insertions(+), 111 deletions(-) create mode 100644 solr/api/src/java/org/apache/solr/client/api/endpoint/GetNodeCommandStatusApi.java create mode 100644 solr/api/src/java/org/apache/solr/client/api/model/GetNodeCommandStatusResponse.java create mode 100644 solr/core/src/java/org/apache/solr/handler/admin/api/GetNodeCommandStatus.java delete mode 100644 solr/core/src/java/org/apache/solr/handler/admin/api/RequestCoreCommandStatusAPI.java create mode 100644 solr/core/src/test/org/apache/solr/handler/admin/api/GetNodeCommandStatusTest.java diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 36b7be60896..13c3b8d900e 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -165,6 +165,9 @@ Improvements * SOLR-17096: solr.xml now supports declaring clusterSingleton plugins (Paul McArthur, David Smiley) +* SOLR-16397: The v2 endpoint to request the status of asynchronous CoreAdmin commands has been updated to be more REST-ful. + Now available at `GET /api/node/commands/someRequestId` (Sanjay Dutt via Jason Gerlowski) + Optimizations --------------------- * SOLR-17084: LBSolrClient (used by CloudSolrClient) now returns the count of core tracked as not live AKA zombies diff --git a/solr/api/src/java/org/apache/solr/client/api/endpoint/GetNodeCommandStatusApi.java b/solr/api/src/java/org/apache/solr/client/api/endpoint/GetNodeCommandStatusApi.java new file mode 100644 index 00000000000..a2b5bcc5986 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/endpoint/GetNodeCommandStatusApi.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.endpoint; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import org.apache.solr.client.api.model.GetNodeCommandStatusResponse; + +/** + * V2 API for checking the status of a core-level asynchronous command. + * + *

This API is analogous to the v1 /admin/cores?action=REQUESTSTATUS command. It is not to be + * confused with the more robust asynchronous command support offered under the v2 + * `/cluster/command-status` path (or the corresponding v1 path + * `/solr/admin/collections?action=REQUESTSTATUS`). Async support at the core level differs in that + * command IDs are local to individual Solr nodes and are not persisted across restarts. + * + * @see GetNodeCommandStatusResponse + */ +@Path("/node/commands/") +public interface GetNodeCommandStatusApi { + @Path("/{requestId}") + @GET + @Operation( + summary = "Request the status of an already submitted asynchronous CoreAdmin API call.", + tags = {"node"}) + GetNodeCommandStatusResponse getCommandStatus( + @Parameter( + description = "The user defined request-id for the asynchronous request.", + required = true) + @PathParam("requestId") + String id); +} diff --git a/solr/api/src/java/org/apache/solr/client/api/model/GetNodeCommandStatusResponse.java b/solr/api/src/java/org/apache/solr/client/api/model/GetNodeCommandStatusResponse.java new file mode 100644 index 00000000000..754b69743f3 --- /dev/null +++ b/solr/api/src/java/org/apache/solr/client/api/model/GetNodeCommandStatusResponse.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 GetNodeCommandStatusResponse extends SolrJerseyResponse { + @JsonProperty("STATUS") + public String status; + + @JsonProperty public String msg; + @JsonProperty public Object response; +} diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java index 415343422d1..ca67a355b44 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java @@ -58,6 +58,7 @@ import org.apache.solr.handler.admin.api.CoreSnapshot; import org.apache.solr.handler.admin.api.CreateCoreAPI; import org.apache.solr.handler.admin.api.CreateCoreBackup; +import org.apache.solr.handler.admin.api.GetNodeCommandStatus; import org.apache.solr.handler.admin.api.InstallCoreData; import org.apache.solr.handler.admin.api.MergeIndexes; import org.apache.solr.handler.admin.api.OverseerOperationAPI; @@ -67,7 +68,6 @@ import org.apache.solr.handler.admin.api.RenameCore; import org.apache.solr.handler.admin.api.RequestApplyCoreUpdatesAPI; import org.apache.solr.handler.admin.api.RequestBufferUpdatesAPI; -import org.apache.solr.handler.admin.api.RequestCoreCommandStatusAPI; import org.apache.solr.handler.admin.api.RequestCoreRecoveryAPI; import org.apache.solr.handler.admin.api.RequestSyncShardAPI; import org.apache.solr.handler.admin.api.RestoreCore; @@ -384,7 +384,6 @@ public Collection getApis() { apis.addAll(AnnotatedApi.getApis(new RejoinLeaderElectionAPI(this))); apis.addAll(AnnotatedApi.getApis(new OverseerOperationAPI(this))); apis.addAll(AnnotatedApi.getApis(new SplitCoreAPI(this))); - apis.addAll(AnnotatedApi.getApis(new RequestCoreCommandStatusAPI(this))); // Internal APIs apis.addAll(AnnotatedApi.getApis(new RequestCoreRecoveryAPI(this))); apis.addAll(AnnotatedApi.getApis(new PrepareCoreRecoveryAPI(this))); @@ -406,7 +405,8 @@ public Collection> getJerseyResources() { UnloadCore.class, SwapCores.class, RenameCore.class, - MergeIndexes.class); + MergeIndexes.class, + GetNodeCommandStatus.class); } public interface CoreAdminOp { diff --git a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java index 1f6deee32ca..0aafba7c70b 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminOperation.java @@ -44,12 +44,6 @@ import static org.apache.solr.common.params.CoreAdminParams.REPLICA_TYPE; import static org.apache.solr.common.params.CoreAdminParams.SHARD; import static org.apache.solr.handler.admin.CoreAdminHandler.CallInfo; -import static org.apache.solr.handler.admin.CoreAdminHandler.CoreAdminAsyncTracker.COMPLETED; -import static org.apache.solr.handler.admin.CoreAdminHandler.CoreAdminAsyncTracker.FAILED; -import static org.apache.solr.handler.admin.CoreAdminHandler.CoreAdminAsyncTracker.RUNNING; -import static org.apache.solr.handler.admin.CoreAdminHandler.OPERATION_RESPONSE; -import static org.apache.solr.handler.admin.CoreAdminHandler.RESPONSE_MESSAGE; -import static org.apache.solr.handler.admin.CoreAdminHandler.RESPONSE_STATUS; import static org.apache.solr.handler.admin.CoreAdminHandler.buildCoreParams; import static org.apache.solr.handler.admin.CoreAdminHandler.normalizePath; @@ -79,6 +73,7 @@ import org.apache.solr.core.SolrCore; import org.apache.solr.handler.admin.CoreAdminHandler.CoreAdminOp; import org.apache.solr.handler.admin.api.CoreSnapshot; +import org.apache.solr.handler.admin.api.GetNodeCommandStatus; import org.apache.solr.handler.admin.api.ReloadCore; import org.apache.solr.handler.admin.api.RenameCore; import org.apache.solr.handler.admin.api.SwapCores; @@ -242,34 +237,15 @@ public enum CoreAdminOperation implements CoreAdminOp { REQUESTSTATUS_OP( REQUESTSTATUS, it -> { - SolrParams params = it.req.getParams(); - String requestId = params.required().get(CoreAdminParams.REQUESTID); + final var params = it.req.getParams(); + final String requestId = params.required().get(CoreAdminParams.REQUESTID); log().info("Checking request status for : " + requestId); - final CoreAdminHandler.CoreAdminAsyncTracker coreAdminAsyncTracker = - it.handler.getCoreAdminAsyncTracker(); - if (coreAdminAsyncTracker.getRequestStatusMap(RUNNING).containsKey(requestId)) { - it.rsp.add(RESPONSE_STATUS, RUNNING); - } else if (coreAdminAsyncTracker.getRequestStatusMap(COMPLETED).containsKey(requestId)) { - it.rsp.add(RESPONSE_STATUS, COMPLETED); - it.rsp.add( - RESPONSE_MESSAGE, - coreAdminAsyncTracker.getRequestStatusMap(COMPLETED).get(requestId).getRspObject()); - it.rsp.add( - OPERATION_RESPONSE, - coreAdminAsyncTracker - .getRequestStatusMap(COMPLETED) - .get(requestId) - .getOperationRspObject()); - } else if (coreAdminAsyncTracker.getRequestStatusMap(FAILED).containsKey(requestId)) { - it.rsp.add(RESPONSE_STATUS, FAILED); - it.rsp.add( - RESPONSE_MESSAGE, - coreAdminAsyncTracker.getRequestStatusMap(FAILED).get(requestId).getRspObject()); - } else { - it.rsp.add(RESPONSE_STATUS, "notfound"); - it.rsp.add(RESPONSE_MESSAGE, "No task found in running, completed or failed tasks"); - } + final var requestCoreCommandStatusApi = + new GetNodeCommandStatus( + it.handler.coreContainer, it.handler.coreAdminAsyncTracker, it.req, it.rsp); + final SolrJerseyResponse response = requestCoreCommandStatusApi.getCommandStatus(requestId); + V2ApiUtils.squashIntoSolrResponseWithoutHeader(it.rsp, response); }), OVERSEEROP_OP( diff --git a/solr/core/src/java/org/apache/solr/handler/admin/api/GetNodeCommandStatus.java b/solr/core/src/java/org/apache/solr/handler/admin/api/GetNodeCommandStatus.java new file mode 100644 index 00000000000..c6627d012e3 --- /dev/null +++ b/solr/core/src/java/org/apache/solr/handler/admin/api/GetNodeCommandStatus.java @@ -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.handler.admin.api; + +import static org.apache.solr.handler.admin.CoreAdminHandler.CoreAdminAsyncTracker.COMPLETED; +import static org.apache.solr.handler.admin.CoreAdminHandler.CoreAdminAsyncTracker.FAILED; +import static org.apache.solr.handler.admin.CoreAdminHandler.CoreAdminAsyncTracker.RUNNING; + +import jakarta.inject.Inject; +import org.apache.solr.client.api.endpoint.GetNodeCommandStatusApi; +import org.apache.solr.client.api.model.GetNodeCommandStatusResponse; +import org.apache.solr.common.params.CoreAdminParams; +import org.apache.solr.core.CoreContainer; +import org.apache.solr.handler.admin.CoreAdminHandler; +import org.apache.solr.jersey.PermissionName; +import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.response.SolrQueryResponse; +import org.apache.solr.security.PermissionNameProvider; + +/** + * Implementation of V2 API interface {@link GetNodeCommandStatusApi} for checking the status of a + * core-level asynchronous command. + */ +public class GetNodeCommandStatus extends CoreAdminAPIBase implements GetNodeCommandStatusApi { + + @Inject + public GetNodeCommandStatus( + CoreContainer coreContainer, + CoreAdminHandler.CoreAdminAsyncTracker coreAdminAsyncTracker, + SolrQueryRequest req, + SolrQueryResponse rsp) { + super(coreContainer, coreAdminAsyncTracker, req, rsp); + } + + @Override + @PermissionName(PermissionNameProvider.Name.CORE_READ_PERM) + public GetNodeCommandStatusResponse getCommandStatus(String requestId) { + ensureRequiredParameterProvided(CoreAdminParams.REQUESTID, requestId); + var requestStatusResponse = new GetNodeCommandStatusResponse(); + if (coreAdminAsyncTracker.getRequestStatusMap(RUNNING).containsKey(requestId)) { + requestStatusResponse.status = RUNNING; + } else if (coreAdminAsyncTracker.getRequestStatusMap(COMPLETED).containsKey(requestId)) { + requestStatusResponse.status = COMPLETED; + requestStatusResponse.response = + coreAdminAsyncTracker.getRequestStatusMap(COMPLETED).get(requestId).getRspObject(); + requestStatusResponse.response = + coreAdminAsyncTracker + .getRequestStatusMap(COMPLETED) + .get(requestId) + .getOperationRspObject(); + } else if (coreAdminAsyncTracker.getRequestStatusMap(FAILED).containsKey(requestId)) { + requestStatusResponse.status = FAILED; + requestStatusResponse.response = + coreAdminAsyncTracker.getRequestStatusMap(FAILED).get(requestId).getRspObject(); + } else { + requestStatusResponse.status = "notfound"; + requestStatusResponse.msg = "No task found in running, completed or failed tasks"; + } + return requestStatusResponse; + } +} diff --git a/solr/core/src/java/org/apache/solr/handler/admin/api/RequestCoreCommandStatusAPI.java b/solr/core/src/java/org/apache/solr/handler/admin/api/RequestCoreCommandStatusAPI.java deleted file mode 100644 index 242ecbcd7a5..00000000000 --- a/solr/core/src/java/org/apache/solr/handler/admin/api/RequestCoreCommandStatusAPI.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.handler.admin.api; - -import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET; -import static org.apache.solr.common.params.CollectionParams.ACTION; -import static org.apache.solr.handler.ClusterAPI.wrapParams; -import static org.apache.solr.security.PermissionNameProvider.Name.CORE_READ_PERM; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import org.apache.solr.api.EndPoint; -import org.apache.solr.common.params.CoreAdminParams; -import org.apache.solr.handler.admin.CoreAdminHandler; -import org.apache.solr.request.SolrQueryRequest; -import org.apache.solr.response.SolrQueryResponse; - -/** - * V2 API for checking the status of a core-level asynchronous command. - * - *

This API (GET /v2/cores/command-status/someId is analogous to the v1 - * /admin/cores?action=REQUESTSTATUS command. It is not to be confused with the more robust - * asynchronous command support offered under the v2 `/cluster/command-status` path (or the - * corresponding v1 path `/solr/admin/collections?action=REQUESTSTATUS`). Async support at the core - * level differs in that command IDs are local to individual Solr nodes and are not persisted across - * restarts. - * - * @see org.apache.solr.client.solrj.request.beans.RequestSyncShardPayload - */ -public class RequestCoreCommandStatusAPI { - - private final CoreAdminHandler coreAdminHandler; - - public RequestCoreCommandStatusAPI(CoreAdminHandler coreAdminHandler) { - this.coreAdminHandler = coreAdminHandler; - } - - @EndPoint(method = GET, path = "/cores/{core}/command-status/{id}", permission = CORE_READ_PERM) - public void getCommandStatus(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception { - final Map v1Params = new HashMap<>(); - v1Params.put( - ACTION, CoreAdminParams.CoreAdminAction.REQUESTSTATUS.name().toLowerCase(Locale.ROOT)); - v1Params.put(CoreAdminParams.REQUESTID, req.getPathTemplateValues().get("id")); - coreAdminHandler.handleRequestBody(wrapParams(req, v1Params), rsp); - } -} diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/GetNodeCommandStatusTest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/GetNodeCommandStatusTest.java new file mode 100644 index 00000000000..4a52383bf20 --- /dev/null +++ b/solr/core/src/test/org/apache/solr/handler/admin/api/GetNodeCommandStatusTest.java @@ -0,0 +1,94 @@ +/* + * 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.handler.admin.api; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Map; +import org.apache.solr.SolrTestCase; +import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.client.api.endpoint.GetNodeCommandStatusApi; +import org.apache.solr.core.CoreContainer; +import org.apache.solr.handler.admin.CoreAdminHandler; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +/** Test for {@link GetNodeCommandStatus}. */ +public class GetNodeCommandStatusTest extends SolrTestCase { + private CoreContainer mockCoreContainer; + private CoreAdminHandler.CoreAdminAsyncTracker mockAsyncTracker; + private CoreAdminHandler.CoreAdminAsyncTracker.TaskObject taskObject; + private GetNodeCommandStatusApi requestNodeCommandApi; + + @BeforeClass + public static void ensureWorkingMockito() { + SolrTestCaseJ4.assumeWorkingMockito(); + } + + @Before + public void setupMocks() { + mockCoreContainer = mock(CoreContainer.class); + mockAsyncTracker = mock(CoreAdminHandler.CoreAdminAsyncTracker.class); + taskObject = new CoreAdminHandler.CoreAdminAsyncTracker.TaskObject(null, null, false, null); + requestNodeCommandApi = + new GetNodeCommandStatus(mockCoreContainer, mockAsyncTracker, null, null); + } + + public void resetMocks() {} + + @Test + public void testNonexistentCommandId() { + final var response = requestNodeCommandApi.getCommandStatus("NOTFOUND-1"); + assertEquals("notfound", response.status); + } + + @Test + public void testReturnsStatusOfRunningCommandId() { + final var runningTaskId = "RUNNING-1"; + whenTaskExistsWithStatus(runningTaskId, CoreAdminHandler.CoreAdminAsyncTracker.RUNNING); + + final var response = requestNodeCommandApi.getCommandStatus(runningTaskId); + + assertEquals("running", response.status); + } + + @Test + public void testReturnsStatusOfCompletedCommandId() { + final var completedTaskId = "COMPLETED-1"; + whenTaskExistsWithStatus(completedTaskId, CoreAdminHandler.CoreAdminAsyncTracker.COMPLETED); + + final var response = requestNodeCommandApi.getCommandStatus(completedTaskId); + + assertEquals("completed", response.status); + } + + @Test + public void testReturnsStatusOfFailedCommandId() { + final var willFailTaskId = "failed-1"; + whenTaskExistsWithStatus(willFailTaskId, CoreAdminHandler.CoreAdminAsyncTracker.FAILED); + + final var response = requestNodeCommandApi.getCommandStatus(willFailTaskId); + + assertEquals("failed", response.status); + } + + private void whenTaskExistsWithStatus(String taskId, String status) { + when(mockAsyncTracker.getRequestStatusMap(status)).thenReturn(Map.of(taskId, taskObject)); + } +} diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/V2CoreAPIMappingTest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/V2CoreAPIMappingTest.java index 2ab55905e04..bd3171cd1c3 100644 --- a/solr/core/src/test/org/apache/solr/handler/admin/api/V2CoreAPIMappingTest.java +++ b/solr/core/src/test/org/apache/solr/handler/admin/api/V2CoreAPIMappingTest.java @@ -26,7 +26,6 @@ import static org.apache.solr.common.params.CoreAdminParams.NAME; import static org.apache.solr.common.params.CoreAdminParams.OTHER; import static org.apache.solr.common.params.CoreAdminParams.RANGES; -import static org.apache.solr.common.params.CoreAdminParams.REQUESTID; import static org.apache.solr.common.params.CoreAdminParams.TARGET_CORE; import java.util.Arrays; @@ -70,7 +69,6 @@ public void populateApiBag() { apiBag.registerObject(new RequestApplyCoreUpdatesAPI(handler)); apiBag.registerObject(new RequestSyncShardAPI(handler)); apiBag.registerObject(new RequestBufferUpdatesAPI(handler)); - apiBag.registerObject(new RequestCoreCommandStatusAPI(handler)); } @Test @@ -172,15 +170,4 @@ public void testRequestBufferUpdatesAllParams() throws Exception { assertEquals("requestbufferupdates", v1Params.get(ACTION)); assertEquals("coreName", v1Params.get(NAME)); } - - // Strictly speaking, this API isn't at the /cores/coreName path, but as the only API at its path - // (/cores/coreName/command-status/requestId) it doesn't merit its own test class. - @Test - public void testRequestCommandStatusAllParams() throws Exception { - final SolrParams v1Params = - captureConvertedV1Params("/cores/coreName/command-status/someId", "GET", NO_BODY); - - assertEquals("requeststatus", v1Params.get(ACTION)); - assertEquals("someId", v1Params.get(REQUESTID)); - } } diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/coreadmin-api.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/coreadmin-api.adoc index 9daedadf701..ae5d4cbd193 100644 --- a/solr/solr-ref-guide/modules/configuration-guide/pages/coreadmin-api.adoc +++ b/solr/solr-ref-guide/modules/configuration-guide/pages/coreadmin-api.adoc @@ -788,8 +788,27 @@ If the `split.key` parameter is specified then only documents having the same ro == REQUESTSTATUS Request the status of an already submitted asynchronous CoreAdmin API call. +-- +[example.tab-pane#v1coreadmin-requeststatus] +==== +[.tab-label]*V1 API* + +[source,bash] +---- +http://localhost:8983/solr/admin/cores?action=REQUESTSTATUS&requestid=id + +---- +==== +[example.tab-pane#v2coreadmin-requeststatus] +==== +[.tab-label]*V2 API* -`admin/cores?action=REQUESTSTATUS&requestid=_id_` +[source,bash] +---- +curl -X GET http://localhost:8983/api/node/commands/id +---- +==== +-- === Core REQUESTSTATUS Parameters