You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2011/02/14 00:47:20 UTC
svn commit: r1070331 -
/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/SolrCore.java
Author: markrmiller
Date: Sun Feb 13 23:47:19 2011
New Revision: 1070331
URL: http://svn.apache.org/viewvc?rev=1070331&view=rev
Log:
SOLR-1962: Index directory disagreement SolrCore#initIndex
Modified:
lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/SolrCore.java
Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/SolrCore.java?rev=1070331&r1=1070330&r2=1070331&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/core/SolrCore.java Sun Feb 13 23:47:19 2011
@@ -371,10 +371,11 @@ public final class SolrCore implements S
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;
@@ -383,10 +384,10 @@ public final class SolrCore implements S
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();
@@ -395,10 +396,10 @@ public final class SolrCore implements S
// 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();
}