[infinispan-commits] Infinispan SVN: r2284 - in branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene: locking and 1 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Tue Aug 24 10:12:46 EDT 2010


Author: sannegrinovero
Date: 2010-08-24 10:12:45 -0400 (Tue, 24 Aug 2010)
New Revision: 2284

Added:
   branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/package-info.java
   branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/package-info.java
   branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/package-info.java
Modified:
   branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java
   branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/TransactionalLockFactory.java
   branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/SegmentReadLocker.java
Log:
Lucene Directory: some more javadoc improvements (branch 4.1)

Modified: branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java
===================================================================
--- branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java	2010-08-24 13:47:59 UTC (rev 2283)
+++ branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java	2010-08-24 14:12:45 UTC (rev 2284)
@@ -40,7 +40,7 @@
 import org.infinispan.util.logging.LogFactory;
 
 /**
- * An implementation of Lucene's {@link org.apache.lucene.store.Directory} which uses Infinispan to store Lucene indices.
+ * An implementation of Lucene's {@link org.apache.lucene.store.Directory} which uses Infinispan to store Lucene indexes.
  * As the RAMDirectory the data is stored in memory, but provides some additional flexibility:
  * <p><b>Passivation, LRU or LIRS</b> Bigger indexes can be configured to passivate cleverly selected chunks of data to a cache store.
  * This can be a local filesystem, a network filesystem, a database or custom cloud stores like S3. See Infinispan's core documentation for a full list of available implementations, or {@link org.infinispan.loaders.CacheStore} to implement more.</p>
@@ -74,8 +74,8 @@
 public class InfinispanDirectory extends Directory {
    
    /**
-    * used as default chunk size, can be overriden at construction time
-    * each Lucene index segment is splitted into parts with default size defined here
+    * Used as default chunk size, can be overriden at construction time.
+    * Each Lucene index segment is splitted into parts with default size defined here
     */
    public final static int DEFAULT_BUFFER_SIZE = 16 * 1024;
 

Modified: branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/TransactionalLockFactory.java
===================================================================
--- branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/TransactionalLockFactory.java	2010-08-24 13:47:59 UTC (rev 2283)
+++ branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/TransactionalLockFactory.java	2010-08-24 14:12:45 UTC (rev 2284)
@@ -36,14 +36,14 @@
  * <p>Factory for locks obtained in <code>InfinispanDirectory</code>,
  * this factory produces instances of <code>TransactionalSharedLuceneLock</code>.</p>
  * <p>Usually Lucene acquires the lock when creating an IndexWriter and releases it
- * when closing it; this is open-close is mapped to transactions as begin-commit,
- * so all changes are going to be effective at IndexWriter close and could need
- * much memory until it's committed.
+ * when closing it; these open-close operations are mapped to transactions as begin-commit,
+ * so all changes are going to be effective at IndexWriter close.
  * The advantage is that a transaction rollback will be able to undo all changes
- * applied to the index.</p>
+ * applied to the index, but this requires enough memory to hold all the changes until
+ * the commit.</p>
  * <p>Using a TransactionalSharedLuceneLock is not compatible with Lucene's
  * default MergeScheduler: use an in-thread implementation like SerialMergeScheduler
- * <code>iwriter.setMergeScheduler( new SerialMergeScheduler() );</code></p>
+ * <code>indexWriter.setMergeScheduler( new SerialMergeScheduler() );</code></p>
  * 
  * @since 4.0
  * @author Sanne Grinovero

Added: branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/package-info.java
===================================================================
--- branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/package-info.java	                        (rev 0)
+++ branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/locking/package-info.java	2010-08-24 14:12:45 UTC (rev 2284)
@@ -0,0 +1,8 @@
+/**
+ * Lucene's IndexWriter instances are threadsafe but you can have only one open on the index, so when opening an IndexWriter an
+ * index-wide lock needs to be acquired. When using Infinispan this lock needs reliable distribution, so two implementations
+ * are provided which where tested with the Infinispan Directory and are suited for distributed locking, but you could provide your own implementation of LockFactory.
+ * You might also disable the locking altogether if you have application level or other external guarantees that no two IndexWriters
+ * will ever be opened.
+ */
+package org.infinispan.lucene.locking;

Added: branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/package-info.java
===================================================================
--- branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/package-info.java	                        (rev 0)
+++ branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/package-info.java	2010-08-24 14:12:45 UTC (rev 2284)
@@ -0,0 +1,5 @@
+/**
+ * Lucene Directory implementation which stores the index in Infinispan.
+ * For information about Apache Lucene (Java) see <a href="http://lucene.apache.org/java/docs/index.html">the Lucene homepage</a>.
+ */
+package org.infinispan.lucene;

Modified: branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/SegmentReadLocker.java
===================================================================
--- branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/SegmentReadLocker.java	2010-08-24 13:47:59 UTC (rev 2283)
+++ branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/SegmentReadLocker.java	2010-08-24 14:12:45 UTC (rev 2284)
@@ -31,6 +31,10 @@
  * invoked when the stream is closed.</p>
  * <p>The same {@link #deleteOrReleaseReadLock(String)} is invoked when a file is deleted, so if this invocation is not balancing
  * a lock acquire this implementation must delete all segment chunks and the associated metadata.</p>
+ * <p>Note that if you can use and tune the {@link org.apache.lucene.index.LogByteSizeMergePolicy} you could avoid the need
+ * for readlocks by setting a maximum segment size to equal the chunk size used by the InfinispanDirectory; readlocks
+ * will be skipped automatically when not needed, so it's advisable to still configure an appropriate SegmentReadLocker
+ * for the cases you might want to tune the chunk size.</p>
  * 
  * @author Sanne Grinovero
  * @since 4.1

Added: branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/package-info.java
===================================================================
--- branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/package-info.java	                        (rev 0)
+++ branches/4.1.x/lucene-directory/src/main/java/org/infinispan/lucene/readlocks/package-info.java	2010-08-24 14:12:45 UTC (rev 2284)
@@ -0,0 +1,7 @@
+/**
+ * Several implementations for a SegmentReadLocker, pick one depending on your use case.
+ * Lucene's default IndexDeletionPolicy could remove a segment while it's still used by another IndexReader;
+ * this is not an issue on a local filesystem, but could happen on Infinispan.
+ * To prevent deletion of in-use segments a read-lock is acquired when a segment is opened.
+ */
+package org.infinispan.lucene.readlocks;



More information about the infinispan-commits mailing list