Skip to content

SOLR-18126 Benchmark, refactor: MiniClusterState -> SolrBenchState#4196

Open
dsmiley wants to merge 4 commits intoapache:mainfrom
dsmiley:benchmark-flatten-api
Open

SOLR-18126 Benchmark, refactor: MiniClusterState -> SolrBenchState#4196
dsmiley wants to merge 4 commits intoapache:mainfrom
dsmiley:benchmark-flatten-api

Conversation

@dsmiley
Copy link
Contributor

@dsmiley dsmiley commented Mar 8, 2026

This is a preparatory refactoring step on a short journey to solr/benchmark supporting multiple backends (not just MiniSolrCloudCluster). This PR renames bench/MiniClusterState.java to bench/SolrBenchState.java, and flattens its structure, which had an inner class. Two lifecycle methods containing "miniCluster" in the name were replaced with "solr" to be generic, and I improved javadocs slightly. That's it; I held back on doing anything else; this is just a simple refactoring. Any other code you see is as-is, unchanged. This PR will make a future PR much easier to review from a diff standpoint, and/or it allows more baby-steps.

I suppose one might say: why not embrace JMH's class / injection design on this journey, such that MiniClusterState would continue to exist but so would other future ones like a hypothetical RemoteSolrState. Pursuing that would lead to a common base class, holding most of the functionality that's there now (e.g. the index methods). I chose a different path in which a common/universal benchmark state class SolrBenchState will delegate to a SolrBackend. The instantiation/configuration is where the only difference lies. Subclassing could be done to handle that but there's so little to it that I didn't bother. Even if we wind up wanting that approach after all, I still think this PR is helpful to that possible eventuality as well, since we'd still need a SolrBenchState and containing most of what you see in it.

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

dsmiley and others added 4 commits March 7, 2026 00:54
MiniClusterState is renamed to SolrBenchState to better reflect that
this state class will support multiple backend strategies beyond just
the mini cluster approach.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pure structural refactor with no functional changes:
- Moved @State annotation from inner class to outer class
- Removed MiniClusterBenchState inner class declaration
- De-indented all inner class content
- Updated all benchmarks to use SolrBenchState directly
- Renamed parameter from miniClusterState to solrBenchState
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.

1 participant