Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-14034: remove deprecated min_rf references (#2152)

Tim Dillon17adcc7aa499
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 06a5821ac97..fd439cca825 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -180,6 +180,8 @@ Other Changes
* SOLR-15016: Replica placement plugins should use container plugins API / configs. (ab, ilan)
+* SOLR-14034: Remove deprecated min_rf references (Tim Dillon)
+
Bug Fixes
---------------------
* SOLR-14546: Fix for a relatively hard to hit issue in OverseerTaskProcessor that could lead to out of order execution
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
index 8da2df75fb4..6f61f18b0ec 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java
@@ -281,11 +281,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
params.set(DISTRIB_FROM, ZkCoreNodeProps.getCoreUrl(
zkController.getBaseUrl(), req.getCore().getName()));
- if (req.getParams().get(UpdateRequest.MIN_REPFACT) != null) {
- // TODO: Kept for rolling upgrades only. Should be removed in Solr 9
- params.set(UpdateRequest.MIN_REPFACT, req.getParams().get(UpdateRequest.MIN_REPFACT));
- }
-
if (cmd.isInPlaceUpdate()) {
params.set(DISTRIB_INPLACE_PREVVERSION, String.valueOf(cmd.prevVersion));
@@ -359,10 +354,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
params.set(DISTRIB_FROM, ZkCoreNodeProps.getCoreUrl(
zkController.getBaseUrl(), req.getCore().getName()));
- if (req.getParams().get(UpdateRequest.MIN_REPFACT) != null) {
- // TODO: Kept for rolling upgrades only. Remove in Solr 9
- params.add(UpdateRequest.MIN_REPFACT, req.getParams().get(UpdateRequest.MIN_REPFACT));
- }
cmdDistrib.distribDelete(cmd, nodes, params, false, rollupReplicationTracker, leaderReplicationTracker);
}
}
@@ -428,11 +419,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
outParams.remove("commit"); // this will be distributed from the local commit
-
- if (params.get(UpdateRequest.MIN_REPFACT) != null) {
- // TODO: Kept this for rolling upgrades. Remove in Solr 9
- outParams.add(UpdateRequest.MIN_REPFACT, req.getParams().get(UpdateRequest.MIN_REPFACT));
- }
cmdDistrib.distribDelete(cmd, leaders, outParams, false, rollupReplicationTracker, null);
if (!leaderForAnyShard) {
@@ -1217,10 +1203,6 @@ public class DistributedZkUpdateProcessor extends DistributedUpdateProcessor {
if (rollupReplicationTracker != null) {
achievedRf = rollupReplicationTracker.getAchievedRf();
}
- if (req.getParams().get(UpdateRequest.MIN_REPFACT) != null) {
- // Unused, but kept for back compatibility. To be removed in Solr 9
- rsp.getResponseHeader().add(UpdateRequest.MIN_REPFACT, Integer.parseInt(req.getParams().get(UpdateRequest.MIN_REPFACT)));
- }
rsp.getResponseHeader().add(UpdateRequest.REPFACT, achievedRf);
rollupReplicationTracker = null;
leaderReplicationTracker = null;
diff --git a/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java b/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java
index 68b2b430b09..68957151d93 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ForceLeaderTest.java
@@ -194,7 +194,7 @@ public class ForceLeaderTest extends HttpPartitionTest {
// indexing during a partition
log.info("Sending a doc during the network partition...");
JettySolrRunner leaderJetty = getJettyOnPort(getReplicaPort(leader));
- sendDoc(2, null, leaderJetty);
+ sendDoc(2, leaderJetty);
for (Replica replica : notLeaders) {
waitForState(collectionName, replica.getName(), State.DOWN, 60000);
@@ -292,4 +292,3 @@ public class ForceLeaderTest extends HttpPartitionTest {
return numActiveReplicas;
}
}
-
diff --git a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
index 824845c0a0e..081ed521381 100644
--- a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
@@ -162,7 +162,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
createCollection(testCollectionName, "conf1", 1, 2);
cloudClient.setDefaultCollection(testCollectionName);
- sendDoc(1, 2);
+ sendDoc(1);
JettySolrRunner leaderJetty = getJettyOnPort(getReplicaPort(getShardLeader(testCollectionName, "shard1", 1000)));
List<Replica> notLeaders =
@@ -176,7 +176,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
leaderProxy.close();
// indexing during a partition
- int achievedRf = sendDoc(2, 1, leaderJetty);
+ int achievedRf = sendDoc(2, leaderJetty);
assertEquals("Unexpected achieved replication factor", 1, achievedRf);
try (ZkShardTerms zkShardTerms = new ZkShardTerms(testCollectionName, "shard1", cloudClient.getZkStateReader().getZkClient())) {
assertFalse(zkShardTerms.canBecomeLeader(notLeaders.get(0).getName()));
@@ -228,7 +228,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
leaderProxy.close();
// indexing during a partition
- sendDoc(2, null, leaderJetty);
+ sendDoc(2, leaderJetty);
// replica should publish itself as DOWN if the network is not healed after some amount time
waitForState(testCollectionName, notLeader.getName(), DOWN, 10000);
@@ -282,7 +282,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
}
}
// always send doc directly to leader without going through proxy
- sendDoc(d + 4, null, leaderJetty); // 4 is offset as we've already indexed 1-3
+ sendDoc(d + 4, leaderJetty); // 4 is offset as we've already indexed 1-3
}
// restore connectivity if lost
@@ -352,7 +352,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
leaderProxy.close();
// indexing during a partition
- sendDoc(2, null, leaderJetty);
+ sendDoc(2, leaderJetty);
Thread.sleep(sleepMsBeforeHealPartition);
proxy0.reopen();
@@ -360,7 +360,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
SocketProxy proxy1 = getProxyForReplica(notLeaders.get(1));
proxy1.close();
- sendDoc(3, null, leaderJetty);
+ sendDoc(3, leaderJetty);
Thread.sleep(sleepMsBeforeHealPartition);
proxy1.reopen();
@@ -527,30 +527,23 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
return getHttpSolrClient(url);
}
- protected int sendDoc(int docId) throws Exception {
- return sendDoc(docId, null);
- }
-
// Send doc directly to a server (without going through proxy)
- protected int sendDoc(int docId, Integer minRf, JettySolrRunner leaderJetty) throws IOException, SolrServerException {
+ protected int sendDoc(int docId, JettySolrRunner leaderJetty) throws IOException, SolrServerException {
try (HttpSolrClient solrClient = new HttpSolrClient.Builder(leaderJetty.getBaseUrl().toString()).build()) {
- return sendDoc(docId, minRf, solrClient, cloudClient.getDefaultCollection());
+ return sendDoc(docId, solrClient, cloudClient.getDefaultCollection());
}
}
- protected int sendDoc(int docId, Integer minRf) throws Exception {
- return sendDoc(docId, minRf, cloudClient, cloudClient.getDefaultCollection());
+ protected int sendDoc(int docId) throws Exception {
+ return sendDoc(docId, cloudClient, cloudClient.getDefaultCollection());
}
- protected int sendDoc(int docId, Integer minRf, SolrClient solrClient, String collection) throws IOException, SolrServerException {
+ protected int sendDoc(int docId, SolrClient solrClient, String collection) throws IOException, SolrServerException {
SolrInputDocument doc = new SolrInputDocument();
doc.addField(id, String.valueOf(docId));
doc.addField("a_t", "hello" + docId);
UpdateRequest up = new UpdateRequest();
- if (minRf != null) {
- up.setParam(UpdateRequest.MIN_REPFACT, String.valueOf(minRf));
- }
up.add(doc);
return cloudClient.getMinAchievedReplicationFactor(collection, solrClient.request(up, collection));
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java b/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java
index 41d50f3e5c7..a0affc65602 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java
@@ -124,7 +124,6 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
// send directly to the leader using HttpSolrServer instead of CloudSolrServer (to test support for non-direct updates)
UpdateRequest up = new UpdateRequest();
- maybeAddMinRfExplicitly(2, up);
up.add(batch);
Replica leader = cloudClient.getZkStateReader().getLeaderRetry(testCollectionName, shardId);
@@ -232,13 +231,11 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
// Delete the docs by ID indicated
UpdateRequest req = new UpdateRequest();
req.deleteById(byIdsList);
- maybeAddMinRfExplicitly(expectedRfByIds, req);
sendNonDirectUpdateRequestReplicaWithRetry(rep, req, expectedRfByIds, coll);
//Delete the docs by query indicated.
req = new UpdateRequest();
req.deleteByQuery("id:(" + StringUtils.join(byQueriesSet, " OR ") + ")");
- maybeAddMinRfExplicitly(expectedRfDBQ, req);
sendNonDirectUpdateRequestReplicaWithRetry(rep, req, expectedRfDBQ, coll);
}
@@ -263,12 +260,6 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
// Note that this also tests if we're wonky and return an achieved rf greater than the number of live replicas.
assertTrue("Expected rf="+expectedRf+" for batch but got "+
batchRf + "; clusterState: " + printClusterStateInfo(), batchRf == expectedRf);
- if (up.getParams() != null && up.getParams().get(UpdateRequest.MIN_REPFACT) != null) {
- // If "min_rf" was specified in the request, it must be in the response for back compatibility
- assertNotNull("Expecting min_rf to be in the response, since it was explicitly set in the request", hdr.get(UpdateRequest.MIN_REPFACT));
- assertEquals("Unexpected min_rf in the response",
- Integer.parseInt(up.getParams().get(UpdateRequest.MIN_REPFACT)), hdr.get(UpdateRequest.MIN_REPFACT));
- }
}
}
@@ -287,7 +278,7 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
assertTrue("Expected 2 active replicas for "+testCollectionName, replicas.size() == 2);
log.info("Indexing docId=1");
- int rf = sendDoc(1, minRf);
+ int rf = sendDoc(1);
assertRf(3, "all replicas should be active", rf);
// Uses cloudClient to do it's work
@@ -298,7 +289,7 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
getProxyForReplica(replicas.get(0)).close();
log.info("Indexing docId=2");
- rf = sendDoc(2, minRf);
+ rf = sendDoc(2);
assertRf(2, "one replica should be down", rf);
// Uses cloudClient to do it's work
@@ -322,7 +313,7 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
getProxyForReplica(replicas.get(1)).close();
log.info("Indexing docId=3");
- rf = sendDoc(3, minRf);
+ rf = sendDoc(3);
assertRf(1, "both replicas should be down", rf);
doDBQWithRetry(1, 5, "deletes should have propagated to only 1 replica", 1);
@@ -338,7 +329,7 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
ensureAllReplicasAreActive(testCollectionName, shardId, numShards, replicationFactor, 30);
log.info("Indexing docId=4");
- rf = sendDoc(4, minRf);
+ rf = sendDoc(4);
assertRf(3, "all replicas have been healed", rf);
doDBQWithRetry(3, 5, "delete should have propagated to all 3 replicas", 1);
@@ -367,7 +358,7 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
// send a single doc (again)
// SOLR-13599 sanity check if problem is related to "re-closing" a port on the proxy
log.info("Indexing docId=5");
- rf = sendDoc(5, minRf);
+ rf = sendDoc(5);
assertRf(2, "doc should have succeded, only one replica should be down", rf);
// now send a batch (again)
@@ -414,7 +405,7 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
Integer[] idList = docIds.toArray(new Integer[docIds.size()]);
if (idList.length == 1) {
- sendDoc(idList[0], expectedRf);
+ sendDoc(idList[0]);
return;
}
List<SolrInputDocument> batch = new ArrayList<SolrInputDocument>(10);
@@ -432,8 +423,7 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
addDocs(docIds, expectedRf, retries);
UpdateRequest req = new UpdateRequest();
req.deleteByQuery("id:(" + StringUtils.join(docIds, " OR ") + ")");
- boolean minRfExplicit = maybeAddMinRfExplicitly(expectedRf, req);
- doDelete(req, msg, expectedRf, retries, minRfExplicit);
+ doDelete(req, msg, expectedRf, retries);
}
protected void doDBIdWithRetry(int expectedRf, int retries, String msg, int docsToAdd) throws Exception {
@@ -441,17 +431,13 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
addDocs(docIds, expectedRf, retries);
UpdateRequest req = new UpdateRequest();
req.deleteById(StringUtils.join(docIds, ","));
- boolean minRfExplicit = maybeAddMinRfExplicitly(expectedRf, req);
- doDelete(req, msg, expectedRf, retries, minRfExplicit);
+ doDelete(req, msg, expectedRf, retries);
}
- protected void doDelete(UpdateRequest req, String msg, int expectedRf, int retries, boolean minRfExplicit) throws IOException, SolrServerException, InterruptedException {
+ protected void doDelete(UpdateRequest req, String msg, int expectedRf, int retries) throws IOException, SolrServerException, InterruptedException {
int achievedRf = -1;
for (int idx = 0; idx < retries; ++idx) {
NamedList<Object> response = cloudClient.request(req);
- if (minRfExplicit) {
- assertMinRfInResponse(expectedRf, response);
- }
achievedRf = cloudClient.getMinAchievedReplicationFactor(cloudClient.getDefaultCollection(), response);
if (achievedRf == expectedRf) return;
Thread.sleep(1000);
@@ -459,40 +445,20 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
assertEquals(msg, expectedRf, achievedRf);
}
- protected int sendDoc(int docId, int minRf) throws Exception {
+ protected int sendDoc(int docId) throws Exception {
UpdateRequest up = new UpdateRequest();
- boolean minRfExplicit = maybeAddMinRfExplicitly(minRf, up);
SolrInputDocument doc = new SolrInputDocument();
doc.addField(id, String.valueOf(docId));
doc.addField("a_t", "hello" + docId);
up.add(doc);
- return runAndGetAchievedRf(up, minRfExplicit, minRf);
+ return runAndGetAchievedRf(up);
}
- private int runAndGetAchievedRf(UpdateRequest up, boolean minRfExplicit, int minRf) throws SolrServerException, IOException {
+ private int runAndGetAchievedRf(UpdateRequest up) throws SolrServerException, IOException {
NamedList<Object> response = cloudClient.request(up);
- if (minRfExplicit) {
- assertMinRfInResponse(minRf, response);
- }
return cloudClient.getMinAchievedReplicationFactor(cloudClient.getDefaultCollection(), response);
}
- private void assertMinRfInResponse(int minRf, NamedList<Object> response) {
- Object minRfFromResponse = response.findRecursive("responseHeader", UpdateRequest.MIN_REPFACT);
- assertNotNull("Expected min_rf header in the response", minRfFromResponse);
- assertEquals("Unexpected min_rf in response", ((Integer)minRfFromResponse).intValue(), minRf);
- }
-
- private boolean maybeAddMinRfExplicitly(int minRf, UpdateRequest up) {
- boolean minRfExplicit = false;
- if (rarely()) {
- // test back compat behavior. Remove in Solr 9
- up.setParam(UpdateRequest.MIN_REPFACT, String.valueOf(minRf));
- minRfExplicit = true;
- }
- return minRfExplicit;
- }
-
protected void assertRf(int expected, String explain, int actual) throws Exception {
if (actual != expected) {
String assertionFailedMessage =
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
index b3d47fb0fa7..abed2aa5d75 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseCloudSolrClient.java
@@ -693,7 +693,6 @@ public abstract class BaseCloudSolrClient extends SolrClient {
T condensed = supplier.get();
int status = 0;
Integer rf = null;
- Integer minRf = null;
// TolerantUpdateProcessor
List<SimpleOrderedMap<String>> toleratedErrors = null;
@@ -716,7 +715,6 @@ public abstract class BaseCloudSolrClient extends SolrClient {
if (rf == null || routeRf < rf)
rf = routeRf;
}
- minRf = (Integer)header.get(UpdateRequest.MIN_REPFACT);
List<SimpleOrderedMap<String>> shardTolerantErrors =
(List<SimpleOrderedMap<String>>) header.get("errors");
@@ -751,8 +749,6 @@ public abstract class BaseCloudSolrClient extends SolrClient {
cheader.add("QTime", timeMillis);
if (rf != null)
cheader.add(UpdateRequest.REPFACT, rf);
- if (minRf != null)
- cheader.add(UpdateRequest.MIN_REPFACT, minRf);
if (null != toleratedErrors) {
cheader.add("maxErrors", ToleratedUpdateError.getUserFriendlyMaxErrors(maxToleratedErrors));
cheader.add("errors", toleratedErrors);
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java
index 4c86a13b762..071717bf67c 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/UpdateRequest.java
@@ -56,12 +56,6 @@ import static org.apache.solr.common.params.ShardParams._ROUTE_;
public class UpdateRequest extends AbstractUpdateRequest {
public static final String REPFACT = "rf";
- /**
- * @deprecated Solr now always includes in the response the {@link #REPFACT}, this parameter
- * doesn't need to be explicitly set
- */
- @Deprecated // SOLR-14034
- public static final String MIN_REPFACT = "min_rf";
public static final String VER = "ver";
public static final String OVERWRITE = "ow";
public static final String COMMIT_WITHIN = "cw";