Skip to content

SOLR-17731: Fix shadowed v2 alias and snapshot APIs - #5353

Merged
epugh merged 9 commits into
apache:mainfrom
epugh:SOLR-17731
Nov 22, 2026
Merged

epugh merged 9 commits into
apache:mainfrom
epugh:SOLR-17731

Conversation

@epugh

@epugh epugh commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Description

The DELETE resource paths shadow GET /api/aliases/{aliasName} and POST /api/collections/{collName}/snapshots/{snapshotName}, causing valid requests to return HTTP 405. This PR restores both routes and brings the alias and collection snapshot APIs into line with the v2 conventions.

Solution

  • Align the class-level resource roots and move resource names to method-level paths, preserving the public URLs.
  • Reuse GetAliasByNameResponse for each entry in the v2 alias listing. Entries now contain name, a collections array, and properties, matching the detail response. Update the Admin UI to consume this structure and preserve the v1 LISTALIASES response format.
  • Introduce typed collection snapshot metadata, including replica details and creation time in epoch milliseconds. Use the narrower synchronous listing response base and include CREATE response fields consistently in JSON, XML, and Javabin.
  • Return HTTP 404 for missing aliases, collections, and snapshots, and HTTP 400 for a missing snapshot creation body. Preserve the v1 snapshot collection error codes, missing-snapshot deletion no-op, and listing format in the adapters.
  • Migrate bin/solr snapshot create, delete, list, and describe to the generated v2 clients. Use typed metadata directly when describing a snapshot, removing the legacy response parsing.
  • Update the reference guide examples and API conventions documentation.

Implementation and test development assisted by Claude and Codex.

Tests

Validation performed during development:

  • Generated-client HTTP tests for alias and collection snapshot APIs, covering routing, response data, missing resources, alias resolution, v1 compatibility, and snapshot XML/Javabin responses.
  • Snapshot CLI tests through both parsers: 10 passing tests after the final cleanup.
  • AdminUiCollectionsScreenTest: 7 passing Selenium tests, including alias collections and properties.
  • ./gradlew tidy
  • ./gradlew check -x test
  • ./gradlew :solr:packaging:devFull

The snapshot BATS suite has not been run.

…e the same structure as the detail.

Nice bit of clean up!
@github-actions github-actions Bot added documentation Improvements or additions to documentation admin-ui tests cat:api labels Nov 16, 2026
@github-actions

Copy link
Copy Markdown

Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).

  • ✅ Jira issue in title: already present
  • ⚠️ Changelog — missing (suggest type: fixed): The PR fixes a bug where the detailed alias view was not working and the list-all endpoint used an inconsistent JSON structure, which are user-visible issues in the V2 API and UI.​
  • ❔ Reference Guide update: Unclear; please assess.
  • ❔ Upgrade notes: Unclear; please assess.
  • ❔ Tests: Unclear; please assess.

@epugh epugh changed the title SOLR-17731: Listing of detailed alias was not working, and the list all didnt' use the same structure as the detail. SOLR-17731: Fix shadowed v2 alias and snapshot APIs Nov 17, 2026
@epugh

epugh commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

@jaykay12 woudn't mind a review of these changes.... I suspect there are other older v2 apis that don't do the list versus detail view properly ;-(

}

@Test
public void testDeleteMissingSnapshot() throws Exception {

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.

🤖 AI text below 🤖

Should deleting a missing snapshot remain a no-op for the CLI? It succeeded idempotently on v1. After this change the v2 404 prints “Failed,” but the command still exits 0. This test explicitly enforces both because run() requires exit 0. I’d preserve the CLI’s no-op for an already absent snapshot. If we want to make it a CLI error instead, the test should require a nonzero exit status.

}

@Test
public void testCreateListAndDeleteSnapshot() throws Exception {

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.

🤖 AI text below 🤖

Could we keep an async-create assertion in the new HTTP tests? The removed unit test checked that the body’s async ID reached the collection command; the replacement cases all submit synchronously. A generated-client test could assert the returned request ID, wait for terminal success via REQUESTSTATUS, and then check that the snapshot appears in the listing.

@epugh epugh added this to the 10.x milestone Nov 22, 2026
@epugh
epugh merged commit e997ae8 into apache:main Nov 22, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants