This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_9x in repository https://gitbox.apache.org/repos/asf/solr.git
commit 4ef32c449b78c8d032fe994cf3c0f7c9302035ab Author: Jalaz Kumar <[email protected]> AuthorDate: Thu Oct 8 21:01:13 2026 +0530 SOLR-18520: Package Uninstall should work in absence of clusterprops.json (#5052) (cherry picked from commit 2f2b21be654f10534f1e1f995acd104470dba677) (cherry picked from commit 9ebb012fbb6dea6aef11cf36048aa1d30853b7a1) --- changelog/unreleased/SOLR-18520-uninstall-bug.yml | 9 +++++++++ .../java/org/apache/solr/packagemanager/PackageManager.java | 13 +++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/changelog/unreleased/SOLR-18520-uninstall-bug.yml b/changelog/unreleased/SOLR-18520-uninstall-bug.yml new file mode 100644 index 00000000000..6e66dcb25cb --- /dev/null +++ b/changelog/unreleased/SOLR-18520-uninstall-bug.yml @@ -0,0 +1,9 @@ +title: + Package Uninstall should work in absence of clusterprops.json file +type: fixed +authors: + - name: Jalaz Kumar + nick: jaykay12 +links: + - name: SOLR-18520 + url: https://issues.apache.org/jira/browse/SOLR-18520 diff --git a/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java b/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java index 426312b788c..f0adf8cdcee 100644 --- a/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java +++ b/solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java @@ -47,6 +47,7 @@ import org.apache.solr.client.api.util.SolrVersion; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrServerException; +import org.apache.solr.client.solrj.impl.BaseHttpSolrClient.RemoteSolrException; import org.apache.solr.client.solrj.impl.SolrZkClientTimeout; import org.apache.solr.client.solrj.request.GenericSolrRequest; import org.apache.solr.client.solrj.request.GenericV2SolrRequest; @@ -156,7 +157,7 @@ public class PackageManager implements Closeable { del.pkg = packageName; V2Request req = - new V2Request.Builder(PackageUtils.PACKAGE_PATH) + new V2Request.Builder("/cluster/package") .forceV2(true) .withMethod(SolrRequest.METHOD.POST) .withPayload(Collections.singletonMap("delete", del)) @@ -280,18 +281,18 @@ public class PackageManager implements Closeable { Map<String, String> packageVersions = new HashMap<>(); // map of package name to multiple values of pluginMeta(Map<String, String>) Map<String, Set<PluginMeta>> packagePlugins = new HashMap<>(); - Map<String, Object> result; + Map<String, Object> result = Collections.emptyMap(); try { NamedList<Object> response = solrClient.request( new GenericV2SolrRequest(SolrRequest.METHOD.GET, PackageUtils.CLUSTERPROPS_PATH)); Integer statusCode = (Integer) response._get(List.of("responseHeader", "status"), null); - if (statusCode == null || statusCode == ErrorCode.NOT_FOUND.code) { - // Cluster props doesn't exist, that means there are no cluster level plugins installed. - result = Collections.emptyMap(); - } else { + if (statusCode != null && statusCode != ErrorCode.NOT_FOUND.code) { + // Cluster props exists, that means there are cluster level plugins installed. result = response.asShallowMap(); } + } catch (RemoteSolrException ex) { + log.debug("Unable to fetch clusterprops for package plugins", ex); } catch (SolrServerException | IOException ex) { throw new SolrException(ErrorCode.SERVER_ERROR, ex); }
