This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch branch_9_9
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9_9 by this push:
new 1f6458b344e SOLR-17860: Support PULL replicas in
DocBasedVersionConstraintsProcessor (#3471)
1f6458b344e is described below
commit 1f6458b344eca013b96ea4547e15a46a9b55324a
Author: Houston Putman <[email protected]>
AuthorDate: Thu Aug 21 11:09:52 2025 -0700
SOLR-17860: Support PULL replicas in DocBasedVersionConstraintsProcessor
(#3471)
(cherry picked from commit 26ad021d0776fc950afa9216475a1bd945bbc5c7)
---
solr/CHANGES.txt | 11 ++---------
...DocBasedVersionConstraintsProcessorFactory.java | 15 ++++++++++-----
.../solr/cloud/TestDistribDocBasedVersion.java | 22 ++++++++++++++++++++++
3 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 294a91a0d57..d00bda80511 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -4,15 +4,6 @@ This file lists Solr's raw release notes with details of every
change to Solr.
Most people will find the solr-upgrade-notes.adoc file more approachable.
https://github.com/apache/solr/blob/main/solr/solr-ref-guide/modules/upgrade-notes/pages/solr-upgrade-notes.adoc
-================== 9.9.1 ==================
-Bug Fixes
----------------------
-(No changes)
-
-Dependency Upgrades
----------------------
-(No changes)
-
================== 9.9.1 ==================
Bug Fixes
---------------------
@@ -23,6 +14,8 @@ Bug Fixes
* SOLR-17830: v1 Restore API no longer conflates backup-name and
collection-name during validation. (Abhishek Umarjikar via Jason Gerlowski)
+* SOLR-17860: DocBasedVersionConstraintsProcessorFactory now supports PULL
replicas. (Houston Putman)
+
Dependency Upgrades
---------------------
(No changes)
diff --git
a/solr/core/src/java/org/apache/solr/update/processor/DocBasedVersionConstraintsProcessorFactory.java
b/solr/core/src/java/org/apache/solr/update/processor/DocBasedVersionConstraintsProcessorFactory.java
index 1088d3280de..c7fbcc88892 100644
---
a/solr/core/src/java/org/apache/solr/update/processor/DocBasedVersionConstraintsProcessorFactory.java
+++
b/solr/core/src/java/org/apache/solr/update/processor/DocBasedVersionConstraintsProcessorFactory.java
@@ -170,15 +170,20 @@ public class DocBasedVersionConstraintsProcessorFactory
extends UpdateRequestPro
@Override
public void inform(SolrCore core) {
-
- if (core.getUpdateHandler().getUpdateLog() == null) {
- throw new SolrException(SERVER_ERROR, "updateLog must be enabled.");
- }
-
if (core.getLatestSchema().getUniqueKeyField() == null) {
throw new SolrException(SERVER_ERROR, "schema must have uniqueKey
defined.");
}
+ // We can only be sure that no-update-log is safe if the core is a
SolrCloud replica and is not
+ // leader eligible, because those cores will all have the "isNotLeader()"
return true, and the
+ // URP logic will be ignored. Otherwise, we need to ensure an update log
exists.
+ if (core.getCoreDescriptor().getCloudDescriptor() == null
+ ||
core.getCoreDescriptor().getCloudDescriptor().getReplicaType().leaderEligible) {
+ if (core.getUpdateHandler().getUpdateLog() == null) {
+ throw new SolrException(SERVER_ERROR, "updateLog must be enabled.");
+ }
+ }
+
useFieldCache = true;
for (String versionField : versionFields) {
SchemaField userVersionField =
core.getLatestSchema().getField(versionField);
diff --git
a/solr/core/src/test/org/apache/solr/cloud/TestDistribDocBasedVersion.java
b/solr/core/src/test/org/apache/solr/cloud/TestDistribDocBasedVersion.java
index a0fc4b2b988..2efdb51ccde 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestDistribDocBasedVersion.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestDistribDocBasedVersion.java
@@ -21,10 +21,12 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrException;
+import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.util.StrUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -108,6 +110,26 @@ public class TestDistribDocBasedVersion extends
AbstractFullDistribZkTestBase {
}
}
+ @Test
+ public void testPullReplica() throws Exception {
+ try {
+ CollectionAdminRequest.addReplicaToShard(DEFAULT_COLLECTION, "shard1")
+ .setType(Replica.Type.PULL)
+ .process(cloudClient);
+ } finally {
+ List<Replica> pullReplicas =
+ cloudClient
+ .getClusterStateProvider()
+ .getCollection(DEFAULT_COLLECTION)
+ .getSlice("shard1")
+ .getReplicas(r -> r.getType().equals(Replica.Type.PULL));
+ for (Replica replica : pullReplicas) {
+ CollectionAdminRequest.deleteReplica(DEFAULT_COLLECTION, "shard1",
replica.getName())
+ .process(cloudClient);
+ }
+ }
+ }
+
private void doTestHardFail() throws Exception {
log.info("### STARTING doTestHardFail");