Skip to content

Read the cluster's distribution version instead of returning a constant - #72

Merged
janhoy merged 1 commit into
apache:mainfrom
serhiy-bzhezytskyy:read-distribution-version-from-cluster
Sep 3, 2026
Merged

Read the cluster's distribution version instead of returning a constant#72
janhoy merged 1 commit into
apache:mainfrom
serhiy-bzhezytskyy:read-distribution-version-from-cluster

Conversation

@serhiy-bzhezytskyy

Copy link
Copy Markdown
Contributor

Description

cluster_distribution_version is documented as "Attempt to get the cluster's distribution version", but it created a client and then ignored it (solrorbit/builder/builder.py:272):

client_instance = client_factory(hosts, client_options).create()
if isinstance(client_instance, client.SolrClient):
    return "9.10.1"
return None

Every externally provisioned run that does not pass --distribution-version was therefore told the cluster is 9.10.1, whatever it actually is.

That value is not informational — it selects the workload branch. WorkloadRepository.update feeds it to versions.best_match (solrorbit/utils/repo.py:71):

versions.best_match(["main", "9", "10"], "9.10.1")  -> '9'
versions.best_match(["main", "9", "10"], "10.0.0")  -> '10'

CONTRIBUTING.md in solr-orbit-workloads documents that selection as intended — "solr-orbit automatically selects the workload branch that matches the Solr major version being tested" — so once a 10 branch exists there, a Solr 10 cluster gets benchmarked with the Solr 9 workloads and the run succeeds silently.

This calls the client's existing get_version(), which reads lucene.solr-spec-version from GET /api/node/system. When the cluster cannot be read it raises SystemSetupError naming --distribution-version rather than substituting a constant, since a wrong value is worse than a stop.

Verified against an unmodified solr:latest container (Solr 10.0.0, solr-impl 10.0.0 6c6c48a6f78, Lucene 10.3.2):

cluster_distribution_version()  ->  '10.0.0'      (was '9.10.1')
  best_match(['main','9','10'], '10.0.0') -> '10'  (was '9')

unreachable host -> SystemSetupError: Could not determine the distribution version of the
  cluster at [{'host': 'localhost', 'port': 9999}]. Specify it with --distribution-version.
  Cause: HTTPConnectionPool(...)

One deliberate consequence: the minimum_solr_version check in test_run_orchestrator.setup() was inert, because it compared a constant against a constant. It now compares against the real cluster. min-version.txt is 9.0.0, so 9.x and 10.x are unaffected and the only newly-rejected clusters are Solr 8 and older, which are already below the documented minimum.

Issues Resolved

Fixes #70

Testing

  • New functionality includes testing

Four tests in tests/builder/mechanic_test.py: the version is read from the cluster, the resulting best_match picks the cluster's own major, an unreachable cluster raises SystemSetupError naming the flag, and a non-Solr client still returns None.

Three of the four fail without the change ('10.0.0' != '9.10.1', '10' != '9', SystemSetupError not raised); the fourth is a regression guard on existing behaviour and passes either way.

ruff check . clean; full unit suite 1108 passed / 5 skipped. make it was not run.

cluster_distribution_version created a client and then ignored it, returning
"9.10.1". That value selects the workload branch via versions.best_match, so a
Solr 10 cluster was benchmarked with Solr 9 workloads silently. Use the client's
get_version(), and fail with a SystemSetupError naming --distribution-version
when the cluster cannot be read.
@janhoy
janhoy merged commit f088380 into apache:main Sep 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cluster_distribution_version returns a hardcoded 9.10.1 and never reads the cluster

2 participants