Skip to content

Sort the index of a procedure that asks for a sorted index - #193

Draft
serhiy-bzhezytskyy wants to merge 17 commits into
apache:mainfrom
serhiy-bzhezytskyy:sorted-index-config-set
Draft

serhiy-bzhezytskyy wants to merge 17 commits into
apache:mainfrom
serhiy-bzhezytskyy:sorted-index-config-set

Conversation

@serhiy-bzhezytskyy

@serhiy-bzhezytskyy serhiy-bzhezytskyy commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #197: its commits come first in this branch and drop out of the diff when it merges.

geonames' append-sorted-no-conflicts and nyc_taxis' append-sorted-no-conflicts-index-only run against an unsorted collection and report success. Their index settings say index.sort.field and index.sort.order, and the converter dropped them.

The converter now writes a config set for each distinct sort, named <collection>_sorted, whose merge policy is SortingMergePolicyFactory for that sort, and passes it to the procedure. A sort over a field without doc values is not applied, and CONVERTED.md says so.

Two changes make the procedure use it. A create-collection task in a procedure can name its own configset and configset-path, which the param source ignored; the loader resolves the path against the workload directory. And the sorted config set has a name of its own: Solr serves a config set that is deleted and uploaded again with other content under the same name from its cache, so the plain content kept winning on the same node. A delete step written above the sorted block deletes the config set that block uploads.

geonames, 3,000 documents, one segment documents out of order
the converter's geonames_sorted config set 0
the plain geonames config set 1,451

Against OpenSearch with the same sort on the same documents, both engines store them in the same order, and the 13 documents without admin1_code sit at the same positions (269 to 271 of 3,000). Solr 10.1.0 and OpenSearch 3.10.0.

Not covered: a sort over a field without doc values, and a config set with a merge policy of its own, are left unsorted and reported. The guide does not say where documents without the sort field go; measured as above.

Test with:

solr-orbit convert-workload --workload-path <opensearch-benchmark-workloads>/geonames --output-path /tmp/geonames-solr
ls /tmp/geonames-solr/configsets
solr-orbit run --pipeline=benchmark-only --target-hosts=localhost:8983 --workload-path=/tmp/geonames-solr --test-procedure=append-sorted-no-conflicts --test-mode
curl -s localhost:8983/solr/geonames/config | grep -o SortingMergePolicyFactory | head -1
pytest tests -k "IndexSort or configset"

ls prints geonames and geonames_sorted, and pytest 15 passed. After the run, curl prints SortingMergePolicyFactory (before, nothing), and a second run of the procedure succeeds.

Comments and docstrings in the builder, metrics, loader and parameter sources still spoke of OSB and OpenSearch where they mean Solr Orbit and Solr, a comment in the test run orchestrator said it auto-converts a workload when it refuses one, and two commented-out blocks in benchmark.py referred to an argument that no longer exists. No behaviour changes.
These three presets carried their JVM flag only in a jvm.options template that the Solr launcher never reads, so --cluster-config ea or fp changed nothing. They now set solr_opts, the variable the launcher already maps to SOLR_OPTS, and the flags of several such presets add up instead of the last one replacing the others.
create-backup, restore-backup, create-backup-repository, delete-backup-repository and wait-for-backup-create were registered and failed with not yet implemented. No shipped workload uses them and the converter never writes them, because a Solr backup repository is declared in the node's configuration rather than through a request. A workload that needs a backup calls the Backup API with raw-request.
The option that named the plugins to install was removed earlier, so the plugin list was always empty, and the builder itself says Solr does not install plugins through the tool; modules are enabled with --solr-modules. What was left read and stored a --plugin-params that went to no plugin, a metadata function nobody called, and a loader, a lister and a download-URL provider for plugin directories that the cluster configs do not contain. Results no longer carry an always-empty plugin-params key; stored results that have one still load.
The runtime still accepted refresh as a second name for commit, and the templates for new workloads and the converter's output depended on it. The converter now turns an upstream refresh into a commit, in an operation type, in a bare step and in the task named refresh-after-*, so the runtime has one name for the step and a workload written from a Solr cluster says commit-after-index.
…table

