Skip to content

SOLR-18248 : Migration of Tasks V2 APIs to JAX-RS Constructs#4452

Open
jaykay12 wants to merge 19 commits into
apache:mainfrom
jaykay12:SOLR-18248-list-tasks
Open

SOLR-18248 : Migration of Tasks V2 APIs to JAX-RS Constructs#4452
jaykay12 wants to merge 19 commits into
apache:mainfrom
jaykay12:SOLR-18248-list-tasks

Conversation

@jaykay12
Copy link
Copy Markdown
Contributor

@jaykay12 jaykay12 commented May 19, 2026

https://issues.apache.org/jira/browse/SOLR-18248

Description

Migrating 2 out of the 3 V2 APIs of Tasks, from existing homegrown annotations to JAX-RS Standard constructs & annotations

  1. List Tasks API
  2. Task Status API

Solution

  1. Have exposed 1 new interface: ListActiveTasksApi which serves the /lists/task as well as /list/task/<taskId> endpoints.

  2. ListActiveTasks is the main class which takes on the responsibility for v2 path as well as also for the v1 api path via ActiveTasksListHandler

  3. 2 new DTO for List Task API

  4. 1 new DTO for Task Status API

  5. Removed the now deprecated files: ListActiveTasksAPI & ActiveTasksListComponent from the codebase.

No Coding Agent used.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

@jaykay12 jaykay12 changed the title [SOLR-18248] | Migration of ListAllTasks & SingleTaskStatus V2 APIs to JAX-RS Constructs SOLR-18248 : Migration of Tasks V2 APIs to JAX-RS Constructs May 19, 2026

import static org.apache.solr.client.api.util.Constants.INDEX_PATH_PREFIX;

@Path(INDEX_PATH_PREFIX + "/tasks/listjalaz")
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.

;-) Look slike you have some debugging?

Copy link
Copy Markdown
Contributor Author

@jaykay12 jaykay12 May 19, 2026

Choose a reason for hiding this comment

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

yeah, started with firstly wiring this api to give any random response, & now using this to compare my V2 response with the original V2 response, 😄 thus, kept a different api endpoint for now to do response comparision.

will surely update this during self-review before raising for formal review 💯

Copy link
Copy Markdown
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

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

Thanks for getting started on this, I went ahead and put some comments in that may be too early to be added ;-)

@GET
@StoreApiParameters
@Operation(
summary = "Lists all the currently running tasks or status of any taskUUID being passed as queryParam",
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.

So, I think we would revamp this api... if you look at the desired api, ListActiveTasks would just list all tasks. If you wanted a specfific task, then it would be a idfferent end point with a /taskUUID.

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, have updated this Api class for now, handling the taskUUID as a path param now, it was queryParam in the V1 as well as homegrown v2.


public class ListActiveTaskResponse extends SolrJerseyResponse {
@JsonProperty
public Map<String, String> taskList;
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.

We are trying to move to more strongly typed responses so taht we don't have Map everywhere. Go ahead and specify out the return properties!

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, have done so.


}

private void handleStandAloneMode(ListActiveTaskResponse response, String taskUUID) {
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.

One thing we are trying to do is move the V1 API logic into the V2 code base, and have the V1 call the V2 version, this way, as these apis evolve, we know that v1 and v2 stay in sync till we get rid of V1. I believe that ideally we would want ActiveTasksListComponent to delegate to the same code as this V2 api. Now, maybe it's so simple that both can just call core getCancellableQueryTracker().getActiveQueriesGenerated. In other V2 apis, you can see the code live in the V2 and then V1 calls it...

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.

understood this part, have made suitable changes.

log.debug("solr cloud");
}
handleSolrCloudMode(response, taskUUID);
} else {
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.

not quite sure I see the differences in the two paths yet?

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.

yea, i am also checking this up.
I have tested this endpoint by running on cloud example which we have in examples, it worked fine. It should work fine for standalone as well, will remove the current conditional branching done once that's verified.

@jaykay12
Copy link
Copy Markdown
Contributor Author

Thanks for getting started on this, I went ahead and put some comments in that may be too early to be added ;-)

thank you so much @epugh for the prompt reviews & initial guidance, much appreciated.

I will keep addressing your comments as we go, I kept this PR as draft for now as per our community guidelines, but yea thanks again for reviewing this at such initial state, so that i can course correct myself promptly. ✨

Copy link
Copy Markdown
Contributor Author

@jaykay12 jaykay12 left a comment

Choose a reason for hiding this comment

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

self review ✅

[pending] to add tests.

@jaykay12 jaykay12 marked this pull request as ready for review May 20, 2026 22:33
@jaykay12 jaykay12 requested a review from epugh May 20, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants