Skip to content

Apache Lucene open-source search software

SOLR-7587: First attempt at fixing the dead-lock; moved call to UpdateLog.onFirstSearcher to end of the SolrCore constructor as it only needs to run once per core initialization

Timothy Potterb0a8ce42f5a8
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 5ebbf8a327e..a3e48493427 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -849,6 +849,18 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
this.ruleExpiryLock = new ReentrantLock();
registerConfListener();
+
+ // seed version buckets with max from index during core initialization
+ if (this.updateHandler != null && this.updateHandler.getUpdateLog() != null) {
+ RefCounted<SolrIndexSearcher> newestSearcher = getRealtimeSearcher();
+ if (newestSearcher != null) {
+ try {
+ this.updateHandler.getUpdateLog().onFirstSearcher(newestSearcher.get());
+ } finally {
+ newestSearcher.decref();
+ }
+ }
+ }
}
/** Set UpdateLog to buffer updates if the slice is in construction. */
@@ -1806,10 +1818,6 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
}
if (currSearcher == null) {
- if (updateHandler != null && updateHandler.getUpdateLog() != null) {
- updateHandler.getUpdateLog().onFirstSearcher(newSearcher);
- }
-
future = searcherExecutor.submit(new Callable() {
@Override
public Object call() throws Exception {
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
index bacdbc5ec34..7a2e72a4205 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java
@@ -1578,7 +1578,7 @@ public class UpdateLog implements PluginInfoInitialized {
long maxVersion = Math.max(maxVersionFromIndex, maxVersionFromRecent);
if (maxVersion == 0L) {
maxVersion = versions.getNewClock();
- log.warn("Could not find max version in index or recent updates, using new clock {}", maxVersion);
+ log.info("Could not find max version in index or recent updates, using new clock {}", maxVersion);
}
// seed all version buckets with the highest value from recent and index
diff --git a/solr/core/src/java/org/apache/solr/update/VersionInfo.java b/solr/core/src/java/org/apache/solr/update/VersionInfo.java
index 825a944e5a3..ff2345a632e 100644
--- a/solr/core/src/java/org/apache/solr/update/VersionInfo.java
+++ b/solr/core/src/java/org/apache/solr/update/VersionInfo.java
@@ -235,7 +235,7 @@ public class VersionInfo {
maxVersionInIndex = NumericUtils.getMaxLong(versionTerms);
log.info("Found MAX value {} from Terms for {} in index", maxVersionInIndex, versionFieldName);
} else {
- log.warn("No terms found for {}, cannot seed version bucket highest value from index", versionFieldName);
+ log.info("No terms found for {}, cannot seed version bucket highest value from index", versionFieldName);
}
} else {
ValueSource vs = versionField.getType().getValueSource(versionField, null);