diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index f9b434018ed..a7a5ef5683c 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -93,6 +93,8 @@ Deprecation Removals * SOLR-17564: Remove code in Assign used for backwards compatibility with Collections created prior to 7.0 (Paul McArthur) +* SOLR-17576: Remove deprecated master/slave option language from ReplicationHandler. (Eric Pugh) + Dependency Upgrades --------------------- (No changes) diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java index 50f845e1609..a933bb6e1d6 100644 --- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java +++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java @@ -27,8 +27,6 @@ import static org.apache.solr.handler.ReplicationHandler.CONF_FILES; import static org.apache.solr.handler.ReplicationHandler.FETCH_FROM_LEADER; import static org.apache.solr.handler.ReplicationHandler.LEADER_URL; -import static org.apache.solr.handler.ReplicationHandler.LEGACY_LEADER_URL; -import static org.apache.solr.handler.ReplicationHandler.LEGACY_SKIP_COMMIT_ON_LEADER_VERSION_ZERO; import static org.apache.solr.handler.ReplicationHandler.SIZE; import static org.apache.solr.handler.ReplicationHandler.SKIP_COMMIT_ON_LEADER_VERSION_ZERO; import static org.apache.solr.handler.admin.api.ReplicationAPIBase.CHECKSUM; @@ -279,17 +277,11 @@ public IndexFetcher( if (fetchFromLeader != null && fetchFromLeader instanceof Boolean) { this.fetchFromLeader = (boolean) fetchFromLeader; } - Object skipCommitOnLeaderVersionZero = - ReplicationHandler.getObjectWithBackwardCompatibility( - initArgs, - SKIP_COMMIT_ON_LEADER_VERSION_ZERO, - LEGACY_SKIP_COMMIT_ON_LEADER_VERSION_ZERO); + Object skipCommitOnLeaderVersionZero = initArgs.get(SKIP_COMMIT_ON_LEADER_VERSION_ZERO); if (skipCommitOnLeaderVersionZero != null && skipCommitOnLeaderVersionZero instanceof Boolean) { this.skipCommitOnLeaderVersionZero = (boolean) skipCommitOnLeaderVersionZero; } - String leaderUrl = - ReplicationHandler.getObjectWithBackwardCompatibility( - initArgs, LEADER_URL, LEGACY_LEADER_URL); + String leaderUrl = (String) initArgs.get(LEADER_URL); if (leaderUrl == null && !this.fetchFromLeader) throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "'leaderUrl' is required for a follower"); diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java index ebea07e26bc..2424addaff8 100644 --- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java @@ -307,8 +307,7 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw } else if (command.equals(CMD_SHOW_COMMITS)) { populateCommitInfo(rsp); } else if (command.equals(CMD_DETAILS)) { - getReplicationDetails( - rsp, getBoolWithBackwardCompatibility(solrParams, "follower", "slave", true)); + getReplicationDetails(rsp, solrParams.getBool("follower", true)); } else if (CMD_ENABLE_REPL.equalsIgnoreCase(command)) { replicationEnabled.set(true); rsp.add(STATUS, OK_STATUS); @@ -367,39 +366,6 @@ private void getFileStream(SolrParams solrParams, SolrQueryResponse rsp, SolrQue solrParams.getLong(GENERATION)); } - static boolean getBoolWithBackwardCompatibility( - SolrParams params, String preferredKey, String alternativeKey, boolean defaultValue) { - Boolean value = params.getBool(preferredKey); - if (value != null) { - return value; - } - return params.getBool(alternativeKey, defaultValue); - } - - @SuppressWarnings("unchecked") - static T getObjectWithBackwardCompatibility( - SolrParams params, String preferredKey, String alternativeKey, T defaultValue) { - Object value = params.get(preferredKey); - if (value != null) { - return (T) value; - } - value = params.get(alternativeKey); - if (value != null) { - return (T) value; - } - return defaultValue; - } - - @SuppressWarnings("unchecked") - public static T getObjectWithBackwardCompatibility( - NamedList params, String preferredKey, String alternativeKey) { - Object value = params.get(preferredKey); - if (value != null) { - return (T) value; - } - return (T) params.get(alternativeKey); - } - private void reportErrorOnResponse(SolrQueryResponse response, String message, Exception e) { response.add(STATUS, ERR_STATUS); response.add(MESSAGE, message); @@ -432,8 +398,7 @@ private void deleteSnapshot(ModifiableSolrParams params, SolrQueryResponse rsp) private void fetchIndex(SolrParams solrParams, SolrQueryResponse rsp) throws InterruptedException { - String leaderUrl = - getObjectWithBackwardCompatibility(solrParams, LEADER_URL, LEGACY_LEADER_URL, null); + String leaderUrl = solrParams.get(LEADER_URL, null); if (!isFollower && leaderUrl == null) { reportErrorOnResponse(rsp, "No follower configured or no 'leaderUrl' specified", null); return; @@ -500,11 +465,7 @@ static Long getCheckSum(Checksum checksum, Path f) { private volatile IndexFetcher currentIndexFetcher; public IndexFetchResult doFetch(SolrParams solrParams, boolean forceReplication) { - String leaderUrl = - solrParams == null - ? null - : ReplicationHandler.getObjectWithBackwardCompatibility( - solrParams, LEADER_URL, LEGACY_LEADER_URL, null); + String leaderUrl = solrParams == null ? null : solrParams.get(LEADER_URL, null); if (!indexFetchLock.tryLock()) return IndexFetchResult.LOCK_OBTAIN_FAILED; if (core.getCoreContainer().isShutDown()) { log.warn("I was asked to replicate but CoreContainer is shutting down"); @@ -1290,14 +1251,14 @@ public void inform(SolrCore core) { } else { replicationHandlerConfig.numberBackupsToKeep = 0; } - NamedList follower = getObjectWithBackwardCompatibility(initArgs, "follower", "slave"); + NamedList follower = (NamedList) initArgs.get("follower"); boolean enableFollower = isEnabled(follower); if (enableFollower) { currentIndexFetcher = pollingIndexFetcher = new IndexFetcher(follower, this, core); setupPolling((String) follower.get(ReplicationAPIBase.POLL_INTERVAL)); isFollower = true; } - NamedList leader = getObjectWithBackwardCompatibility(initArgs, "leader", "master"); + NamedList leader = (NamedList) initArgs.get("leader"); boolean enableLeader = isEnabled(leader); if (enableLeader || (enableFollower && !currentIndexFetcher.fetchFromLeader)) { @@ -1577,11 +1538,6 @@ private Long readIntervalNs(String interval) { public static final String LEADER_URL = "leaderUrl"; - /** - * @deprecated Only used for backwards compatibility. Use {@link #LEADER_URL} - */ - @Deprecated public static final String LEGACY_LEADER_URL = "masterUrl"; - public static final String FETCH_FROM_LEADER = "fetchFromLeader"; // in case of TLOG replica, if leaderVersion = zero, don't do commit @@ -1591,14 +1547,6 @@ private Long readIntervalNs(String interval) { // state from leader public static final String SKIP_COMMIT_ON_LEADER_VERSION_ZERO = "skipCommitOnLeaderVersionZero"; - /** - * @deprecated Only used for backwards compatibility. Use {@link - * #SKIP_COMMIT_ON_LEADER_VERSION_ZERO} - */ - @Deprecated - public static final String LEGACY_SKIP_COMMIT_ON_LEADER_VERSION_ZERO = - "skipCommitOnMasterVersionZero"; - public static final String MESSAGE = "message"; public static final String COMMAND = "command"; diff --git a/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java index 897d9921e2c..b174e177f1a 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/HealthCheckHandler.java @@ -243,9 +243,8 @@ private boolean isWithinGenerationLag( IndexFetcher indexFetcher = null; try { // may not be the best way to get leader's replicableCommit - NamedList follower = - ReplicationHandler.getObjectWithBackwardCompatibility( - replicationHandler.getInitArgs(), "follower", "slave"); + NamedList follower = (NamedList) replicationHandler.getInitArgs().get("follower"); + indexFetcher = new IndexFetcher(follower, replicationHandler, core); NamedList replicableCommitOnLeader = indexFetcher.getLatestVersion(); diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-replication-legacy.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-replication-legacy.xml deleted file mode 100644 index ddd116be38a..00000000000 --- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-replication-legacy.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - ${tests.luceneMatchVersion:LATEST} - - - ${solr.data.dir:} - - - - - - - - true - - - - - - - - - - - - - - commit - - - http://127.0.0.1:TEST_PORT/solr/collection1 - 00:00:01 - COMPRESSION - - - - - - - max-age=30, public - - - - diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java index 14714b64c26..b30e20f70bf 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java +++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java @@ -78,7 +78,6 @@ import org.apache.solr.util.TimeOut; import org.junit.After; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,14 +102,6 @@ public class TestReplicationHandler extends SolrTestCaseJ4 { // index from previous test method static int nDocs = 500; - /* For testing backward compatibility, remove for 10.x */ - private static boolean useLegacyParams = false; - - @BeforeClass - public static void beforeClass() { - useLegacyParams = rarely(); - } - @Override @Before public void setUp() throws Exception { @@ -388,38 +379,6 @@ public void doTestDetails() throws Exception { } } - @Test - public void testLegacyConfiguration() throws Exception { - SolrInstance solrInstance = null; - JettySolrRunner instanceJetty = null; - SolrClient client = null; - try { - solrInstance = - new SolrInstance( - createTempDir("solr-instance").toFile(), - "replication-legacy", - leaderJetty.getLocalPort()); - solrInstance.setUp(); - instanceJetty = createAndStartJetty(solrInstance); - client = - ReplicationTestHelper.createNewSolrClient( - buildUrl(instanceJetty.getLocalPort()), DEFAULT_TEST_CORENAME); - - NamedList details = getDetails(client); - - assertEquals("repeater isLeader?", "true", details.get("isLeader")); - assertEquals("repeater isFollower?", "true", details.get("isFollower")); - assertNotNull("repeater has leader section", details.get("leader")); - assertNotNull("repeater has follower section", details.get("follower")); - - } finally { - if (instanceJetty != null) { - instanceJetty.stop(); - } - if (client != null) client.close(); - } - } - /** * Verify that empty commits and/or commits with openSearcher=false on the leader do not cause * subsequent replication problems on the follower @@ -779,11 +738,8 @@ private NamedList getFollowerDetails() throws SolrServerException, IOExc ModifiableSolrParams params = new ModifiableSolrParams(); params.set(CommonParams.QT, "/replication"); params.set("command", "details"); - if (useLegacyParams) { - params.set("slave", "true"); - } else { - params.set("follower", "true"); - } + params.set("follower", "true"); + QueryResponse response = followerClient.query(params); // details/follower/timesIndexReplicated @@ -825,9 +781,6 @@ public void doTestIndexFetchWithLeaderUrl() throws Exception { assertEquals(nDocs, leaderQueryResult.getNumFound()); String urlKey = "leaderUrl"; - if (useLegacyParams) { - urlKey = "masterUrl"; - } // index fetch String leaderUrl = @@ -1667,48 +1620,6 @@ public void testEmptyBackups() throws Exception { } } - public void testGetBoolWithBackwardCompatibility() { - assertTrue(ReplicationHandler.getBoolWithBackwardCompatibility(params(), "foo", "bar", true)); - assertFalse(ReplicationHandler.getBoolWithBackwardCompatibility(params(), "foo", "bar", false)); - assertTrue( - ReplicationHandler.getBoolWithBackwardCompatibility( - params("foo", "true"), "foo", "bar", false)); - assertTrue( - ReplicationHandler.getBoolWithBackwardCompatibility( - params("bar", "true"), "foo", "bar", false)); - assertTrue( - ReplicationHandler.getBoolWithBackwardCompatibility( - params("foo", "true", "bar", "false"), "foo", "bar", false)); - } - - public void testGetObjectWithBackwardCompatibility() { - assertEquals( - "aaa", - ReplicationHandler.getObjectWithBackwardCompatibility(params(), "foo", "bar", "aaa")); - assertEquals( - "bbb", - ReplicationHandler.getObjectWithBackwardCompatibility( - params("foo", "bbb"), "foo", "bar", "aaa")); - assertEquals( - "bbb", - ReplicationHandler.getObjectWithBackwardCompatibility( - params("bar", "bbb"), "foo", "bar", "aaa")); - assertEquals( - "bbb", - ReplicationHandler.getObjectWithBackwardCompatibility( - params("foo", "bbb", "bar", "aaa"), "foo", "bar", "aaa")); - assertNull(ReplicationHandler.getObjectWithBackwardCompatibility(params(), "foo", "bar", null)); - } - - public void testGetObjectWithBackwardCompatibilityFromNL() { - NamedList nl = new NamedList<>(); - assertNull(ReplicationHandler.getObjectWithBackwardCompatibility(nl, "foo", "bar")); - nl.add("bar", "bbb"); - assertEquals("bbb", ReplicationHandler.getObjectWithBackwardCompatibility(nl, "foo", "bar")); - nl.add("foo", "aaa"); - assertEquals("aaa", ReplicationHandler.getObjectWithBackwardCompatibility(nl, "foo", "bar")); - } - private static class AddExtraDocs implements Runnable { SolrClient leaderClient; 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 33440aec93b..97942e989c1 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 @@ -85,3 +85,5 @@ Please note this also removes the ability to share resource intensive objects ac * The language specific Response Writers, which were deprecated in 9.8 in favour of more widely used formats like JSON have been removed. The removed writer types (invoked as part of the `wt` parameter) include `python`, `ruby`, `php`, and `phps`. + +* The deprecated support for configuring replication using master/slave terminology is removed. Use leader/follower.