mirror of https://github.com/apache/lucene.git
SOLR-3361: fix "maxNumberOfBackups" to work if backups are triggered on commit
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1329337 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9bf158e095
commit
013aebd3ae
|
@ -379,6 +379,9 @@ Bug Fixes
|
|||
|
||||
* SOLR-3352: eDismax: pf2 should kick in for a query with 2 terms (janhoy)
|
||||
|
||||
* SOLR-3361: ReplicationHandler "maxNumberOfBackups" doesn't work if backups are triggered on commit
|
||||
(James Dyer, Tomas Fernandez Lobbe)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -994,8 +994,12 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
|
|||
}
|
||||
if (snapshoot) {
|
||||
try {
|
||||
int numberToKeep = numberBackupsToKeep;
|
||||
if (numberToKeep < 1) {
|
||||
numberToKeep = Integer.MAX_VALUE;
|
||||
}
|
||||
SnapShooter snapShooter = new SnapShooter(core, null);
|
||||
snapShooter.createSnapAsync(currentCommitPoint, ReplicationHandler.this);
|
||||
snapShooter.createSnapAsync(currentCommitPoint, numberToKeep, ReplicationHandler.this);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Exception while snapshooting", e);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
<requestHandler name="/replication" class="solr.ReplicationHandler">
|
||||
<lst name="master">
|
||||
<str name="replicateAfter">commit</str>
|
||||
<str name="backupAfter">commit</str>
|
||||
<str name="confFiles">schema-replication2.xml:schema.xml</str>
|
||||
</lst>
|
||||
<str name="maxNumberOfBackups">1</str>
|
||||
|
|
|
@ -243,7 +243,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
doTestReplicateAfterCoreReload();
|
||||
doTestReplicateAfterCoreReload();
|
||||
doTestDetails();
|
||||
doTestReplicateAfterWrite2Slave();
|
||||
doTestIndexAndConfigReplication();
|
||||
|
@ -776,7 +776,6 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
if(random().nextBoolean()) {
|
||||
configFile = "solrconfig-master1-keepOneBackup.xml";
|
||||
addNumberToKeepInRequest = false;
|
||||
backupKeepParamName = ReplicationHandler.NUMBER_BACKUPS_TO_KEEP_INIT_PARAM;
|
||||
}
|
||||
|
||||
masterJetty.stop();
|
||||
|
@ -864,8 +863,16 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
File[] snapDir = new File[2];
|
||||
String firstBackupTimestamp = null;
|
||||
for(int i=0 ; i<2 ; i++) {
|
||||
BackupThread backupThread = new BackupThread(addNumberToKeepInRequest, backupKeepParamName);
|
||||
backupThread.start();
|
||||
BackupThread backupThread = null;
|
||||
if(!addNumberToKeepInRequest) {
|
||||
if(random().nextBoolean()) {
|
||||
masterClient.commit();
|
||||
} else {
|
||||
backupThread = new BackupThread(addNumberToKeepInRequest, backupKeepParamName);
|
||||
backupThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File dataDir = new File(master.getDataDir());
|
||||
|
||||
|
@ -890,7 +897,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
waitCnt++;
|
||||
}
|
||||
|
||||
if(backupThread.fail != null) {
|
||||
if(backupThread!= null && backupThread.fail != null) {
|
||||
fail(backupThread.fail);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue