Skip to content

SOLR-18518: Port the snapshot commands to picocli - #5044

Merged
janhoy merged 8 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18518-picocli-snapshot
Oct 8, 2026
Merged

janhoy merged 8 commits into
apache:mainfrom
serhiy-bzhezytskyy:SOLR-18518-picocli-snapshot

Conversation

@serhiy-bzhezytskyy

@serhiy-bzhezytskyy serhiy-bzhezytskyy commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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

Description

Adds the picocli code path for the snapshot commands, as bin/solr snapshot <sub-command>, next to the commons-cli one.

Solution

snapshot is a sub-command group with create, delete, describe, export and list; -c and --snapshot-name come from two small mixins. The five snapshot-* spellings stay as hidden shims, deprecated since 10.2 and removed in 11.0, and an upgrade note says so. The commons-cli path is unchanged. Written with Claude Code.

Tests

SnapshotToolsPicocliTest runs create, list, describe and delete through the new sub-commands and checks that the old spellings still work, are hidden and are deprecated. SnapshotExportToolPicocliTest runs the export tests through snapshot export. check -x test is clean (rat skipped).

Checklist

  • 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

Adds the picocli code path next to the commons-cli one for snapshot-create, -delete, -describe, -export and -list, with test twins and the generated reference pages. The page generator now takes a command's hyphenated name from the pages that exist rather than from splitting the file name, so these are not titled "snapshot create".
@github-actions github-actions Bot added documentation Improvements or additions to documentation tool:build tests cat:cli labels Oct 6, 2026

@janhoy janhoy 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.

This implementation does not do what the JIRA prescribes, i.e. splitting into sub-commands and keeping the flat commands as shims only. Please re-read the JIRA

…den shims

The JIRA asks for bin/solr snapshot <sub-command>, with the five flat
spellings only as deprecated, hidden shims and an upgrade note. The flat
commands became sub-commands of a snapshot group, the old spellings extend
them, and the page generator change is no longer needed.
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

Re-read the JIRA and reworked it: bin/solr snapshot <create|delete|describe|export|list> is now a sub-command group with a shared mixin for -c and --snapshot-name, and the five snapshot-* spellings are hidden @Deprecated(since = "11.0") shims that run the same code. The upgrade note is in major-changes-in-solr-11.adoc and the changelog entry says the same. I took 11.0 and "removed in 12" from baseVersion on main; if this is meant for 10.2, the version in the shims and the page of the note change.

@janhoy janhoy 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.

Nice work. Some comments...

Comment thread solr/core/src/java/org/apache/solr/cli/SnapshotCreateShim.java Outdated
Comment thread solr/core/src/java/org/apache/solr/cli/SnapshotCreateShim.java Outdated
Comment thread solr/core/src/test/org/apache/solr/cli/SnapshotToolsPicocliTest.java Outdated
Comment thread solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc Outdated
Comment thread solr/core/src/java/org/apache/solr/cli/SnapshotExportTool.java Outdated
Comment thread changelog/unreleased/SOLR-18518-picocli-snapshot.yml Outdated
No picocli feature has been released yet, so a new command is a detail of the SOLR-17697 entry. Its author and JIRA are added there instead of a separate entry.
…ey run

The change lands in 10.2, so the shims are deprecated since 10.2 and removed in 11.0, and the upgrade note moves to the 10.2 section of major-changes-in-solr-10.adoc. A shim logs one deprecation notice naming the new command, because it is otherwise silent. --backup-repo-name takes a repository name, which the synopsis now shows.
@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor Author

Done in f7b468e: the shims are since = "10.2" and log a one-time notice through DeprecationLog, the upgrade note moved to the 10.2 section of major-changes-in-solr-10.adoc (deprecated in 10.2, removed in 11.0), --backup-repo-name shows NAME, and the test follows. I marked testOldSpellingsAreHiddenAndDeprecated @Deprecated so that it goes with the shims; if you meant something else, tell me.

serhiy-bzhezytskyy and others added 4 commits October 7, 2026 18:07
EnvUtils maps the SOLR_CONNECTION environment variable to solr.connection, so the solr-connection key the shared connection lookup of the snapshot commands read could never be set. The picocli path now reads the right key, which a test covers, and the zkHost test drops its own property cleanup because the base class restores properties.
…snapshot

# Conflicts:
#	changelog/unreleased/SOLR-17697-picocli-experimental-cli.yml
#	solr/core/src/java/org/apache/solr/cli/SolrCLI.java
@janhoy janhoy added this to the 10.x milestone Oct 8, 2026
@janhoy
janhoy merged commit ef23d0f into apache:main Oct 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:cli documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants