mirror of https://github.com/apache/lucene.git
SOLR-4926: SolrDeletionPolicy.getLatestCommit can be null before IW is used
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1498554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8227df4c04
commit
d96faa4a3a
|
@ -318,7 +318,24 @@ public class SnapPuller {
|
|||
long latestVersion = (Long) response.get(CMD_INDEX_VERSION);
|
||||
long latestGeneration = (Long) response.get(GENERATION);
|
||||
|
||||
// TODO: make sure that getLatestCommit only returns commit points for the main index (i.e. no side-car indexes)
|
||||
IndexCommit commit = core.getDeletionPolicy().getLatestCommit();
|
||||
if (commit == null) {
|
||||
// Presumably the IndexWriter hasn't been opened yet, and hence the deletion policy hasn't been updated with commit points
|
||||
RefCounted<SolrIndexSearcher> searcherRefCounted = null;
|
||||
try {
|
||||
searcherRefCounted = core.getNewestSearcher(false);
|
||||
if (searcherRefCounted == null) {
|
||||
LOG.warn("No open searcher found - fetch aborted");
|
||||
return false;
|
||||
}
|
||||
commit = searcherRefCounted.get().getIndexReader().getIndexCommit();
|
||||
} finally {
|
||||
if (searcherRefCounted != null)
|
||||
searcherRefCounted.decref();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (latestVersion == 0L) {
|
||||
if (forceReplication && commit.getGeneration() != 0) {
|
||||
|
|
Loading…
Reference in New Issue