You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ge...@apache.org on 2024/02/13 13:32:11 UTC

(solr) branch main updated: SOLR-17145: Add 'requestid' to INSTALLSHARD response (#2252)

This is an automated email from the ASF dual-hosted git repository.

gerlowskija pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new ce3d8585ac0 SOLR-17145: Add 'requestid' to INSTALLSHARD response (#2252)
ce3d8585ac0 is described below

commit ce3d8585ac098a0c8b7a1ff907dcfc1341526f3f
Author: Jason Gerlowski <ge...@apache.org>
AuthorDate: Tue Feb 13 08:32:06 2024 -0500

    SOLR-17145: Add 'requestid' to INSTALLSHARD response (#2252)
    
    The field is commonly found on other admin requests, so we've added it
    here for consistency.
---
 solr/CHANGES.txt                                              |  2 ++
 .../org/apache/solr/handler/admin/api/InstallShardData.java   | 11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 8dbdc598a9c..1f7412baea4 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -95,6 +95,8 @@ Improvements
 
 * SOLR-16858: KnnQParser's "Pre-Filtering" behavior is now controlable via local params (hossman)
 
+* SOLR-17145: The INSTALLSHARDDATA API now includes a 'requestid' field when run asynchronously (Jason Gerlowski)
+
 Optimizations
 ---------------------
 * SOLR-17144: Close searcherExecutor thread per core after 1 minute (Pierre Salagnac, Christine Poerschke)
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/api/InstallShardData.java b/solr/core/src/java/org/apache/solr/handler/admin/api/InstallShardData.java
index f1f88f78e54..ac13ef75908 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/api/InstallShardData.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/api/InstallShardData.java
@@ -23,8 +23,8 @@ import static org.apache.solr.security.PermissionNameProvider.Name.COLL_EDIT_PER
 import jakarta.inject.Inject;
 import java.util.HashMap;
 import org.apache.solr.client.api.endpoint.InstallShardDataApi;
+import org.apache.solr.client.api.model.AsyncJerseyResponse;
 import org.apache.solr.client.api.model.InstallShardDataRequestBody;
-import org.apache.solr.client.api.model.SolrJerseyResponse;
 import org.apache.solr.client.solrj.SolrResponse;
 import org.apache.solr.cloud.api.collections.InstallShardDataCmd;
 import org.apache.solr.common.SolrException;
@@ -59,9 +59,9 @@ public class InstallShardData extends AdminAPIBase implements InstallShardDataAp
 
   @Override
   @PermissionName(COLL_EDIT_PERM)
-  public SolrJerseyResponse installShardData(
+  public AsyncJerseyResponse installShardData(
       String collName, String shardName, InstallShardDataRequestBody requestBody) throws Exception {
-    final SolrJerseyResponse response = instantiateJerseyResponse(SolrJerseyResponse.class);
+    final var response = instantiateJerseyResponse(AsyncJerseyResponse.class);
     final CoreContainer coreContainer = fetchAndValidateZooKeeperAwareCoreContainer();
     recordCollectionForLogAndTracing(collName, solrQueryRequest);
     if (requestBody == null) {
@@ -99,6 +99,11 @@ public class InstallShardData extends AdminAPIBase implements InstallShardDataAp
       throw remoteResponse.getException();
     }
 
+    if (requestBody.async != null) {
+      response.requestId = requestBody.async;
+      return response;
+    }
+
     return response;
   }