Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
acccb16
initial changes
jaykay12 May 15, 2026
e426014
testing
jaykay12 May 16, 2026
7b15791
working api
jaykay12 May 16, 2026
02c14b9
working setup
jaykay12 May 16, 2026
177d2c6
cleanup
jaykay12 May 16, 2026
95ace8d
cleanup
jaykay12 May 16, 2026
7dc167a
logging
jaykay12 May 16, 2026
1a32bb1
minor
jaykay12 May 16, 2026
6b6f536
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 May 19, 2026
d746e21
response model for 2nd API
jaykay12 May 19, 2026
df5c428
verifies for solr cloud
jaykay12 May 19, 2026
354d0f5
changes related to pojo & duplicate code removal
jaykay12 May 20, 2026
1cad09d
removed older interfaces
jaykay12 May 20, 2026
579925d
removing debug
jaykay12 May 20, 2026
eb1cd97
done
jaykay12 May 20, 2026
4e10720
self review
jaykay12 May 20, 2026
eb9b51b
added cl
jaykay12 May 20, 2026
adc7006
tidying done
jaykay12 May 20, 2026
996b45b
added apache license
jaykay12 May 20, 2026
f6cb8f7
tests
jaykay12 May 22, 2026
97e5afa
added 1 test
jaykay12 May 23, 2026
3d72214
added license
jaykay12 May 23, 2026
68eec35
test corrections
jaykay12 May 24, 2026
87204e2
minor tidy
jaykay12 May 24, 2026
930312b
test to check actual active/inactive
jaykay12 May 24, 2026
ba79375
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 May 28, 2026
199cb24
comments addressal
jaykay12 May 28, 2026
24ca810
comments addressed
jaykay12 May 28, 2026
c583c38
tidying it up
jaykay12 May 28, 2026
bb0f0f1
comments addressed
jaykay12 May 29, 2026
d0ddec6
tidy up
jaykay12 May 29, 2026
0905202
update
jaykay12 May 29, 2026
d08d788
minor
jaykay12 May 29, 2026
1b0b81d
Remove "breadcrumb" pointer, we only do it in one other place.
epugh May 29, 2026
200afba
checking
jaykay12 May 29, 2026
cd97aa6
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 2, 2026
d161485
this works
jaykay12 Jun 2, 2026
12e0a9c
commenting the remaining code & related tests for now
jaykay12 Jun 2, 2026
8132972
Fix the path structure, nesting didn't work.
epugh Jun 3, 2026
dc5db45
Merge branch 'SOLR-18248-list-tasks' of https://github.com/jaykay12/s…
epugh Jun 3, 2026
02ecda9
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 9, 2026
a8beb53
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 14, 2026
6c3ed49
removed commented code
jaykay12 Jun 14, 2026
1a6c5e3
pr ready again
jaykay12 Jun 14, 2026
4b16add
tidy up
jaykay12 Jun 14, 2026
96ad4f4
added license
jaykay12 Jun 14, 2026
6133beb
tidy forced
jaykay12 Jun 14, 2026
5d0d2ce
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 18, 2026
c85327f
fixed response format v1-list api
jaykay12 Jun 18, 2026
e128b41
changes in response of v1 api
jaykay12 Jun 18, 2026
1b67fe2
Test that demonstrates cross shard task status visibility works on main.
epugh Jun 21, 2026
4ba15e4
Merge branch 'SOLR-18248-list-tasks' of https://github.com/jaykay12/s…
epugh Jun 21, 2026
1675c4f
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 21, 2026
f0896f8
Merge branch 'SOLR-18248-list-tasks' of github.com:jaykay12/solr into…
jaykay12 Jun 21, 2026
2286146
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 23, 2026
eacf2f6
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 25, 2026
a87890f
changes
jaykay12 Jun 28, 2026
feffde3
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 28, 2026
06363ad
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jun 29, 2026
6922c3e
changes
jaykay12 Jun 29, 2026
1ae020e
tidying up
jaykay12 Jun 29, 2026
9efe214
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jul 1, 2026
ce41531
Merge branch 'main' into SOLR-18248-list-tasks
jaykay12 Jul 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog/unreleased/SOLR-18248-list-tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Migrated ListTasks API & TaskStatus API from homegrown @EndPoint to JAX-RS
type: added
authors:
- name: Jalaz Kumar
- name: Eric Pugh
links:
- name: SOLR-18248
url: https://issues.apache.org/jira/browse/SOLR-18248

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am expecting a DELETE /tasks/{taskId} for cancelling a running task. Or... we need a PATCH that does the cancel PATCH /tasks/{taskId}/cancel

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in this PR scope, #4452 (comment) took only 2 out of 3 API related to Tasks.

