Skip to content

SOLR-18212: Migrate PackageAPI endpoints from @EndPoint/@Command to JAX-RS - #4178

Open
epugh wants to merge 28 commits into
apache:mainfrom
epugh:copilot/migrate-packageapi-to-jax-rs
Open

epugh wants to merge 28 commits into
apache:mainfrom
epugh:copilot/migrate-packageapi-to-jax-rs

Conversation

@epugh

@epugh epugh commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Migrates org.apache.solr.pkg.PackageAPI from Solr's homegrown @EndPoint/@Command dispatch to standard JAX-RS annotations, consistent with other V2 APIs (ClusterFileStore, ZookeeperRead, ClusterProperty).

This has a pretty hefty update to the patterns, but I thought it was better to do it now while v2 api's are "experimental".

New REST endpoints

The command-based POST pattern is replaced with RESTful routes:

Old New
POST /cluster/package {"add": {"package":"p","version":"v","files":[...]}} POST /cluster/package/{name}/versions
POST /cluster/package {"delete": {"pkg":"p","version":"v"}} DELETE /cluster/package/{name}/versions/{version}
POST /cluster/package {"refresh": "name"} POST /cluster/package/{name}/refresh
GET /cluster/package unchanged
GET /cluster/package/{name} unchanged

Key structural changes

  • PackageAPI — new JAX-RS implementation (extends JerseyResource implements PackageApis); replaces the old Edit/Read inner classes (~220 lines removed)
  • PackageStore — renamed from the old PackageAPI; now clearly a ZK data/state holder (Packages, PkgVersion, ZK watcher), not an endpoint class. THIS WAS A BIG REFACTORING
  • solr/api module — new PackageApis.java (JAX-RS interface), PackagesResponse.java, AddPackageVersionRequestBody.java; OAS generation produces PackageApi SolrJ request classes automatically
  • PackageAPITest — integration test using SolrCloudTestCase (ZK required) with generated PackageApi SolrJ request classes
  • TestPackages — updated to use new endpoints; error path changed from /details[0]/errorMessages[0] to /msg
  • package-manager-internals.adoc — updated endpoint reference and curl examples

Copilot AI and others added 8 commits March 1, 2026 13:42
- Replace PackagePayload.AddVersion with AddPackageVersionRequestBody
- Move package name from body to URL: POST /cluster/package/{name}/versions
- Replace delete command pattern with DELETE /cluster/package/{name}/versions/{version}
- Replace refresh command with POST /cluster/package/{name}/refresh
- Update errPath in testAPI from /details[0]/errorMessages[0] to /msg
- Remove all add.pkg assignments (pkg now lives in URL path)
- Replace add.pkg references in verifyComponent() with literal package name strings
- Update import: remove PackagePayload, add AddPackageVersionRequestBody (sorted)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
…sponse.error field

Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
@epugh
epugh marked this pull request as ready for review March 2, 2026 19:36
@gerlowskija

Copy link
Copy Markdown
Contributor

Is there a JIRA ticket associated with this change @epugh?

@epugh

epugh commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

Is there a JIRA ticket associated with this change @epugh?

No, because I viewed it as "just a refactoring and no one will notice....", and that I was hoping there were no debates that would require a JIRA to hash out!

Comment thread changelog/unreleased/migrate-packageapi-to-jax-rs.yml Outdated
authors:
- name: Eric Pugh
links:
- name: PR#4178

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.

[0] Probably worth having a JIRA reference for this guy, even if it's just a tie-back to one of the v2 umbrella tickets? It's changing APIs and stuff, so worth tracking in more than just the PR description I'd imagine.

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.

DOne

Comment thread solr/api/src/java/org/apache/solr/client/api/endpoint/PackageApis.java Outdated
Comment thread solr/core/src/java/org/apache/solr/pkg/ClusterPackage.java Outdated
public int hashCode() {
return Objects.hash(version);
}
final var request =

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.

[Q] Is there a reason you're not using the auto-generated SolrJ type here? We should have one now that the API is JAX-RS!

If this was an intentional decision made to prevent scope-creep, I'm fine with that. Just making sure it's not oversight.

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.

so many places to update... I suspect in the future we need to do a "Check each GSR for fitness" check ;-)

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.

Like I said, I think not doing these bits in the same PR is a totally valid choice. I don't want to add extra steps that'd apply to all these PRs. But since the lines were changed in this PR already I wanted to check that it was an intentional choice is all 🤷

Comment thread solr/core/src/test/org/apache/solr/pkg/PackageAPITest.java Outdated
Comment thread solr/core/src/test/org/apache/solr/pkg/TestPackages.java Outdated
@epugh epugh changed the title Migrate PackageAPI endpoints from @EndPoint/@Command to JAX-RS SOLR-18212: Migrate PackageAPI endpoints from @EndPoint/@Command to JAX-RS Apr 25, 2026
@epugh

epugh commented Apr 25, 2026 •

Copy link
Copy Markdown
Contributor Author

@gerlowskija I think I am ready for another review. I renamed PackageAPI to ClusterPackage to not conflict with PackageApis, but not married to that name! I am updating the spreadsheet.

@github-actions

Copy link
Copy Markdown

This PR has had no activity for 60 days and is now labeled as stale. Any new activity will remove the stale label. To attract more reviewers, please tag people who might be familiar with the code area and/or notify the dev@solr.apache.org mailing list. To exempt this PR from being marked as stale, make it a draft PR or add the label "exempt-stale". If left unattended, this PR will be closed after another 60 days of inactivity. Thank you for your contribution!

@github-actions github-actions Bot added the stale PR not updated in 60 days label Jun 25, 2026
@github-actions

Copy link
Copy Markdown

This PR is now closed due to 60 days of inactivity after being marked as stale. Re-opening this PR is still possible, in which case it will be marked as active again.

@github-actions github-actions Bot added the closed-stale Closed after being stale for 60 days label Aug 25, 2026
@github-actions github-actions Bot closed this Aug 25, 2026

@gerlowskija gerlowskija left a comment

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.

LGTM

@epugh epugh reopened this Aug 28, 2026
@epugh

epugh commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@gerlowskija I reopened this, and will try and give it some love today.. Thanks for the LGTM....

@epugh epugh removed stale PR not updated in 60 days closed-stale Closed after being stale for 60 days labels Aug 28, 2026
@epugh

epugh commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

@gerlowskija this is ready for review!!!!

@epugh
epugh requested a review from gerlowskija August 28, 2026 18:55
@epugh

epugh commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Tests, both unit and itest (bats) pass...

@jaykay12

Copy link
Copy Markdown
Contributor

@epugh I am planning to review this PR, can you make this one ready for review by rebasing with latest main?

@epugh

epugh commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

@jaykay12 I added you as a collaborate to my epugh/solr... which I think lets you push to this repo? I hope this makes it easier as I have a couple of in progress ones you may wan tot pick up!

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.

4 participants