take care of small bug around NRT and replication

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1293371 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-02-24 18:19:25 +00:00
parent 51ae7ee512
commit b093fca69a
1 changed files with 17 additions and 3 deletions

View File

@ -495,10 +495,24 @@ public class SnapPuller {
private void doCommit() throws IOException {
SolrQueryRequest req = new LocalSolrQueryRequest(solrCore,
new ModifiableSolrParams());
// reboot the writer on the new index and get a new searcher
solrCore.getUpdateHandler().newIndexWriter();
try {
// reboot the writer on the new index and get a new searcher
solrCore.getUpdateHandler().newIndexWriter();
// first try to open an NRT searcher so that the new
// IndexWriter is registered with the reader
Future[] waitSearcher = new Future[1];
solrCore.getSearcher(true, false, waitSearcher, true);
if (waitSearcher[0] != null) {
try {
waitSearcher[0].get();
} catch (InterruptedException e) {
SolrException.log(LOG,e);
} catch (ExecutionException e) {
SolrException.log(LOG,e);
}
}
// update our commit point to the right dir
solrCore.getUpdateHandler().commit(new CommitUpdateCommand(req, false));