SOLR-18150: Add SolrBackend abstraction for test/benchmark deployments#4214
SOLR-18150: Add SolrBackend abstraction for test/benchmark deployments#4214dsmiley wants to merge 7 commits intoapache:mainfrom
Conversation
- Created SolrBackend interface to abstract over different Solr deployment types - Added implementations: - EmbeddedSolrBackend: in-process CoreContainer/EmbeddedSolrServer - RemoteSolrBackend: CloudSolrClient connecting to remote SolrCloud cluster - JettySolrRunner: HTTP/Jetty + EmbeddedSolrServer - MiniSolrCloudCluster: embedded multi-node SolrCloud Key features: - Unified API for collection/configSet management across deployment types - Methods throw SolrServerException & IOException - hasConfigSet/hasCollection methods for existence checking - createCollection/uploadConfigSet for resource creation - getBaseUrl(Random) returns URL of a node (random for cloud deployments) - dumpMetrics/dumpCoreInfo for diagnostics Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
||
| /** "Mini" SolrCloud cluster to be used for testing */ | ||
| public class MiniSolrCloudCluster { | ||
| public class MiniSolrCloudCluster implements SolrBackend { |
There was a problem hiding this comment.
it's a pretty natural fit to implement directly here
solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
Outdated
Show resolved
Hide resolved
solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
Outdated
Show resolved
Hide resolved
solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
Show resolved
Hide resolved
solr/test-framework/src/java/org/apache/solr/cloud/RemoteSolrBackend.java
Outdated
Show resolved
Hide resolved
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.solr.cloud; |
There was a problem hiding this comment.
put into cloud package as it assumes SolrCloud
| * | ||
| * <p>Data is persisted in the given {@code solrHome} directory. | ||
| */ | ||
| public class EmbeddedSolrBackend implements SolrBackend { |
There was a problem hiding this comment.
EmbeddedSolrServer cannot implement SolrBackend directly because the latter is in solr-core and SolrBackend is in test-framework
| * @since solr 1.3 | ||
| */ | ||
| public class JettySolrRunner { | ||
| public class JettySolrRunner implements SolrBackend { |
There was a problem hiding this comment.
this ended up being slightly awkward to implement directly. An alternative could be a new method asSolrBackend
solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
Outdated
Show resolved
Hide resolved
solr/test-framework/src/java/org/apache/solr/embedded/JettySolrRunner.java
Outdated
Show resolved
Hide resolved
| * this client and is responsible for closing it. Callers that want a long-lived client should | ||
| * cache it themselves. | ||
| */ | ||
| SolrClient newClient(String collection); // nocommit or newSolrClient ? |
There was a problem hiding this comment.
nocommit; seeking feedback
There was a problem hiding this comment.
went with newSolrClient
| * this backend is {@link #close()}d. A {@link CloudSolrClient} should be returned if possible. | ||
| * nocommit | ||
| */ | ||
| SolrClient getAdminClient(); // nocommit or "getNodeClient" or getSolrClient ? |
There was a problem hiding this comment.
nocommit; seeking feedback
There was a problem hiding this comment.
went with getSolrClient, thus using the same name as in MiniSolrCloudCluster
MiniSolrCloudCluster: * optimize/cleanup configSet methods * reorg methods
|
Planning to merge ~Tuesday night |
Key features:
https://issues.apache.org/jira/browse/SOLR-18150
This PR only introduces the abstraction but no callers. Follow-on is to do so with benchmarks & tests separately. I have WIP for the benchmark side already.