SOLR-10962: Make ReplicationHandler's commitReserveDuration configurable in SolrCloud mode.

(Ramsey Haddad, Christine Poerschke, hossman)
This commit is contained in:
Christine Poerschke 2017-09-21 15:54:46 +01:00
parent b05d1f23cf
commit 56b8ad2f08
3 changed files with 27 additions and 3 deletions

View File

@ -64,6 +64,9 @@ Upgrade Notes
makes it much easier for evaluators to handle differing data types (primitives, objects, arrays,
lists, and so forth). (Dennis Gove)
* SOLR-10962: in the ReplicationHandler the master.commitReserveDuration sub-element is deprecated. Instead
please configure a direct commitReserveDuration element for use in all modes (master, slave, cloud).
New Features
----------------------
@ -89,6 +92,8 @@ New Features
* SOLR-11316: JSON Facet API: min/max aggregations are now supported on single-valued date fields.
(yonik)
* SOLR-10962: Make ReplicationHandler's commitReserveDuration configurable in SolrCloud mode.
(Ramsey Haddad, Christine Poerschke, hossman)
Bug Fixes
----------------------

View File

@ -68,6 +68,7 @@ import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.RateLimiter;
import org.apache.lucene.util.Version;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.params.CommonParams;
@ -81,6 +82,7 @@ import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.common.util.SuppressForbidden;
import org.apache.solr.core.CloseHook;
import static org.apache.solr.core.Config.assertWarnOrFail;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.DirectoryFactory.DirContext;
import org.apache.solr.core.IndexDeletionPolicyWrapper;
@ -1201,6 +1203,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
public void inform(SolrCore core) {
this.core = core;
registerCloseHook();
Long deprecatedReserveCommitDuration = null;
Object nbtk = initArgs.get(NUMBER_BACKUPS_TO_KEEP_INIT_PARAM);
if(nbtk!=null) {
numberBackupsToKeep = Integer.parseInt(nbtk.toString());
@ -1316,10 +1319,26 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
String reserve = (String) master.get(RESERVE);
if (reserve != null && !reserve.trim().equals("")) {
reserveCommitDuration = readIntervalMs(reserve);
deprecatedReserveCommitDuration = reserveCommitDuration;
// remove this error check & backcompat logic when Version.LUCENE_7_1_0 is removed
assertWarnOrFail(
"Beginning with Solr 7.1, master."+RESERVE + " is deprecated and should now be configured directly on the ReplicationHandler.",
(null == reserve),
core.getSolrConfig().luceneMatchVersion.onOrAfter(Version.LUCENE_7_1_0));
}
LOG.info("Commits will be reserved for " + reserveCommitDuration);
isMaster = true;
}
{
final String reserve = (String) initArgs.get(RESERVE);
if (reserve != null && !reserve.trim().equals("")) {
reserveCommitDuration = readIntervalMs(reserve);
if (deprecatedReserveCommitDuration != null) {
throw new IllegalArgumentException("'master."+RESERVE+"' and '"+RESERVE+"' are mutually exclusive.");
}
}
}
LOG.info("Commits will be reserved for " + reserveCommitDuration + "ms.");
}
// check master or slave is enabled

View File

@ -101,7 +101,7 @@ Integer specifying how many backups to keep. This can be used to delete all but
The configuration files to replicate, separated by a comma.
`commitReserveDuration`::
If your commits are very frequent and your network is slow, you can tweak this parameter to increase the amount of time taken to download 5Mb from the master to a slave. The default is 10 seconds.
If your commits are very frequent and your network is slow, you can tweak this parameter to increase the amount of time expected to be required to transfer data. The default is `00:00:10` i.e. 10 seconds.
The example below shows a possible 'master' configuration for the `ReplicationHandler`, including a fixed number of backups and an invariant setting for the `maxWriteMBPerSec` request parameter to prevent slaves from saturating its network interface
@ -112,9 +112,9 @@ The example below shows a possible 'master' configuration for the `ReplicationHa
<str name="replicateAfter">optimize</str>
<str name="backupAfter">optimize</str>
<str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
<str name="commitReserveDuration">00:00:10</str>
</lst>
<int name="maxNumberOfBackups">2</int>
<str name="commitReserveDuration">00:00:10</str>
<lst name="invariants">
<str name="maxWriteMBPerSec">16</str>
</lst>