On a failed request the worker parsed the error body with a table of OpenSearch action names and permission texts. For a Solr error body it matched nothing and printed error occured, check logs for details, hiding the message Solr had sent. The error description is now printed as it came.
A node installed with --cluster-config 4gheap ran with Solr's default heap of 512m, because the launcher built its environment from the passed-through variables only; run already translated the same variables into SOLR_HEAP, GC_TUNE and SOLR_OPTS. install now stores that environment in node-config.json and start applies it, through one function that run and the Docker launcher use as well. The g1gc preset for released versions still carried the old variable names and set nothing, and parallelgc existed only for main; both are now the same in both directories.
The block that prints a failed request's error sat inside execute_single without a test. One test pins that the error a Solr request failed with is printed as it came, and fails on the code that printed a generic text instead; one pins that a redline test prints nothing.
The vanilla cluster config wrote jvm.options and log4j2.properties into a config/ directory of the Solr root, and the ea, fp and debug-non-safepoints presets did the same with one JVM flag each. Solr reads neither file: its JVM is set through bin/solr and its logging through server/resources/log4j2.xml. The flags now travel as solr_opts, so the templates are removed, the presets that only carried a template are plain mixins, and the vanilla README describes the variables that count.
…ly for a refresh

A solr_opts given with --cluster-config-params was added to every config in the list, so it was repeated once per mixin and replaced the mixins' own options. The parameters are now applied once, after the configs are merged. The converter renamed refresh-after-* by name alone in the text form, which also renamed a force-merge task, and left an object-form refresh unconverted in both forms; the rename now follows the operation being a refresh, as an object or a bare name.
The opensearch logger configured the Python client of OpenSearch, which Solr Orbit does not depend on, and bootstrap_phase, cluster_config_instance, cluster_config_descriptor and cluster_config_types are copies of classes that cluster_config.py defines itself and that nothing imports.
Search and bulk parameters carried the target as index, and the runtime accepted index as a second name for collection in six places, which is the name of an OpenSearch workload. They now carry and read collection; the converter already renames index. The _all message no longer explains what OpenSearch does, and a helper that mapped OpenSearch client keyword names and had no caller is gone.
The README said the tests were written for OpenSearch Benchmark, would not pass against Solr and needed an OpenSearch cluster, while they install and start Solr nodes. Docker was required by the setup of every module although only the Docker pipeline test and the proxy test use it, so even list and info could not run without it; the check now sits in those two. The default versions named 10.0.0, which downloads.apache.org no longer serves, and are now 9.11.0 and 10.1.0. An unused decorator for a configuration that does not exist is gone, three comments no longer explain what OpenSearch did, and make it asks for the Java 21 that Solr 10 needs instead of 17.
generate-data took the fields of its documents from index mappings in the format of OpenSearch, so the schema that create-workload writes for a Solr collection could not be used and the documentation did not say what format it wanted. --solr-schema reads the Schema API response or that file and generates a value per field by the class of its type: a unique value for the uniqueKey, lists for multi-valued fields except where a copyField into a single-valued field forbids it, points as lat,lon and dates as full instants, the shapes Solr accepts. skip_fields in the config leaves out fields that an update processor fills. 2000 generated documents were indexed into a collection of the geonames configset without an error.
An operation named scroll, date_histogram_* or *_function_score named an OpenSearch feature that Solr offers under another name: paging with a cursor, a range facet over dates, a function query. The converter now renames them with their parameters as it does for agg and index-stats, so a converted workload reads as one written for Solr.
A converted workload.json kept the data-url that solr-orbit never reads, nyc_taxis kept a #COMMENT key, and four procedure descriptions of geonames said OpenSearch. The converter drops the two keys and says Solr in a description, so the output reads as a workload written for Solr.
geonames' and nyc_taxis' sorted procedures state index.sort.field and index.sort.order in their index settings, which the converter dropped, so they ran against an unsorted collection and reported SUCCESS. OpenSearch sets the sort on the index writer; Solr's SortingMergePolicyFactory does the same, and on 3,000 geonames documents both engines store the documents in the same order, those without the field at the same place. The converter now writes a config set per distinct sort with that merge policy, points the procedure at it, and refuses a sort over a field without doc values. A create-collection step can name its own config set, resolved against the workload directory, and the sorted config set has a name of its own: Solr serves a config set that is deleted and uploaded again with other content under the same name from its cache, so the plain content kept winning on the same node. A delete step written above the sorted block deletes the config set that block uploads.

This branch has not been deployed

No deployments
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.

1 participant