Apache Solr open-source search software
SOLR-7942: Previously removed unlockOnStartup option (LUCENE-6508) now logs warning if configured, will be an error in 6.0. Also improved error msg if an index is locked on startup
Chris M. Hostetter456f70cf0d09
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 8026bb3e65b..7172ed10fcf 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -214,6 +214,9 @@ Other Changes* SOLR-7970: Factor out a SearchGroupsFieldCommandResult class.(Christine Poerschke)+* SOLR-7942: Previously removed unlockOnStartup option (LUCENE-6508) now logs warning if configured,+ will be an error in 6.0. Also improved error msg if an index is locked on startup (hossman)+================== 5.3.0 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this releasediff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.javaindex c15469dc7be..f657fc044b9 100644--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java@@ -216,7 +216,15 @@ public class SolrConfig extends Config implements MapSerializable {" This config will be removed in future versions.", getNode(indexConfigPrefix + "/nrtMode", false) == null,true);-+ assertWarnOrFail("Solr no longer supports forceful unlocking via the 'unlockOnStartup' option. "++ "This is no longer neccessary for the default lockType except in situations where "++ "it would be dangerous and should not be done. For other lockTypes and/or "++ "directoryFactory options it may also be dangerous and users must resolve "++ "problematic locks manually.",+ null == getNode(indexConfigPrefix + "/unlockOnStartup", false),+ true // 'fail' in trunk+ );+// Parse indexConfig section, using mainIndex as backup in case old config is usedindexConfig = new SolrIndexConfig(this, "indexConfig", mainIndexConfig);diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.javaindex 80707cb21ad..3f3a5416c13 100644--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java@@ -530,17 +530,17 @@ public final class SolrCore implements SolrInfoMBean, Closeable {initIndexReaderFactory();if (indexExists && firstTime && !reload) {-- Directory dir = directoryFactory.get(indexDir, DirContext.DEFAULT,- getSolrConfig().indexConfig.lockType);+ final String lockType = getSolrConfig().indexConfig.lockType;+ Directory dir = directoryFactory.get(indexDir, DirContext.DEFAULT, lockType);try {if (IndexWriter.isLocked(dir)) {- log.error(logid- + "Solr index directory '{}' is locked. Throwing exception.",- indexDir);- throw new LockObtainFailedException(- "Index locked for write for core '" + name +- "'. Solr now longer supports forceful unlocking via 'unlockOnStartup'. Please verify locks manually!");+ log.error(logid + "Solr index directory '{}' is locked (lockType={}). Throwing exception.",+ indexDir, lockType);+ throw new LockObtainFailedException+ ("Index dir '" + indexDir + "' of core '" + name + "' is already locked. " ++ "The most likely cause is another Solr server (or another solr core in this server) " ++ "also configured to use this directory; other possible causes may be specific to lockType: " ++ lockType);}} finally {directoryFactory.release(dir);