You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by yo...@apache.org on 2008/08/09 22:34:35 UTC
svn commit: r684339 - in /lucene/solr/trunk: example/solr/conf/solrconfig.xml
src/java/org/apache/solr/update/SolrIndexWriter.java
Author: yonik
Date: Sat Aug 9 13:34:35 2008
New Revision: 684339
URL: http://svn.apache.org/viewvc?rev=684339&view=rev
Log:
SOLR-686: single lock factory overwrites previous (multicore reload corruption possibility)_
Modified:
lucene/solr/trunk/example/solr/conf/solrconfig.xml
lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java
Modified: lucene/solr/trunk/example/solr/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/example/solr/conf/solrconfig.xml?rev=684339&r1=684338&r2=684339&view=diff
==============================================================================
--- lucene/solr/trunk/example/solr/conf/solrconfig.xml (original)
+++ lucene/solr/trunk/example/solr/conf/solrconfig.xml Sat Aug 9 13:34:35 2008
@@ -88,12 +88,14 @@
specify one of the other Lucene LockFactory implementations in
the event that you have a custom situation.
- none = NoLockFactory (typically only used with read only indexes)
- single = SingleInstanceLockFactory (suggested)
+ single = SingleInstanceLockFactory - suggested for a read-only index
+ or if there is no possibility of another process trying
+ to modify the index.
native = NativeFSLockFactory
simple = SimpleFSLockFactory
- ('simple' is the default for backwards compatibility with Solr 1.2)
+ (For backwards compatibility with Solr 1.2, 'single' is the default
+ if not specified.)
-->
<lockType>single</lockType>
</indexDefaults>
Modified: lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java?rev=684339&r1=684338&r2=684339&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/update/SolrIndexWriter.java Sat Aug 9 13:34:35 2008
@@ -21,12 +21,7 @@
import org.apache.lucene.index.MergePolicy;
import org.apache.lucene.index.MergeScheduler;
import org.apache.lucene.index.LogMergePolicy;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.store.NativeFSLockFactory;
-import org.apache.lucene.store.NoLockFactory;
-import org.apache.lucene.store.SimpleFSLockFactory;
-import org.apache.lucene.store.SingleInstanceLockFactory;
+import org.apache.lucene.store.*;
import org.apache.solr.common.SolrException;
import org.apache.solr.schema.IndexSchema;
@@ -94,12 +89,16 @@
final String lockType = rawLockType.toLowerCase().trim();
if ("simple".equals(lockType)) {
+ // multiple SimpleFSLockFactory instances should be OK
d.setLockFactory(new SimpleFSLockFactory(path));
} else if ("native".equals(lockType)) {
d.setLockFactory(new NativeFSLockFactory(path));
} else if ("single".equals(lockType)) {
- d.setLockFactory(new SingleInstanceLockFactory());
+ if (!(d.getLockFactory() instanceof SingleInstanceLockFactory))
+ d.setLockFactory(new SingleInstanceLockFactory());
} else if ("none".equals(lockType)) {
+ // recipie for disaster
+ log.severe("CONFIGURATION WARNING: locks are disabled on " + path);
d.setLockFactory(new NoLockFactory());
} else {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,