SOLR-4734: Leader election fails with an NPE if there is no UpdateLog

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1482955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-05-15 17:01:49 +00:00
parent 9728aaca9f
commit 93d7c7ae6b
2 changed files with 6 additions and 3 deletions

View File

@ -110,6 +110,9 @@ Bug Fixes
* SOLR-4796: zkcli.sh should honor JAVA_HOME (Roman Shaposhnik via Mark Miller)
* SOLR-4734: Leader election fails with an NPE if there is no UpdateLog.
(Mark Miller, Alexander Eibner)
Other Changes
----------------------

View File

@ -172,8 +172,6 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
}
log.info("I may be the new leader - try and sync");
UpdateLog ulog = core.getUpdateHandler().getUpdateLog();
// we are going to attempt to be the leader
@ -187,7 +185,9 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
success = false;
}
if (!success && ulog.getRecentUpdates().getVersions(1).isEmpty()) {
UpdateLog ulog = core.getUpdateHandler().getUpdateLog();
if (!success && (ulog == null || ulog.getRecentUpdates().getVersions(1).isEmpty())) {
// we failed sync, but we have no versions - we can't sync in that case
// - we were active
// before, so become leader anyway