mirror of https://github.com/apache/lucene.git
SOLR-686: single lock factory overwrites previous (multicore reload corruption possibility)_
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@684339 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0084c7e57c
commit
8e0503b667
|
@ -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>
|
||||
|
|
|
@ -21,12 +21,7 @@ import org.apache.lucene.index.IndexWriter;
|
|||
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 @@ public class SolrIndexWriter extends IndexWriter {
|
|||
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)) {
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue