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

dsmiley 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 8740b07efa8 SOLR-16924: RESTORECORE: make UpdateLog ACTIVE without 
requiring REQUESTAPPLYUPDATES (#1965)
8740b07efa8 is described below

commit 8740b07efa8e78ab9ad1842cfd836e23b2cf6fd8
Author: julia-maimone <[email protected]>
AuthorDate: Thu Oct 5 21:46:12 2023 -0700

    SOLR-16924: RESTORECORE: make UpdateLog ACTIVE without requiring 
REQUESTAPPLYUPDATES (#1965)
    
    RESTORECORE now sets the UpdateLog to ACTIVE state instead of requiring a 
separate REQUESTAPPLYUPDATES call in Collection restore. The latter will still 
happen in 9.x for backwards-compatibility.
    
    ---------
    
    Co-authored-by: Julia Maimone <[email protected]>
    Co-authored-by: David Smiley <[email protected]>
---
 solr/CHANGES.txt                                   |  4 ++-
 .../solr/cloud/api/collections/RestoreCmd.java     | 32 ----------------------
 .../solr/handler/admin/api/RestoreCoreAPI.java     |  7 +++++
 .../pages/major-changes-in-solr-10.adoc            |  5 ++++
 4 files changed, 15 insertions(+), 33 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 224e86baeca..0e6ec525018 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -72,7 +72,9 @@ New Features
 
 Improvements
 ---------------------
-(No changes)
+* SOLR-16924: RESTORECORE now sets the UpdateLog to ACTIVE state instead of 
requiring a separate
+  REQUESTAPPLYUPDATES call in Collection restore. The latter will still happen 
in 9.x for
+  backwards-compatibility.  (Julia Lamoine, David Smiley)
 
 Optimizations
 ---------------------
diff --git 
a/solr/core/src/java/org/apache/solr/cloud/api/collections/RestoreCmd.java 
b/solr/core/src/java/org/apache/solr/cloud/api/collections/RestoreCmd.java
index 2140078ed1e..7621750a5f5 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/RestoreCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/RestoreCmd.java
@@ -300,7 +300,6 @@ public class RestoreCmd implements 
CollApiCmds.CollectionApiCommand {
           rc.repo,
           rc.shardHandler,
           rc.asyncId);
-      requestReplicasToApplyBufferUpdates(restoreCollection, rc.asyncId, 
rc.shardHandler);
       markAllShardsAsActive(restoreCollection);
       addReplicasToShards(results, clusterState, restoreCollection, 
replicaPositions, rc.asyncId);
       restoringAlias(rc.backupProperties);
@@ -527,37 +526,6 @@ public class RestoreCmd implements 
CollApiCmds.CollectionApiCommand {
       }
     }
 
-    private void requestReplicasToApplyBufferUpdates(
-        DocCollection restoreCollection, String asyncId, ShardHandler 
shardHandler) {
-      ShardRequestTracker shardRequestTracker =
-          CollectionHandlingUtils.asyncRequestTracker(asyncId, ccc);
-
-      for (Slice s : restoreCollection.getSlices()) {
-        for (Replica r : s.getReplicas()) {
-          String nodeName = r.getNodeName();
-          String coreNodeName = r.getCoreName();
-          Replica.State stateRep = r.getState();
-
-          log.debug(
-              "Calling REQUESTAPPLYUPDATES on: nodeName={}, coreNodeName={}, 
state={}",
-              nodeName,
-              coreNodeName,
-              stateRep);
-
-          ModifiableSolrParams params = new ModifiableSolrParams();
-          params.set(
-              CoreAdminParams.ACTION,
-              CoreAdminParams.CoreAdminAction.REQUESTAPPLYUPDATES.toString());
-          params.set(CoreAdminParams.NAME, coreNodeName);
-
-          shardRequestTracker.sendShardRequest(nodeName, params, shardHandler);
-        }
-
-        shardRequestTracker.processResponses(
-            new NamedList<>(), shardHandler, true, "REQUESTAPPLYUPDATES calls 
did not succeed");
-      }
-    }
-
     // Mark all shards in ACTIVE STATE
     private void markAllShardsAsActive(DocCollection restoreCollection)
         throws KeeperException, InterruptedException {
diff --git 
a/solr/core/src/java/org/apache/solr/handler/admin/api/RestoreCoreAPI.java 
b/solr/core/src/java/org/apache/solr/handler/admin/api/RestoreCoreAPI.java
index 7e8ccf29862..fe80576fa67 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/api/RestoreCoreAPI.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/api/RestoreCoreAPI.java
@@ -42,6 +42,7 @@ import org.apache.solr.jersey.JacksonReflectMapWriter;
 import org.apache.solr.jersey.PermissionName;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.update.UpdateLog;
 
 /**
  * V2 API for restoring a previously taken backup to a core
@@ -146,6 +147,12 @@ public class RestoreCoreAPI extends CoreAdminAPIBase {
           .getZkController()
           .getShardTerms(cd.getCollectionName(), cd.getShardId())
           .ensureHighestTermsAreNotZero();
+
+      // transitions state of update log to ACTIVE
+      UpdateLog updateLog = core.getUpdateHandler().getUpdateLog();
+      if (updateLog != null) {
+        updateLog.applyBufferedUpdates();
+      }
     }
   }
 
diff --git 
a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc 
b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
index fed3ed14110..b90e1daf6b4 100644
--- 
a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
+++ 
b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc
@@ -30,6 +30,11 @@ Before starting an upgrade to this version of Solr, please 
take the time to revi
 
 Starting in 10, the Maven POM for SolrJ does not refer to SolrJ modules like 
ZooKeeper.  If you require such functionality, you need to add additional 
dependencies.
 
+=== Backup / Restore
+
+If an in-place upgrade is occurring, it's best to ensure that no Collection 
backups are being restored _while_ this happens.
+It's possible for a restored collection to not accept future indexing.
+
 === Deprecation removals
 
 * The `jaegertracer-configurator` module, which was deprecated in 9.2, is 
removed. Users should migrate to the `opentelemetry` module.

Reply via email to