SOLR-1018 -- Slave is unable to replicate when server acts as repeater (as both master and slave)

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@743757 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-02-12 14:10:32 +00:00
parent 1371f5b70b
commit 5cfb336f5c
3 changed files with 19 additions and 3 deletions

View File

@ -261,6 +261,9 @@ Bug Fixes
31. SOLR-1015: Incomplete information in replication admin page and http command response when server
is both master and slave i.e. when server is a repeater (Akshay Ukey via shalin)
32. SOLR-1018: Slave is unable to replicate when server acts as repeater (as both master and slave)
(Akshay Ukey, Noble Paul via shalin)
Other Changes
----------------------

View File

@ -670,6 +670,16 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
return details;
}
void refreshCommitpoint(){
IndexCommit commitPoint = core.getDeletionPolicy().getLatestCommit();
if(replicateOnCommit && !commitPoint.isOptimized()){
indexCommitPoint = commitPoint;
}
if(replicateOnOptimize && commitPoint.isOptimized()){
indexCommitPoint = commitPoint;
}
}
@SuppressWarnings("unchecked")
public void inform(SolrCore core) {
this.core = core;
@ -717,6 +727,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
LOG.warn("The update handler being used is not an instance or sub-class of DirectUpdateHandler2. " +
"Replicate on Startup cannot work.");
}
if(s.get().getReader().getIndexCommit() != null)
if(s.get().getReader().getIndexCommit().getGeneration() != 1L)
indexCommitPoint = s.get().getReader().getIndexCommit();
} catch (IOException e) {
LOG.warn("Unable to get IndexCommit on startup", e);

View File

@ -354,6 +354,7 @@ public class SnapPuller {
LOG.info("Force open index writer to make sure older index files get deleted");
DirectUpdateHandler2 handler = (DirectUpdateHandler2) solrCore.getUpdateHandler();
handler.forceOpenWriter();
replicationHandler.refreshCommitpoint();
} else {
LOG.warn("The update handler is not an instance or sub-class of DirectUpdateHandler2. " +
"ReplicationHandler may not be able to cleanup un-used index files.");