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-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
|
Other Changes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -994,8 +994,12 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
|
||||||
}
|
}
|
||||||
if (snapshoot) {
|
if (snapshoot) {
|
||||||
try {
|
try {
|
||||||
|
int numberToKeep = numberBackupsToKeep;
|
||||||
|
if (numberToKeep < 1) {
|
||||||
|
numberToKeep = Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
SnapShooter snapShooter = new SnapShooter(core, null);
|
SnapShooter snapShooter = new SnapShooter(core, null);
|
||||||
snapShooter.createSnapAsync(currentCommitPoint, ReplicationHandler.this);
|
snapShooter.createSnapAsync(currentCommitPoint, numberToKeep, ReplicationHandler.this);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Exception while snapshooting", e);
|
LOG.error("Exception while snapshooting", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
<requestHandler name="/replication" class="solr.ReplicationHandler">
|
<requestHandler name="/replication" class="solr.ReplicationHandler">
|
||||||
<lst name="master">
|
<lst name="master">
|
||||||
<str name="replicateAfter">commit</str>
|
<str name="backupAfter">commit</str>
|
||||||
<str name="confFiles">schema-replication2.xml:schema.xml</str>
|
<str name="confFiles">schema-replication2.xml:schema.xml</str>
|
||||||
</lst>
|
</lst>
|
||||||
<str name="maxNumberOfBackups">1</str>
|
<str name="maxNumberOfBackups">1</str>
|
||||||
|
|
|
@ -776,7 +776,6 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
||||||
if(random().nextBoolean()) {
|
if(random().nextBoolean()) {
|
||||||
configFile = "solrconfig-master1-keepOneBackup.xml";
|
configFile = "solrconfig-master1-keepOneBackup.xml";
|
||||||
addNumberToKeepInRequest = false;
|
addNumberToKeepInRequest = false;
|
||||||
backupKeepParamName = ReplicationHandler.NUMBER_BACKUPS_TO_KEEP_INIT_PARAM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
masterJetty.stop();
|
masterJetty.stop();
|
||||||
|
@ -864,8 +863,16 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
||||||
File[] snapDir = new File[2];
|
File[] snapDir = new File[2];
|
||||||
String firstBackupTimestamp = null;
|
String firstBackupTimestamp = null;
|
||||||
for(int i=0 ; i<2 ; i++) {
|
for(int i=0 ; i<2 ; i++) {
|
||||||
BackupThread backupThread = new BackupThread(addNumberToKeepInRequest, backupKeepParamName);
|
BackupThread backupThread = null;
|
||||||
|
if(!addNumberToKeepInRequest) {
|
||||||
|
if(random().nextBoolean()) {
|
||||||
|
masterClient.commit();
|
||||||
|
} else {
|
||||||
|
backupThread = new BackupThread(addNumberToKeepInRequest, backupKeepParamName);
|
||||||
backupThread.start();
|
backupThread.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
File dataDir = new File(master.getDataDir());
|
File dataDir = new File(master.getDataDir());
|
||||||
|
|
||||||
|
@ -890,7 +897,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
||||||
waitCnt++;
|
waitCnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(backupThread.fail != null) {
|
if(backupThread!= null && backupThread.fail != null) {
|
||||||
fail(backupThread.fail);
|
fail(backupThread.fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue