From 313249b23820d86a4bdab6f6cb7359766b14ee50 Mon Sep 17 00:00:00 2001 From: Luke Kot-Zaniewski Date: Mon, 1 Jun 2026 11:17:22 -0400 Subject: [PATCH 1/3] PoC --- .../solr/cloud/MultiThreadedOCPTest.java | 5 + .../component/CombinedQuerySolrCloudTest.java | 5 + ...DistributedCombinedQueryComponentTest.java | 5 + .../solr/BaseDistributedSearchTestCase.java | 157 ++++++++++++- .../cloud/AbstractFullDistribZkTestBase.java | 220 ++++++++++++++++-- 5 files changed, 366 insertions(+), 26 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java index 6a8e56cbb514..5ae2fa680b09 100644 --- a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java @@ -49,6 +49,11 @@ public MultiThreadedOCPTest() { fixShardCount(3); } + @Override + protected boolean reuseServersAcrossTests() { + return true; + } + @Test public void testFillWorkQueue() throws Exception { try (SolrClient client = createNewSolrClient("", getBaseUrl(jettys.get(0)))) { diff --git a/solr/core/src/test/org/apache/solr/handler/component/CombinedQuerySolrCloudTest.java b/solr/core/src/test/org/apache/solr/handler/component/CombinedQuerySolrCloudTest.java index 4f5f31d80063..67f8f4c205c5 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/CombinedQuerySolrCloudTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/CombinedQuerySolrCloudTest.java @@ -49,6 +49,11 @@ public CombinedQuerySolrCloudTest() { configString = "solrconfig-combined-query.xml"; } + @Override + protected boolean reuseServersAcrossTests() { + return true; + } + @Override protected String getCloudSchemaFile() { return "schema-vector-catchall.xml"; diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedCombinedQueryComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedCombinedQueryComponentTest.java index bb9105cad302..2a23b391ddb3 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/DistributedCombinedQueryComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedCombinedQueryComponentTest.java @@ -37,6 +37,11 @@ */ public class DistributedCombinedQueryComponentTest extends BaseDistributedSearchTestCase { + @Override + protected boolean reuseServersAcrossTests() { + return true; + } + private static final int NUM_DOCS = 10; private static final String vectorField = "vector"; diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java index 5249457ecd8c..1c1b45f2f422 100644 --- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java @@ -63,6 +63,7 @@ import org.apache.solr.common.util.IOUtils; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SolrNamedThreadFactory; +import org.apache.solr.core.CoreContainer; import org.apache.solr.embedded.JettyConfig; import org.apache.solr.embedded.JettySolrRunner; import org.eclipse.jetty.ee10.servlet.ServletHolder; @@ -182,6 +183,16 @@ public void fixShardCount(int count) { protected volatile Path testDir; protected volatile SolrClient controlClient; + // --- Jetty reuse across test methods (PoC) --- + private static List cachedJettys; + private static JettySolrRunner cachedControlJetty; + private static int cachedShardCount; + private static boolean serversAreCached = false; + + protected boolean reuseServersAcrossTests() { + return false; + } + // to stress with higher thread counts and requests, make sure the junit // xml formatter is not being used (all output will be buffered before // transformation to xml and cause an OOM exception). @@ -286,11 +297,16 @@ protected JettySolrRunner createControlJetty() throws Exception { } protected void createServers(int numShards) throws Exception { + long totalStart = System.nanoTime(); System.setProperty("configSetBaseDir", getSolrHome().toString()); + long controlStart = System.nanoTime(); controlJetty = createControlJetty(); controlClient = createNewSolrClient(controlJetty.getLocalPort()); + long controlMs = (System.nanoTime() - controlStart) / 1_000_000; + System.out.println( + "[PERF] createServers: control jetty created in " + controlMs + "ms"); shardsArr = new String[numShards]; StringBuilder sb = new StringBuilder(); @@ -300,8 +316,12 @@ protected void createServers(int numShards) throws Exception { Path jettyHome = testDir.resolve(shardname); seedSolrHome(jettyHome); seedCoreRootDirWithDefaultTestCore(jettyHome.resolve("cores")); + long jettyStart = System.nanoTime(); JettySolrRunner j = createJetty(jettyHome, null, null, getSolrConfigFile(), getSchemaFile()); j.start(); + long jettyMs = (System.nanoTime() - jettyStart) / 1_000_000; + System.out.println( + "[PERF] createServers: shard jetty " + i + " created+started in " + jettyMs + "ms"); jettys.add(j); clients.add(createNewSolrClient(j.getLocalPort())); String shardStr = buildUrl(j.getLocalPort()); @@ -314,6 +334,9 @@ protected void createServers(int numShards) throws Exception { } shards = sb.toString(); + long totalMs = (System.nanoTime() - totalStart) / 1_000_000; + System.out.println( + "[PERF] createServers: TOTAL " + totalMs + "ms (" + numShards + " shards)"); } protected void setDistributedParams(ModifiableSolrParams params) { @@ -344,6 +367,24 @@ protected String getShardsString() { } protected void destroyServers() throws Exception { + long start = System.nanoTime(); + + if (reuseServersAcrossTests() && serversAreCached) { + // Only close clients, keep Jettys running for next test method + ExecutorService customThreadPool = + ExecutorUtil.newMDCAwareCachedThreadPool(new SolrNamedThreadFactory("closeThreadPool")); + customThreadPool.execute(() -> IOUtils.closeQuietly(controlClient)); + for (SolrClient client : clients) { + customThreadPool.execute(() -> IOUtils.closeQuietly(client)); + } + ExecutorUtil.shutdownAndAwaitTermination(customThreadPool); + clients.clear(); + jettys.clear(); + long ms = (System.nanoTime() - start) / 1_000_000; + System.out.println("[PERF] destroyServers (REUSE - clients only): TOTAL " + ms + "ms"); + return; + } + ExecutorService customThreadPool = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrNamedThreadFactory("closeThreadPool")); @@ -379,8 +420,97 @@ protected void destroyServers() throws Exception { clients.clear(); jettys.clear(); + long ms = (System.nanoTime() - start) / 1_000_000; + System.out.println("[PERF] destroyServers: TOTAL " + ms + "ms"); + } + + // --- Jetty reuse helper methods --- + + private void cacheServers() { + cachedControlJetty = controlJetty; + cachedJettys = new ArrayList<>(jettys); + cachedShardCount = jettys.size(); + serversAreCached = true; + System.out.println( + "[PERF] REUSE: cached " + cachedShardCount + " shard jettys + 1 control jetty"); + } + + protected void restoreFromCachedServers(int numShards) throws Exception { + System.setProperty("configSetBaseDir", getSolrHome().toString()); + controlJetty = cachedControlJetty; + controlClient = createNewSolrClient(controlJetty.getLocalPort()); + + shardsArr = new String[numShards]; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < numShards && i < cachedJettys.size(); i++) { + if (sb.length() > 0) sb.append(','); + JettySolrRunner j = cachedJettys.get(i); + jettys.add(j); + clients.add(createNewSolrClient(j.getLocalPort())); + String shardStr = buildUrl(j.getLocalPort()); + if (shardStr.endsWith("/")) shardStr += DEFAULT_TEST_CORENAME; + else shardStr += "/" + DEFAULT_TEST_CORENAME; + shardsArr[i] = shardStr; + sb.append(shardStr); + } + shards = sb.toString(); + } + + protected void resetCores() throws Exception { + long start = System.nanoTime(); + resetCoreOnJetty(controlJetty); + for (JettySolrRunner jetty : jettys) { + resetCoreOnJetty(jetty); + } + long ms = (System.nanoTime() - start) / 1_000_000; + System.out.println("[PERF] REUSE: resetCores in " + ms + "ms"); } + private void resetCoreOnJetty(JettySolrRunner jetty) throws Exception { + try (SolrClient client = createNewSolrClient(jetty.getLocalPort())) { + client.deleteByQuery("*:*"); + client.commit(); + } + } + + @AfterClass + public static void destroyCachedServers() throws Exception { + if (!serversAreCached) return; + long start = System.nanoTime(); + ExecutorService pool = + ExecutorUtil.newMDCAwareCachedThreadPool(new SolrNamedThreadFactory("cachedShutdown")); + if (cachedControlJetty != null) { + pool.execute( + () -> { + try { + cachedControlJetty.stop(); + } catch (Exception e) { + log.error("Error stopping cached control jetty", e); + } + }); + } + if (cachedJettys != null) { + for (JettySolrRunner jetty : cachedJettys) { + pool.execute( + () -> { + try { + jetty.stop(); + } catch (Exception e) { + log.error("Error stopping cached jetty", e); + } + }); + } + } + ExecutorUtil.shutdownAndAwaitTermination(pool); + cachedControlJetty = null; + cachedJettys = null; + serversAreCached = false; + long ms = (System.nanoTime() - start) / 1_000_000; + System.out.println("[PERF] REUSE: destroyCachedServers in " + ms + "ms"); + } + + // --- End Jetty reuse helper methods --- + public JettySolrRunner createJetty(Path solrHome, String dataDir) throws Exception { return createJetty(solrHome, dataDir, null, null, null); } @@ -1064,12 +1194,27 @@ public void callStatement() throws Throwable { RandVal.uniqueValues = new HashSet(); // reset random values fixShardCount(numShards); - try { - createServers(numShards); - - statement.evaluate(); - } finally { - destroyServers(); + if (reuseServersAcrossTests() && serversAreCached) { + try { + long restoreStart = System.nanoTime(); + restoreFromCachedServers(numShards); + resetCores(); + long restoreMs = (System.nanoTime() - restoreStart) / 1_000_000; + System.out.println("[PERF] REUSE: restoreFromCache+resetCores in " + restoreMs + "ms"); + statement.evaluate(); + } finally { + destroyServers(); + } + } else { + try { + createServers(numShards); + if (reuseServersAcrossTests()) { + cacheServers(); + } + statement.evaluate(); + } finally { + destroyServers(); + } } } } diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java index d4b81d99ea6d..efba85393e07 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java @@ -112,6 +112,7 @@ import org.apache.solr.util.TimeOut; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; +import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.slf4j.Logger; @@ -131,6 +132,10 @@ public abstract class AbstractFullDistribZkTestBase extends BaseDistributedSearc protected static final String DEFAULT_COLLECTION = "collection1"; protected volatile ZkTestServer zkServer; + // --- Cloud reuse across test methods (PoC) --- + private static ZkTestServer cachedZkServer; + private static boolean zkIsCached = false; + @BeforeClass public static void beforeThisClass() throws Exception { // Only For Manual Testing: this will force a fs based dir factory @@ -259,21 +264,42 @@ protected static void clearErrorHook() { public void distribSetUp() throws Exception { super.distribSetUp(); - // Setup from AbstractFullDistribZkTestBase - Path zkDir = testDir.resolve("zookeeper/server1/data"); - zkServer = new ZkTestServer(zkDir); - zkServer.run(); - - System.setProperty(ZK_HOST, zkServer.getZkAddress()); - System.setProperty(ENABLE_UPDATE_LOG, "true"); - System.setProperty(REMOVE_VERSION_FIELD, "true"); - System.setProperty(ZOOKEEPER_FORCE_SYNC, "false"); - System.setProperty( - MockDirectoryFactory.SOLR_TESTS_ALLOW_READING_FILES_STILL_OPEN_FOR_WRITE, "true"); - - String schema = getCloudSchemaFile(); - if (schema == null) schema = "schema.xml"; - zkServer.buildZooKeeper(getCloudSolrConfig(), schema); + if (reuseServersAcrossTests() && zkIsCached) { + // Reuse the cached ZK server + zkServer = cachedZkServer; + System.setProperty(ZK_HOST, zkServer.getZkAddress()); + System.setProperty(ENABLE_UPDATE_LOG, "true"); + System.setProperty(REMOVE_VERSION_FIELD, "true"); + System.setProperty(ZOOKEEPER_FORCE_SYNC, "false"); + System.setProperty( + MockDirectoryFactory.SOLR_TESTS_ALLOW_READING_FILES_STILL_OPEN_FOR_WRITE, "true"); + System.out.println("[PERF] distribSetUp: REUSE - using cached ZK server"); + } else { + long zkStart = System.nanoTime(); + // Setup from AbstractFullDistribZkTestBase + Path zkDir = testDir.resolve("zookeeper/server1/data"); + zkServer = new ZkTestServer(zkDir); + zkServer.run(); + + System.setProperty(ZK_HOST, zkServer.getZkAddress()); + System.setProperty(ENABLE_UPDATE_LOG, "true"); + System.setProperty(REMOVE_VERSION_FIELD, "true"); + System.setProperty(ZOOKEEPER_FORCE_SYNC, "false"); + System.setProperty( + MockDirectoryFactory.SOLR_TESTS_ALLOW_READING_FILES_STILL_OPEN_FOR_WRITE, "true"); + + String schema = getCloudSchemaFile(); + if (schema == null) schema = "schema.xml"; + zkServer.buildZooKeeper(getCloudSolrConfig(), schema); + long zkMs = (System.nanoTime() - zkStart) / 1_000_000; + System.out.println("[PERF] distribSetUp: ZK create+start+buildZooKeeper in " + zkMs + "ms"); + + if (reuseServersAcrossTests()) { + cachedZkServer = zkServer; + zkIsCached = true; + System.out.println("[PERF] distribSetUp: REUSE - cached ZK server for future tests"); + } + } // ignoreException(".*"); @@ -371,12 +397,20 @@ protected CloudSolrClient createCloudClient(String defaultCollection) { @Override protected void createServers(int numServers) throws Exception { + long totalStart = System.nanoTime(); + + long controlStart = System.nanoTime(); Path controlJettyDir = createTempDir("control"); setupJettySolrHome(controlJettyDir); controlJetty = createJetty( controlJettyDir, useJettyDataDir ? getDataDir(testDir + "/control/data") : null); controlJetty.start(); + long controlJettyMs = (System.nanoTime() - controlStart) / 1_000_000; + System.out.println( + "[PERF] cloud createServers: control jetty start in " + controlJettyMs + "ms"); + + long controlCollStart = System.nanoTime(); try (CloudSolrClient client = createCloudClient("control_collection")) { assertEquals( 0, @@ -386,6 +420,9 @@ protected void createServers(int numServers) throws Exception { .getStatus()); waitForActiveReplicaCount(client, "control_collection", 1); } + long controlCollMs = (System.nanoTime() - controlCollStart) / 1_000_000; + System.out.println( + "[PERF] cloud createServers: control_collection creation in " + controlCollMs + "ms"); controlClient = new HttpSolrClient.Builder(controlJetty.getBaseUrl().toString()) @@ -403,9 +440,132 @@ protected void createServers(int numServers) throws Exception { return; } + long initCloudStart = System.nanoTime(); initCloud(); + long initCloudMs = (System.nanoTime() - initCloudStart) / 1_000_000; + System.out.println("[PERF] cloud createServers: initCloud in " + initCloudMs + "ms"); + long createJettysStart = System.nanoTime(); createJettys(numServers); + long createJettysMs = (System.nanoTime() - createJettysStart) / 1_000_000; + System.out.println( + "[PERF] cloud createServers: createJettys(" + numServers + ") in " + createJettysMs + "ms"); + + long totalMs = (System.nanoTime() - totalStart) / 1_000_000; + System.out.println( + "[PERF] cloud createServers: TOTAL " + totalMs + "ms (" + numServers + " servers)"); + } + + @Override + protected void restoreFromCachedServers(int numShards) throws Exception { + super.restoreFromCachedServers(numShards); + // Override control client to point at control_collection (cloud path) + IOUtils.closeQuietly(controlClient); + controlClient = + new HttpSolrClient.Builder(controlJetty.getBaseUrl().toString()) + .withDefaultCollection("control_collection") + .build(); + // Re-init cloud state (CloudSolrClient, ChaosMonkey) + cloudInit = false; + initCloud(); + // Recreate core clients + coreClients.clear(); + for (JettySolrRunner j : jettys) { + coreClients.add(createNewSolrClient(coreName, j.getLocalPort())); + } + } + + @Override + protected void resetCores() throws Exception { + long start = System.nanoTime(); + // Delete existing collections + try { + CollectionAdminRequest.deleteCollection(DEFAULT_COLLECTION).process(cloudClient); + ZkStateReader.from(cloudClient) + .waitForState( + DEFAULT_COLLECTION, + 30, + TimeUnit.SECONDS, + (liveNodes, collectionState) -> collectionState == null); + } catch (Exception e) { + log.warn("Could not delete collection {} during resetCores", DEFAULT_COLLECTION, e); + } + try { + CollectionAdminRequest.deleteCollection("control_collection").process(cloudClient); + ZkStateReader.from(cloudClient) + .waitForState( + "control_collection", + 30, + TimeUnit.SECONDS, + (liveNodes, collectionState) -> collectionState == null); + } catch (Exception e) { + log.warn("Could not delete control_collection during resetCores", e); + } + + // Recreate control_collection on the control Jetty + try (CloudSolrClient client = createCloudClient("control_collection")) { + assertEquals( + 0, + CollectionAdminRequest.createCollection("control_collection", "conf1", 1, 1) + .setCreateNodeSet(controlJetty.getNodeName()) + .process(client) + .getStatus()); + waitForActiveReplicaCount(client, "control_collection", 1); + } + + // Recreate DEFAULT_COLLECTION with empty nodeSet (no cores yet) + assertEquals( + 0, + CollectionAdminRequest.createCollection(DEFAULT_COLLECTION, "conf1", sliceCount, 1) + .setCreateNodeSet("") + .process(cloudClient) + .getStatus()); + ZkStateReader.from(cloudClient) + .waitForState( + DEFAULT_COLLECTION, + 30, + TimeUnit.SECONDS, + SolrCloudTestCase.activeClusterShape(sliceCount, 0)); + + // Add replicas on existing Jettys + for (int i = 0; i < jettys.size(); i++) { + JettySolrRunner j = jettys.get(i); + int shardNum = (i % sliceCount) + 1; + Replica.Type type = useTlogReplicas() ? Replica.Type.TLOG : Replica.Type.NRT; + CollectionAdminResponse response = + CollectionAdminRequest.addReplicaToShard(DEFAULT_COLLECTION, "shard" + shardNum) + .setNode(j.getNodeName()) + .setType(type) + .process(cloudClient); + assertTrue(response.isSuccess()); + } + + waitForActiveReplicaCount(cloudClient, DEFAULT_COLLECTION, jettys.size()); + + // Ensure leaders are elected and mappings updated + ZkStateReader zkStateReader = ZkStateReader.from(cloudClient); + for (int i = 1; i <= sliceCount; i++) { + zkStateReader.getLeaderRetry(DEFAULT_COLLECTION, "shard" + i, 10000); + } + if (sliceCount > 0) { + updateMappingsFromZk(this.jettys, this.clients); + } + + long ms = (System.nanoTime() - start) / 1_000_000; + System.out.println( + "[PERF] REUSE: cloud resetCores (collection recreation) in " + ms + "ms"); + } + + @AfterClass + public static void destroyCachedCloudServers() throws Exception { + if (zkIsCached && cachedZkServer != null) { + long start = System.nanoTime(); + cachedZkServer.shutdown(); + cachedZkServer = null; + zkIsCached = false; + long ms = (System.nanoTime() - start) / 1_000_000; + System.out.println("[PERF] REUSE: destroyCachedCloudServers ZK shutdown in " + ms + "ms"); + } } public static void waitForCollection(ZkStateReader reader, String collection, int slices) @@ -2184,15 +2344,27 @@ public void distribTearDown() throws Exception { } finally { resetExceptionIgnores(); - try { - zkServer.shutdown(); - } catch (Exception e) { - throw new RuntimeException("Exception shutting down Zk Test Server.", e); - } finally { + if (reuseServersAcrossTests() && zkIsCached) { + // Skip ZK shutdown - it's cached for reuse + System.out.println("[PERF] distribTearDown: REUSE - skipping ZK shutdown"); try { super.distribTearDown(); } finally { } + } else { + try { + long zkShutdownStart = System.nanoTime(); + zkServer.shutdown(); + long zkShutdownMs = (System.nanoTime() - zkShutdownStart) / 1_000_000; + System.out.println("[PERF] distribTearDown: ZK shutdown in " + zkShutdownMs + "ms"); + } catch (Exception e) { + throw new RuntimeException("Exception shutting down Zk Test Server.", e); + } finally { + try { + super.distribTearDown(); + } finally { + } + } } } } @@ -2242,6 +2414,7 @@ public static void copyConfigUp( @Override protected void destroyServers() throws Exception { + long start = System.nanoTime(); ExecutorService customThreadPool = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrNamedThreadFactory("closeThreadPool")); @@ -2262,11 +2435,18 @@ protected void destroyServers() throws Exception { customThreadPool.execute(() -> IOUtils.closeQuietly(cloudClient)); ExecutorUtil.shutdownAndAwaitTermination(customThreadPool); + long clientCloseMs = (System.nanoTime() - start) / 1_000_000; + System.out.println( + "[PERF] cloud destroyServers: client close in " + clientCloseMs + "ms"); coreClients.clear(); solrClientByCollection.clear(); + long superStart = System.nanoTime(); super.destroyServers(); + long superMs = (System.nanoTime() - superStart) / 1_000_000; + System.out.println( + "[PERF] cloud destroyServers: super.destroyServers (jetty stop) in " + superMs + "ms"); } @Override From 2cee702cb5bb33d901f2c0361b0a4711c87757d7 Mon Sep 17 00:00:00 2001 From: Luke Kot-Zaniewski Date: Mon, 1 Jun 2026 16:06:38 -0400 Subject: [PATCH 2/3] PoC --- .../api/collections/SimpleCollectionCreateDeleteTest.java | 5 +++++ .../solr/handler/admin/LukeRequestHandlerDistribTest.java | 5 +++++ .../solr/handler/component/CombinedQueryComponentTest.java | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java index 6b09a449e90c..0d4ee5592074 100644 --- a/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java @@ -45,6 +45,11 @@ public SimpleCollectionCreateDeleteTest() { sliceCount = 1; } + @Override + protected boolean reuseServersAcrossTests() { + return true; + } + @Test @ShardsFixed(num = 1) public void testCreateAndDeleteThenCreateAgain() throws Exception { diff --git a/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerDistribTest.java b/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerDistribTest.java index b727114572f3..1b8ac55afc19 100644 --- a/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerDistribTest.java +++ b/solr/core/src/test/org/apache/solr/handler/admin/LukeRequestHandlerDistribTest.java @@ -40,6 +40,11 @@ public LukeRequestHandlerDistribTest() { fixShardCount(2); } + @Override + protected boolean reuseServersAcrossTests() { + return true; + } + private LukeResponse requestLuke() throws Exception { return requestLuke(new ModifiableSolrParams()); } diff --git a/solr/core/src/test/org/apache/solr/handler/component/CombinedQueryComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/CombinedQueryComponentTest.java index 224c59bb1b72..e9a764090a9a 100644 --- a/solr/core/src/test/org/apache/solr/handler/component/CombinedQueryComponentTest.java +++ b/solr/core/src/test/org/apache/solr/handler/component/CombinedQueryComponentTest.java @@ -45,6 +45,11 @@ public CombinedQueryComponentTest() { fixShardCount(1); } + @Override + protected boolean reuseServersAcrossTests() { + return true; + } + /** * Sets up the test class by initializing the core and setting system properties. This method is * executed before all test methods in the class. From 4a0a20649e28c8ec415299add4e15b919e8a14c1 Mon Sep 17 00:00:00 2001 From: Luke Kot-Zaniewski Date: Mon, 1 Jun 2026 16:11:02 -0400 Subject: [PATCH 3/3] tidy --- .../org/apache/solr/BaseDistributedSearchTestCase.java | 7 ++----- .../apache/solr/cloud/AbstractFullDistribZkTestBase.java | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java index 1c1b45f2f422..a41ddafba74f 100644 --- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java @@ -63,7 +63,6 @@ import org.apache.solr.common.util.IOUtils; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SolrNamedThreadFactory; -import org.apache.solr.core.CoreContainer; import org.apache.solr.embedded.JettyConfig; import org.apache.solr.embedded.JettySolrRunner; import org.eclipse.jetty.ee10.servlet.ServletHolder; @@ -305,8 +304,7 @@ protected void createServers(int numShards) throws Exception { controlJetty = createControlJetty(); controlClient = createNewSolrClient(controlJetty.getLocalPort()); long controlMs = (System.nanoTime() - controlStart) / 1_000_000; - System.out.println( - "[PERF] createServers: control jetty created in " + controlMs + "ms"); + System.out.println("[PERF] createServers: control jetty created in " + controlMs + "ms"); shardsArr = new String[numShards]; StringBuilder sb = new StringBuilder(); @@ -335,8 +333,7 @@ protected void createServers(int numShards) throws Exception { shards = sb.toString(); long totalMs = (System.nanoTime() - totalStart) / 1_000_000; - System.out.println( - "[PERF] createServers: TOTAL " + totalMs + "ms (" + numShards + " shards)"); + System.out.println("[PERF] createServers: TOTAL " + totalMs + "ms (" + numShards + " shards)"); } protected void setDistributedParams(ModifiableSolrParams params) { diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java index efba85393e07..f2ef60d226f6 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java @@ -552,8 +552,7 @@ protected void resetCores() throws Exception { } long ms = (System.nanoTime() - start) / 1_000_000; - System.out.println( - "[PERF] REUSE: cloud resetCores (collection recreation) in " + ms + "ms"); + System.out.println("[PERF] REUSE: cloud resetCores (collection recreation) in " + ms + "ms"); } @AfterClass @@ -2436,8 +2435,7 @@ protected void destroyServers() throws Exception { ExecutorUtil.shutdownAndAwaitTermination(customThreadPool); long clientCloseMs = (System.nanoTime() - start) / 1_000_000; - System.out.println( - "[PERF] cloud destroyServers: client close in " + clientCloseMs + "ms"); + System.out.println("[PERF] cloud destroyServers: client close in " + clientCloseMs + "ms"); coreClients.clear(); solrClientByCollection.clear();