-
Notifications
You must be signed in to change notification settings - Fork 860
SOLR-18248: Migration of CancelTask V2 API to JAX-RS construct #4828
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
Open
jaykay12
wants to merge
85
commits into
apache:main
Choose a base branch
from
jaykay12:SOLR-18248-cancel-tasks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
acccb16
initial changes
jaykay12 e426014
testing
jaykay12 7b15791
working api
jaykay12 02c14b9
working setup
jaykay12 177d2c6
cleanup
jaykay12 95ace8d
cleanup
jaykay12 7dc167a
logging
jaykay12 1a32bb1
minor
jaykay12 6b6f536
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 d746e21
response model for 2nd API
jaykay12 df5c428
verifies for solr cloud
jaykay12 354d0f5
changes related to pojo & duplicate code removal
jaykay12 1cad09d
removed older interfaces
jaykay12 579925d
removing debug
jaykay12 eb1cd97
done
jaykay12 4e10720
self review
jaykay12 eb9b51b
added cl
jaykay12 adc7006
tidying done
jaykay12 996b45b
added apache license
jaykay12 f6cb8f7
tests
jaykay12 97e5afa
added 1 test
jaykay12 3d72214
added license
jaykay12 68eec35
test corrections
jaykay12 87204e2
minor tidy
jaykay12 930312b
test to check actual active/inactive
jaykay12 ba79375
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 199cb24
comments addressal
jaykay12 24ca810
comments addressed
jaykay12 c583c38
tidying it up
jaykay12 bb0f0f1
comments addressed
jaykay12 d0ddec6
tidy up
jaykay12 0905202
update
jaykay12 d08d788
minor
jaykay12 1b0b81d
Remove "breadcrumb" pointer, we only do it in one other place.
epugh 200afba
checking
jaykay12 cd97aa6
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 d161485
this works
jaykay12 12e0a9c
commenting the remaining code & related tests for now
jaykay12 02ecda9
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 a8beb53
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 6c3ed49
removed commented code
jaykay12 1a6c5e3
pr ready again
jaykay12 4b16add
tidy up
jaykay12 96ad4f4
added license
jaykay12 6133beb
tidy forced
jaykay12 5d0d2ce
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 c85327f
fixed response format v1-list api
jaykay12 e128b41
changes in response of v1 api
jaykay12 6ee9400
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 a459177
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 1646d49
cl
jaykay12 775e6c8
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 035875e
cl
jaykay12 a0843da
contract
jaykay12 bc30205
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 a8a5e1d
changes
jaykay12 d4721e5
changes
jaykay12 e4e2ac1
minimal file
jaykay12 20a1f77
changes
jaykay12 b68dd6c
added licenses
jaykay12 f625a4c
tidy up
jaykay12 df41eee
response code
jaykay12 18de48a
cleanup
jaykay12 f6019e6
fixed tests
jaykay12 6f1dfac
test fixed
jaykay12 f56c06f
Add a unit test demonstrating 404 not working
epugh 8f5112a
tests fixed
jaykay12 b50d552
tidying up
jaykay12 cc6f788
eric as author
jaykay12 b5dbd12
ref guide
jaykay12 adf3379
Connect task management to the query params page better.
epugh 57e8316
simplify the text, and get away from weird "UUID" term everywhere.
epugh 149e1cf
components was dead code before, so remove it now.
epugh 2271766
Need seperate documentation for v1 and v2 responses.
epugh b8520ed
Maybe a bit heavy, but since we don't want to change the output forma…
epugh a31604f
adding more tests...
epugh 75ca730
Javadocs don't need to restart java code paths. Keep them focused.
epugh 832293f
Reduce our dependency on SolrTestCaseJ4
epugh f56cd9d
javadocs!
epugh f2f646d
one more turn of crank
epugh a5d21c4
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 a28d8e0
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 70c3a57
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 8b6a562
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 b55ee10
Merge branch 'main' into SOLR-18248-cancel-tasks
jaykay12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| title: | ||
| Migration of CancelTask V2 API to JAX-RS construct | ||
| type: changed | ||
| authors: | ||
| - name: Jalaz Kumar | ||
| - name: Eric Pugh | ||
| links: | ||
| - name: SOLR-18248 | ||
| url: https://issues.apache.org/jira/browse/SOLR-18248 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
solr/api/src/java/org/apache/solr/client/api/model/CancelTaskResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** Response body returned after a task cancellation request. */ | ||
| public class CancelTaskResponse extends SolrJerseyResponse { | ||
|
|
||
| public enum CancellationStatus { | ||
| SUCCESS, | ||
| NOT_FOUND | ||
| } | ||
|
|
||
| @JsonProperty public CancelTaskResponse.CancellationStatus status; | ||
| } |
68 changes: 68 additions & 0 deletions
68
solr/core/src/java/org/apache/solr/handler/admin/api/CancelTask.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * 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.security.PermissionNameProvider.Name.READ_PERM; | ||
|
|
||
| import jakarta.inject.Inject; | ||
| import org.apache.solr.api.JerseyResource; | ||
| import org.apache.solr.client.api.endpoint.TasksApi; | ||
| import org.apache.solr.client.api.model.CancelTaskResponse; | ||
| import org.apache.solr.common.SolrException; | ||
| import org.apache.solr.handler.component.ActiveTaskQuerySupport; | ||
| import org.apache.solr.jersey.PermissionName; | ||
| import org.apache.solr.request.SolrQueryRequest; | ||
| import org.apache.solr.search.CancellableCollector; | ||
|
|
||
| /** V2 API implementation for cancelling an active task. */ | ||
| public class CancelTask extends JerseyResource implements TasksApi.Cancel { | ||
|
|
||
| private final SolrQueryRequest solrQueryRequest; | ||
|
|
||
| @Inject | ||
| public CancelTask(SolrQueryRequest solrQueryRequest) { | ||
| this.solrQueryRequest = solrQueryRequest; | ||
| } | ||
|
|
||
| @Override | ||
| @PermissionName(READ_PERM) | ||
| public CancelTaskResponse cancelRunningTask(String taskID) throws Exception { | ||
| final CancelTaskResponse response = instantiateJerseyResponse(CancelTaskResponse.class); | ||
|
|
||
| boolean isTaskCancelled = ActiveTaskQuerySupport.cancelTask(solrQueryRequest, taskID); | ||
|
|
||
| if (isTaskCancelled) { | ||
| response.status = CancelTaskResponse.CancellationStatus.SUCCESS; | ||
| return response; | ||
| } | ||
| response.status = CancelTaskResponse.CancellationStatus.NOT_FOUND; | ||
| throw new SolrException( | ||
| SolrException.ErrorCode.NOT_FOUND, "Task with ID '" + taskID + "' not found"); | ||
| } | ||
|
|
||
| public static boolean cancelTaskActiveOnThisShard( | ||
| SolrQueryRequest solrQueryRequest, String taskId) { | ||
| CancellableCollector cancellableTask = | ||
| solrQueryRequest.getCore().getCancellableQueryTracker().getCancellableTask(taskId); | ||
| if (cancellableTask != null) { | ||
| cancellableTask.cancel(); | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
| } | ||
48 changes: 0 additions & 48 deletions
48
solr/core/src/java/org/apache/solr/handler/admin/api/CancelTaskAPI.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.