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

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


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 6733c65d20c SOLR-17231: Don't try buffering updates when there's no 
update log (cherry-pick from #3880) (#3887)
6733c65d20c is described below

commit 6733c65d20c47ffd09dbd34f47e5cd4e4f7f4a9a
Author: Andrzej BiaƂecki <[email protected]>
AuthorDate: Mon Nov 24 15:52:47 2025 +0100

    SOLR-17231: Don't try buffering updates when there's no update log 
(cherry-pick from #3880) (#3887)
---
 changelog/unreleased/solr-17231.yml                | 10 ++++++++++
 .../src/java/org/apache/solr/core/SolrCore.java    |  8 +++++---
 .../org/apache/solr/cloud/TestPullReplica.java     | 22 ++++++++++++++++++++++
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/changelog/unreleased/solr-17231.yml 
b/changelog/unreleased/solr-17231.yml
new file mode 100644
index 00000000000..4f7ec2cdd08
--- /dev/null
+++ b/changelog/unreleased/solr-17231.yml
@@ -0,0 +1,10 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Don't buffer updates on replicas without update log (e.g. PULL).
+type: fixed # added, changed, fixed, deprecated, removed, dependency_update, 
security, other
+authors:
+  - name: Andrzej Bialecki
+links:
+  - name: SOLR-17231
+    url: https://issues.apache.org/jira/browse/SOLR-17231
+issues:
+  - 17231
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java 
b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 6108e5e38cf..1b0ef2e3f4f 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1246,10 +1246,12 @@ public class SolrCore implements SolrInfoBean, 
Closeable {
 
       // ZK pre-register would have already happened so we read slice 
properties now
       final ClusterState clusterState = 
coreContainer.getZkController().getClusterState();
+      final CloudDescriptor cloudDescriptor = 
coreDescriptor.getCloudDescriptor();
       final DocCollection collection =
-          
clusterState.getCollection(coreDescriptor.getCloudDescriptor().getCollectionName());
-      final Slice slice = 
collection.getSlice(coreDescriptor.getCloudDescriptor().getShardId());
-      if (slice.getState() == Slice.State.CONSTRUCTION) {
+          clusterState.getCollection(cloudDescriptor.getCollectionName());
+      final Slice slice = collection.getSlice(cloudDescriptor.getShardId());
+      if (slice.getState() == Slice.State.CONSTRUCTION
+          && getUpdateHandler().getUpdateLog() != null) {
         // set update log to buffer before publishing the core
         getUpdateHandler().getUpdateLog().bufferUpdates();
       }
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java 
b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
index 88bbb6a4997..09c80992ca7 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
@@ -421,6 +421,28 @@ public class TestPullReplica extends SolrCloudTestCase {
     doTestNoLeader(false);
   }
 
+  @Test
+  public void testNoBufferingInPullIfConstructing() throws Exception {
+    CollectionAdminRequest.createCollection(collectionName, "conf", 1, 1, 0, 0)
+        .process(cluster.getSolrClient());
+    waitForState("Replica not added", collectionName, activeReplicaCount(1, 0, 
0));
+
+    setSliceState(collectionName, "shard1", Slice.State.CONSTRUCTION);
+
+    CollectionAdminRequest.addReplicaToShard(collectionName, "shard1", 
Replica.Type.PULL)
+        .process(cluster.getSolrClient());
+    waitForState("Replica not added", collectionName, activeReplicaCount(1, 0, 
1));
+  }
+
+  private void setSliceState(String collectionName, String shardId, 
Slice.State state)
+      throws Exception {
+    ShardTestUtil.setSliceState(cluster, collectionName, shardId, state);
+    waitForState(
+        "Expected shard " + shardId + " to be in state " + state,
+        collectionName,
+        c -> c.getSlice(shardId).getState() == state);
+  }
+
   @Ignore("Ignore until I figure out a way to reliably record state 
transitions")
   public void testPullReplicaStates() throws Exception {
     // Validate that pull replicas go through the correct states when 
starting, stopping,

Reply via email to