mirror of https://github.com/apache/lucene.git
SOLR-1962: SolrCore#initIndex should not use a mix of indexPath and newIndexPath
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1027229 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d2263013e9
commit
b06f0b0b71
|
@ -532,6 +532,8 @@ Bug Fixes
|
|||
|
||||
* SOLR-2190: change xpath from RSS 0.9 to 1.0 in slashdot sample. (koji)
|
||||
|
||||
* SOLR-1962: SolrCore#initIndex should not use a mix of indexPath and newIndexPath (Mark Miller)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -367,12 +367,12 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
|
||||
void initIndex() {
|
||||
try {
|
||||
|
||||
initDirectoryFactory();
|
||||
boolean indexExists = getDirectoryFactory().exists(getNewIndexDir());
|
||||
String indexDir = getNewIndexDir();
|
||||
boolean indexExists = getDirectoryFactory().exists(indexDir);
|
||||
boolean firstTime;
|
||||
synchronized (SolrCore.class) {
|
||||
firstTime = dirs.add(new File(getNewIndexDir()).getCanonicalPath());
|
||||
firstTime = dirs.add(new File(indexDir).getCanonicalPath());
|
||||
}
|
||||
boolean removeLocks = solrConfig.unlockOnStartup;
|
||||
|
||||
|
@ -381,10 +381,10 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
if (indexExists && firstTime && removeLocks) {
|
||||
// to remove locks, the directory must already exist... so we create it
|
||||
// if it didn't exist already...
|
||||
Directory dir = SolrIndexWriter.getDirectory(getIndexDir(), getDirectoryFactory(), solrConfig.mainIndexConfig);
|
||||
Directory dir = SolrIndexWriter.getDirectory(indexDir, getDirectoryFactory(), solrConfig.mainIndexConfig);
|
||||
if (dir != null) {
|
||||
if (IndexWriter.isLocked(dir)) {
|
||||
log.warn(logid+"WARNING: Solr index directory '" + getIndexDir() + "' is locked. Unlocking...");
|
||||
log.warn(logid+"WARNING: Solr index directory '" + indexDir+ "' is locked. Unlocking...");
|
||||
IndexWriter.unlock(dir);
|
||||
}
|
||||
dir.close();
|
||||
|
@ -393,10 +393,10 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
|
||||
// Create the index if it doesn't exist.
|
||||
if(!indexExists) {
|
||||
log.warn(logid+"Solr index directory '" + new File(getNewIndexDir()) + "' doesn't exist."
|
||||
log.warn(logid+"Solr index directory '" + new File(indexDir) + "' doesn't exist."
|
||||
+ " Creating new index...");
|
||||
|
||||
SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex", getIndexDir(), getDirectoryFactory(), true, schema, solrConfig.mainIndexConfig, solrDelPolicy);
|
||||
SolrIndexWriter writer = new SolrIndexWriter("SolrCore.initIndex", indexDir, getDirectoryFactory(), true, schema, solrConfig.mainIndexConfig, solrDelPolicy);
|
||||
writer.close();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue