Skip to content

SOLR-18432: SolrVersion tolerates prerelease qualifier - #5254

Merged
dsmiley merged 3 commits into
apache:mainfrom
dsmiley:SOLR-18432-solrversion-prerelease
Oct 29, 2026
Merged

dsmiley merged 3 commits into
apache:mainfrom
dsmiley:SOLR-18432-solrversion-prerelease

Conversation

@dsmiley

@dsmiley dsmiley commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

🤖 https://issues.apache.org/jira/browse/SOLR-18432

SolrVersion and its callers don't tolerate a prerelease qualifier such as -SNAPSHOT, which blocks making LATEST_STRING match the build version. This fixes the three breakages first:

  • SolrVersion.satisfies() now evaluates on the version with the prerelease cleared (semver4j otherwise rejects every range for a prerelease), and a new withoutPrerelease() is added. This unblocks PackageManager's constraint check. compareTo/equals stay strict semver.
  • ZkController.checkClusterVersionCompatibility compares versions without the prerelease, so a dev node is not reported as older than a released node of the same x.y.z. Log and exception messages still print full versions.
  • SystemInfoProvider falls back to LATEST_STRING rather than LATEST.getPrereleaseVersion() for solrImplVersion.

Whether LATEST_STRING should be generated from the Gradle version is left for a follow-up.

🤖 Generated with Claude Code

- satisfies() ignores the prerelease qualifier; add withoutPrerelease()
- ZkController version-compat check compares without prerelease
- SystemInfoProvider solrImplVersion fallback uses LATEST_STRING

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dsmiley
dsmiley force-pushed the SOLR-18432-solrversion-prerelease branch from c764fda to d59169c Compare October 28, 2026 00:59

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the prerelease-version handling and cluster compatibility changes.

No open issues 🎉

What changed in this PR

Makes Solr version handling tolerate prerelease qualifiers such as -SNAPSHOT in package constraints and cluster compatibility checks, while preserving strict version comparison and equality.

Changes:

  • Ignore prerelease qualifiers in satisfies() and add withoutPrerelease() for cluster compatibility comparisons.
  • Use LATEST_STRING as the fallback Solr implementation version in system information.
  • Add regression tests and a changelog entry; generating LATEST_STRING from the build version remains deferred.
File Description
solr/​core/​src/​test/​org/​apache/​solr/​handler/​admin/​NodeSystemInfoProviderTest.java Update the expected implementation-version fallback.
solr/​core/​src/​java/​org/​apache/​solr/​handler/​admin/​SystemInfoProvider.java Fall back to LATEST_STRING for implementation version.
solr/​core/​src/​java/​org/​apache/​solr/​cloud/​ZkController.java Compare cluster versions without prerelease qualifiers.
solr/​api/​src/​test/​org/​apache/​solr/​util/​TestSolrVersion.java Test prerelease range matching, removal, and strict ordering.
solr/​api/​src/​java/​org/​apache/​solr/​client/​api/​util/​SolrVersion.java Normalize prereleases for range matching and expose a removal helper.
changelog/​unreleased/​SOLR-18432-solrversion-prerelease.yml Document the prerelease-handling fixes.

Review effort: Balanced

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

I get the usecase for satisfies and that it is different from compareTo. Question is if there will ever be a need for the former satisfies logic, say in a satisfiesStrict() method?

@dsmiley

dsmiley commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Question is if there will ever be a need for the former satisfies logic, say in a satisfiesStrict() method

I don't think so? It sure looked wrong.

@dsmiley dsmiley added this to the 9.x milestone Oct 28, 2026
@nick-boss-tech

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖 (reviewed by Nick Shanin)

@dsmiley, the production changes in this PR look good to me. I have four additional Gradle unit tests in TestSolrVersion if useful: exact range boundaries for prereleases, build metadata and immutability, normalization of released versions, and ordering across patch/minor/major versions. They also assert that compareTo and equals still distinguish a prerelease from its release after range matching.

The test-only diff from your current head changes only TestSolrVersion.java.

Linux validation at 842b1fb: 14 tests passed

Validated at 842b1fb426860764d442c87738252b70eccf2c93 on Linux aarch64, JDK 21.0.12.1+1, Gradle 9.7.0:

  • TestSolrVersion: 12/12 passed, no skips.
  • NodeSystemInfoProviderTest: 2/2 passed, no skips.
  • Seed: 18432C0DE.
  • ./gradlew tidy: passed, with no changes.
  • ./gradlew check -x test: passed.

Four one-line mutations failed at their intended assertions: bypassing range normalization, retaining the prerelease, dropping build metadata, and collapsing patch versions. Their executed-test/failure counts were 1/1, 2/2, 2/2 and 1/1 respectively; none failed during compilation or setup.

To take these unit tests without rewriting history:

git switch SOLR-18432-solrversion-prerelease
git fetch https://github.com/nick-boss-tech/solr.git solr-18432-gradle-only
git merge --ff-only 842b1fb426860764d442c87738252b70eccf2c93

I also wrote a BATS test that starts a release-version node, joins a snapshot node, and checks version registration, replication, local reads, and absence of the false older-version warning. I lack Docker, so it remains untested and is on the separate solr-18432-submit branch in b849945c88b.

@dsmiley

dsmiley commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks Nick; I took the non-BATS tests.

@dsmiley
dsmiley merged commit 852b427 into apache:main Oct 29, 2026
5 checks passed
@dsmiley
dsmiley deleted the SOLR-18432-solrversion-prerelease branch October 29, 2026 19:22
dsmiley added a commit that referenced this pull request Oct 30, 2026
SolrVersion now tolerates a prerelease qualifier such as -SNAPSHOT. Package version constraints are matched ignoring the qualifier, the cluster version-compatibility warning no longer treats a prerelease as older than its release, and /api/node/system reports the correct Solr implementation version.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Nick Shanin <nick.boss.us@gmail.com>
(cherry picked from commit 852b427)
dsmiley added a commit that referenced this pull request Nov 2, 2026
SolrVersion now tolerates a prerelease qualifier such as -SNAPSHOT. Package version constraints are matched ignoring the qualifier, the cluster version-compatibility warning no longer treats a prerelease as older than its release, and /api/node/system reports the correct Solr implementation version.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Nick Shanin <nick.boss.us@gmail.com>
(cherry picked from commit 852b427)
(cherry picked from commit 11ebc82)

Omits the SystemInfoProvider change and its test; that class (SOLR-16458) is not on branch_9x.
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