Cancel Running task API migration will be a follow-up, independent PR of itself.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Smart!

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 static org.apache.solr.client.api.util.Constants.INDEX_PATH_PREFIX;

import io.swagger.v3.oas.annotations.Operation;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import org.apache.solr.client.api.model.ListActiveTaskResponse;
import org.apache.solr.client.api.model.TaskStatusResponse;
import org.apache.solr.client.api.util.StoreApiParameters;

@Path(INDEX_PATH_PREFIX + "/tasks")
public interface TasksApi {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!


@GET
@StoreApiParameters
@Operation(
summary = "Lists all the active tasks",
tags = {"tasks"})
ListActiveTaskResponse listAllActiveTasks() throws Exception;

@GET
@Path("/{taskID}")
@StoreApiParameters
@Operation(
summary = "Status of a specific task",
tags = {"tasks"})
TaskStatusResponse getTaskStatus(@PathParam("taskID") String taskID) throws Exception;
}
Original file line number Diff line number Diff line change
@@ -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.model;

import com.fasterxml.jackson.annotation.JsonProperty;

public class ActiveTaskDetails {

public ActiveTaskDetails() {}

public ActiveTaskDetails(String taskID, String taskQuery) {
this.taskID = taskID;
this.taskQuery = taskQuery;
}

@JsonProperty public String taskID;
@JsonProperty public String taskQuery;
}
Original file line number Diff line number Diff line change
@@ -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 ListActiveTaskResponse extends SolrJerseyResponse {
@JsonProperty public List<ActiveTaskDetails> taskList;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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 TaskStatusResponse extends SolrJerseyResponse {

public enum TaskStatus {
ACTIVE("active"),
INACTIVE("inactive");

private final String value;

TaskStatus(String value) {
this.value = value;
}

public String getValue() {
return this.value;
}
}

@JsonProperty public TaskStatus taskStatus;
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
* specify the acceptable generation lag follower should be with respect to its leader using the
* <code>maxGenerationLag=&lt;max_generation_lag&gt;</code> request parameter. If <code>
* maxGenerationLag</code> is not provided then health check would simply return OK.
*
* <p>All health-check logic lives in the v2 {@link NodeHealth}; this handler is a thin v1 bridge
* that extracts request parameters and delegates.
*/
public class HealthCheckHandler extends RequestHandlerBase {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* 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 java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.solr.api.JerseyResource;
import org.apache.solr.client.api.endpoint.TasksApi;
import org.apache.solr.client.api.model.ActiveTaskDetails;
import org.apache.solr.client.api.model.ListActiveTaskResponse;
import org.apache.solr.client.api.model.TaskStatusResponse;
import org.apache.solr.handler.component.ActiveTaskQuerySupport;
import org.apache.solr.jersey.PermissionName;
import org.apache.solr.request.SolrQueryRequest;

public class ActiveTask extends JerseyResource implements TasksApi {

private final SolrQueryRequest solrQueryRequest;

@Inject
public ActiveTask(SolrQueryRequest solrQueryRequest) {
this.solrQueryRequest = solrQueryRequest;
}

@Override
@PermissionName(READ_PERM)
public ListActiveTaskResponse listAllActiveTasks() throws Exception {
final ListActiveTaskResponse response = instantiateJerseyResponse(ListActiveTaskResponse.class);
response.taskList = ActiveTaskQuerySupport.listActiveTasks(solrQueryRequest);
return response;
}

@Override
@PermissionName(READ_PERM)
public TaskStatusResponse getTaskStatus(String taskID) throws Exception {
final TaskStatusResponse response = instantiateJerseyResponse(TaskStatusResponse.class);

boolean isTaskActive = ActiveTaskQuerySupport.isTaskActive(solrQueryRequest, taskID);

response.taskStatus =
(isTaskActive)
? TaskStatusResponse.TaskStatus.ACTIVE
: TaskStatusResponse.TaskStatus.INACTIVE;

return response;
}

public static List<ActiveTaskDetails> getActiveTasksOnThisShard(
SolrQueryRequest solrQueryRequest) {
Iterator<Map.Entry<String, String>> iterator =
solrQueryRequest.getCore().getCancellableQueryTracker().getActiveQueriesGenerated();

List<ActiveTaskDetails> activeTaskDetails = new ArrayList<>();
while (iterator.hasNext()) {
Map.Entry<String, String> entry = iterator.next();
activeTaskDetails.add(new ActiveTaskDetails(entry.getKey(), entry.getValue()));
}

return activeTaskDetails;
}

public static boolean isTaskActiveOnThisShard(SolrQueryRequest solrQueryRequest, String taskId) {
return solrQueryRequest.getCore().getCancellableQueryTracker().isQueryIdActive(taskId);
}
}

This file was deleted.

Loading