gerlowskija commented on code in PR #2144: URL: https://github.com/apache/solr/pull/2144#discussion_r1439737702
########## solr/CHANGES.txt: ########## @@ -124,6 +124,9 @@ Improvements * SOLR-17063: Do not retain log param references in LogWatcher (Michael Gibney) +* SOLR-16397: The command-status v2 endpoint has been updated to be more REST-ful. Review Comment: [0] Solr has a similar API for requesting the status of collection level operations, so it might be worth clarifying here which one was updated. ########## solr/api/src/java/org/apache/solr/client/api/endpoint/RequestCoreCommandStatusApi.java: ########## @@ -0,0 +1,51 @@ +/* + * 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.SolrJerseyResponse; + +/** + * V2 API for checking the status of a core-level asynchronous command. + * + * <p>This API (GET /api/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.api.model.RequestCoreCommandStatusResponseBody + */ +@Path("/cores/command-status/") Review Comment: [-1] Hmmm, I don't think this API path will work - its ambiguous with other Solr APIs e.g. `/cores/command-status/select` could either be an attempt to lookup the status of a core-level operation that used "select" as its async-id, or it could be an attempt to query the data in a core called "command-status". ---- I have some reservations about the existing path for this API (e.g. `/cores/myCore/command-status/123`), which avoids the ambiguity by requiring a specific core name. But maybe we should just keep the core name in the path here to avoid the ambiguity. Or maybe someone else can think up a third option that avoids the ambiguity while saving us from needing to provide a path-param that may not always make sense... Wdyt? ########## solr/api/src/java/org/apache/solr/client/api/endpoint/RequestCoreCommandStatusApi.java: ########## @@ -0,0 +1,51 @@ +/* + * 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.SolrJerseyResponse; + +/** + * V2 API for checking the status of a core-level asynchronous command. + * + * <p>This API (GET /api/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 Review Comment: [+1] This is a great call-out. ########## solr/core/src/test/org/apache/solr/handler/admin/api/RequestCoreCommandStatusTest.java: ########## @@ -0,0 +1,164 @@ +/* + * 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.http.HttpStatus.SC_OK; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Map; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.Response; +import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.core.CoreContainer; +import org.apache.solr.handler.admin.CoreAdminHandler; +import org.apache.solr.jersey.InjectionFactories; +import org.apache.solr.jersey.SolrJacksonMapper; +import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.response.SolrQueryResponse; +import org.glassfish.hk2.api.Factory; +import org.glassfish.hk2.utilities.binding.AbstractBinder; +import org.glassfish.jersey.process.internal.RequestScoped; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.junit.BeforeClass; +import org.junit.Test; + +/** Test for {@link RequestCoreCommandStatus}. */ +public class RequestCoreCommandStatusTest extends JerseyTest { Review Comment: [-0] I can't recall right now, but in a prior PR I ran into an issue with how Solr's test-framework ran JerseyTest-based test classes. Let me dig into this a bit more to try to remember what the issue was, but we _might_ have to restructure this to be more of a pure unit test like you wrote in #2128 ########## solr/api/src/java/org/apache/solr/client/api/endpoint/RequestCoreCommandStatusApi.java: ########## @@ -0,0 +1,51 @@ +/* + * 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.SolrJerseyResponse; + +/** + * V2 API for checking the status of a core-level asynchronous command. + * + * <p>This API (GET /api/cores/command-status/someId is analogous to the v1 Review Comment: [0] Missing ')' after "someId" -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org