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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1698200 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2015-08-27 17:35:40 +00:00
parent d1bf1ca14a
commit 456f70cf0d
3 changed files with 21 additions and 10 deletions

View File

@ -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 release

View File

@ -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 used
indexConfig = new SolrIndexConfig(this, "indexConfig", mainIndexConfig);

View File

@ -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);