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

ab 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 1344194099c SOLR-17231: Don't try buffering updates when there's no 
update log. (#3880)
1344194099c is described below

commit 1344194099c29ff2391266c77682198a3c6f4468
Author: Andrzej BiaƂecki <[email protected]>
AuthorDate: Mon Nov 24 12:27:52 2025 +0100

    SOLR-17231: Don't try buffering updates when there's no update log. (#3880)
---
 changelog/unreleased/solr-17231.yml                | 10 ++++++++++
 .../src/java/org/apache/solr/core/SolrCore.java    |  9 ++++++---
 .../org/apache/solr/cloud/TestPullReplica.java     | 22 ++++++++++++++++++++++
 3 files changed, 38 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 5c719e26745..fadde05cf70 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -85,6 +85,7 @@ import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.store.LockObtainFailedException;
 import org.apache.lucene.util.ResourceLoader;
 import org.apache.solr.client.solrj.impl.JavaBinResponseParser;
+import org.apache.solr.cloud.CloudDescriptor;
 import org.apache.solr.cloud.RecoveryStrategy;
 import org.apache.solr.cloud.ZkSolrResourceLoader;
 import org.apache.solr.common.SolrException;
@@ -1269,10 +1270,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 ba349ad9663..d96bca09215 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
@@ -430,6 +430,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