Repository navigation
Conversation
|
@janhoy can please trigger the workflows on this PR? [pending-on-me] test these commands locally with respect to main |
UninstallThis was not being getting tested properly from local, raised bug fix PR: #5052 for the same & continued testing using that patch over main & feature branch.
|
Main renamed the key from 'solr-connection' to 'solr.connection' in apache#5054; EnvUtils maps SOLR_FOO -> solr.foo, so the hyphenated key was never set.
|
The BATS tests fail, not because of this PR but a pre-existing bug, already fixed on main. I'll merge in main here now. |
There was a problem hiding this comment.
🟡 Changes recommended
Connection resolution can mix clusters, and generated documentation displays invalid command syntax.
2 open findings
What changed in this PR
Migrates PackageTool to native picocli subcommands while retaining commons-cli compatibility.
Changes:
- Adds nine package subcommands with shared connection and manager handling.
- Reuses integration tests across both parser paths.
- Adds generated CLI documentation and a changelog entry.
| File | Description |
|---|---|
solr-package.adoc |
Documents the package command. |
solr-package-uninstall.adoc |
Documents uninstall. |
solr-package-undeploy.adoc |
Documents undeploy. |
solr-package-list-installed.adoc |
Documents installed-package listing. |
solr-package-list-deployed.adoc |
Documents deployment listing. |
solr-package-list-available.adoc |
Documents available-package listing. |
solr-package-install.adoc |
Documents installation. |
solr-package-deploy.adoc |
Documents deployment. |
solr-package-add-repo.adoc |
Documents repository addition. |
solr-package-add-key.adoc |
Documents trusted-key addition. |
cli/index.adoc |
Lists migrated package commands. |
deployment-nav.adoc |
Adds package documentation navigation. |
PackageToolTest.java |
Makes tests reusable between parsers. |
PackageToolPicocliTest.java |
Runs shared tests through picocli. |
SolrCLI.java |
Registers PackageTool. |
PackageUninstall.java |
Implements uninstall parsing. |
PackageUndeploy.java |
Implements undeploy parsing. |
PackageTool.java |
Refactors shared package operations. |
PackageSubCommand.java |
Provides shared subcommand wiring. |
PackageListInstalled.java |
Implements installed-package listing. |
PackageListDeployed.java |
Implements deployment listing. |
PackageListAvailable.java |
Implements available-package listing. |
PackageInstall.java |
Implements installation parsing. |
PackageDeploy.java |
Implements deployment parsing. |
PackageAddRepo.java |
Implements repository addition. |
PackageAddKey.java |
Implements trusted-key addition. |
ConnectionOptions.java |
Adds package connection resolution. |
SOLR-18515-package-tool-picocli.yml |
Records the migration. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| |xref:cli/solr-package-add-key.adoc[bin/solr package add key] | ||
| |xref:cli/solr-package-add-repo.adoc[bin/solr package add repo] | ||
| |xref:cli/solr-package-deploy.adoc[bin/solr package deploy] | ||
| |xref:cli/solr-package-install.adoc[bin/solr package install] | ||
| |xref:cli/solr-package-list-available.adoc[bin/solr package list available] |
There was a problem hiding this comment.
@janhoy will that be okay, if i take this up in a follow-up PR?
delta changes here will be clearly visible in the evidences of that PR. That PR will follow-up immediately once this is merged.
# Conflicts: # changelog/unreleased/SOLR-17697-picocli-experimental-cli.yml # solr/core/src/java/org/apache/solr/cli/SolrCLI.java # solr/solr-ref-guide/modules/deployment-guide/deployment-nav.adoc # solr/solr-ref-guide/modules/deployment-guide/pages/cli/index.adoc
janhoy
left a comment
There was a problem hiding this comment.
I merged latest main into the branch to resolve the conflicts with the other picocli ports. Running the full org.apache.solr.cli.* test package turned up one real problem, and a convention pass against the already-merged ports turned up a few more. Details below.
Flaky failure in PackageToolPicocliTest.testPackageTool
PackageToolPicocliTest fails roughly a third of the time (e.g. -Ptests.seed=CE8CB19A405A7699 fails ~3 of 4 runs), while PackageToolTest passes with the same seed. The failing step is the second install question-answer in the random "auto-update to latest" branch, which returns exit code 1 with Failed verification after deployment.
Root cause is a pre-existing race that the commons-cli tool masked: RepositoryManager.install verifies the $LATEST-pegged collections immediately after installing the new version, a few milliseconds before the nodes have reloaded the package, so verify sees Actual: 1.0.0, expected: 1.1.0. The old PackageTool.install() was void, so the legacy path printed installation failed and still exited 0. Your PackageInstall correctly propagates the result, which is the right behavior, but it exposes the race.
I think the fix belongs in RepositoryManager.install: retry the post-install verification with a bounded wait (the reload is asynchronous by design) instead of verifying once. Happy to discuss if you see a better option. Note that testDeployValidationMessages creating validation-test on conf1 also makes it share PKG_VERSIONS with abc, so list-deployed reports it as deployed; isolating it on its own configset is a small tidy-up but does not fix the race on its own.
Turns out this is far from a flaky test. It's a race condition with zk watches. My plan is to let Claude make a fix, apply it, merge this to main and then let @jaykay12 handle follow-ups along with the pre-existing |
A node answering a /cluster/package?expectedVersion=N request could report itself in sync as soon as its ZK watcher had bumped the packages.json version, while that watcher thread was still building the classloader for the new version and reloading plugins. A client that installed a new version and then verified collections pegged to $LATEST could therefore observe the old version. Only the exit code of the commons-cli package tool hid this, since it ignored the install result; the picocli port propagates it. Make SolrPackageLoader.refreshPackageConf() and notifyListeners() synchronized and have syncToVersion always go through refreshPackageConf(), so both the version sync and the explicit refresh command block until any in-flight application of the new packages.json has completed.
testDeployValidationMessages created validation-test on conf1, shared with abc, so a deploy to abc also showed up as a deployment on validation-test through the shared PKG_VERSIONS params. Use a dedicated configset so the two test methods do not influence each other.
|
🤖 Bug fix and pr comment below written by Claude Fable Flaky
|








































Description
Implementing PicoCLI for the PackageTool
Past PR for reference (some code review took place here) - #4739
Solution
Used Prompt provided in the Jira & got initial migration done by Cursor.
Majoryly, common code which was being used in the commons-cli call path, which could be used in picocli as well, is being refactored to private functions.
#4739 (comment)
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:
mainbranch../gradlew check.