LUCENE-4976: fix Solr IndexDeletionPolicy impls to handle empty commits onInit

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1478855 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-05-03 16:12:22 +00:00
parent 64dfbfdfb2
commit a7bcad65eb
2 changed files with 6 additions and 1 deletions

View File

@ -237,7 +237,9 @@ public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy {
map.put(wrapper.delegate.getGeneration(), wrapper.delegate);
}
solrVersionVsCommits = map;
latestCommit = ((list.get(list.size() - 1)).delegate);
if (!list.isEmpty()) {
latestCommit = ((list.get(list.size() - 1)).delegate);
}
}
public static long getCommitTimestamp(IndexCommit commit) throws IOException {

View File

@ -79,6 +79,9 @@ public class SolrDeletionPolicy extends IndexDeletionPolicy implements NamedList
@Override
public void onInit(List commits) throws IOException {
// SOLR-4547: log basic data at INFO, add filenames at DEBUG.
if (commits.isEmpty()) {
return;
}
log.info("SolrDeletionPolicy.onInit: commits: {}",
new CommitsLoggingInfo(commits));
log.debug("SolrDeletionPolicy.onInit: commits: {}",