mirror of https://github.com/apache/lucene.git
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:
parent
51ae7ee512
commit
b093fca69a
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue