This is an automated email from the ASF dual-hosted git repository.
sanjaydutt pushed a commit to branch branch_9_8
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9_8 by this push:
new ec6f875fb87 SOLR-17644: SolrCloudManager directly uses
HttpSolrClientProvider's client, resolving missing auth listeners (#3208)
ec6f875fb87 is described below
commit ec6f875fb87456db8b7d836ce090a0d1862e42e4
Author: iamsanjay <[email protected]>
AuthorDate: Fri Feb 28 17:52:17 2025 +0530
SOLR-17644: SolrCloudManager directly uses HttpSolrClientProvider's client,
resolving missing auth listeners (#3208)
Co-authored-by: David Smiley <[email protected]>
(cherry picked from commit f1badb755d11996742478ff8f19d5fac1951b56e)
---
solr/CHANGES.txt | 3 +++
.../java/org/apache/solr/cloud/ZkController.java | 12 +---------
.../solr/security/BasicAuthIntegrationTest.java | 28 ++++++++++++++++++++++
3 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 68149c7e1c3..aa0661c767a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -30,6 +30,9 @@ Bug Fixes
* SOLR-17677: Before attempting a delete by query ("DBQ"), Solr now checks
whether the provided query can be run using a Lucene IndexSearcher,
and aborts the operation with a '400' error if it cannot. (Jason Gerlowski)
+* SOLR-17644: Fixes collection creation failure when using a replica placement
plugin with basic auth. SolrCloudManager
+ now directly uses HttpSolrClientProvider's client, resolving missing auth
listeners. (Sanjay Dutt, David Smiley)
+
Dependency Upgrades
---------------------
(No changes)
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 5f164a522b1..77c42bf39c0 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -206,9 +206,6 @@ public class ZkController implements Closeable {
public final ZkStateReader zkStateReader;
private SolrCloudManager cloudManager;
- // only for internal usage
- private Http2SolrClient http2SolrClient;
-
private CloudHttp2SolrClient cloudSolrClient;
private final String zkServerAddress; // example: 127.0.0.1:54062/solr
@@ -779,7 +776,6 @@ public class ZkController implements Closeable {
sysPropsCacher.close();
customThreadPool.execute(() -> IOUtils.closeQuietly(cloudManager));
customThreadPool.execute(() -> IOUtils.closeQuietly(cloudSolrClient));
- customThreadPool.execute(() -> IOUtils.closeQuietly(http2SolrClient));
try {
try {
@@ -875,15 +871,9 @@ public class ZkController implements Closeable {
if (cloudManager != null) {
return cloudManager;
}
- http2SolrClient =
- new Http2SolrClient.Builder()
- .withHttpClient(cc.getDefaultHttpSolrClient())
- .withIdleTimeout(30000, TimeUnit.MILLISECONDS)
- .withConnectionTimeout(15000, TimeUnit.MILLISECONDS)
- .build();
cloudSolrClient =
new CloudHttp2SolrClient.Builder(new
ZkClientClusterStateProvider(zkStateReader))
- .withHttpClient(http2SolrClient)
+ .withHttpClient(cc.getDefaultHttpSolrClient())
.build();
cloudManager = new SolrClientCloudManager(cloudSolrClient,
cc.getObjectCache());
cloudManager.getClusterStateProvider().connect();
diff --git
a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
index 3e10adbd44e..cb8ebf92607 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
@@ -50,8 +50,11 @@ import org.apache.solr.client.solrj.request.QueryRequest;
import
org.apache.solr.client.solrj.request.RequestWriter.StringPayloadContentWriter;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.request.V2Request;
+import org.apache.solr.client.solrj.request.beans.PluginMeta;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.cloud.SolrCloudAuthTestCase;
+import org.apache.solr.cluster.placement.PlacementPluginFactory;
+import org.apache.solr.cluster.placement.plugins.MinimizeCoresPlacementFactory;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
@@ -376,6 +379,31 @@ public class BasicAuthIntegrationTest extends
SolrCloudAuthTestCase {
assertAuthMetricsMinimums(32, 20, 9, 1, 2, 0);
assertPkiAuthMetricsMinimums(19, 19, 0, 0, 0, 0);
+ // This succeeds with auth enabled
+ CollectionAdminRequest.createCollection("c123", "conf", 3, 1)
+ .setBasicAuthCredentials("harry", "HarryIsUberCool")
+ .process(cluster.getSolrClient());
+ cluster.waitForActiveCollection("c123", 3, 3);
+
+ // SOLR-17644
+ // Test Collection creation when replica placement plugin and basic auth
are enabled
+ PluginMeta plugin = new PluginMeta();
+ plugin.name = PlacementPluginFactory.PLUGIN_NAME;
+ plugin.klass = MinimizeCoresPlacementFactory.class.getName();
+ V2Request v2Request =
+ new V2Request.Builder("/cluster/plugin")
+ .forceV2(true)
+ .POST()
+ .withPayload(singletonMap("add", plugin))
+ .build();
+ v2Request.setBasicAuthCredentials("harry", "HarryIsUberCool");
+ v2Request.process(cluster.getSolrClient());
+
+ CollectionAdminRequest.createCollection("c456", "conf", 3, 1)
+ .setBasicAuthCredentials("harry", "HarryIsUberCool")
+ .process(cluster.getSolrClient());
+ cluster.waitForActiveCollection("c456", 3, 3);
+
executeCommand(
baseUrl + authcPrefix,
cl,