You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2015/06/14 12:36:13 UTC
svn commit: r1685382 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/core/ lucene/core/src/java/org/apache/lucene/index/
lucene/core/src/java/org/apache/lucene/store/
lucene/core/src/test/org/apache/lucene/index/
lucene/core/src/test/org/apache/...
Author: rmuir
Date: Sun Jun 14 10:36:12 2015
New Revision: 1685382
URL: http://svn.apache.org/r1685382
Log:
LUCENE-6525: Deprecate IndexWriterConfig's write lock timeout
Added:
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/SleepingLockWrapper.java
- copied unchanged from r1685379, lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/SleepingLockWrapper.java
lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/store/TestSleepingLockWrapper.java
- copied unchanged from r1685379, lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/store/TestSleepingLockWrapper.java
Removed:
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/SleepingLockWrapper.java
lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestSleepingLockWrapper.java
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/lucene/core/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java
lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterConfig.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1685382&r1=1685381&r2=1685382&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Sun Jun 14 10:36:12 2015
@@ -64,6 +64,9 @@ API Changes
* LUCENE-6552: Add MergePolicy.OneMerge.getMergeInfo and rename
setInfo to setMergeInfo (Simon Willnauer, Mike McCandless)
+* LUCENE-6525: Deprecate IndexWriterConfig's writeLockTimeout.
+ (Robert Muir)
+
Bug fixes
* LUCENE-6500: ParallelCompositeReader did not always call
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1685382&r1=1685381&r2=1685382&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java Sun Jun 14 10:36:12 2015
@@ -59,6 +59,7 @@ import org.apache.lucene.store.Lock;
import org.apache.lucene.store.LockObtainFailedException;
import org.apache.lucene.store.MergeInfo;
import org.apache.lucene.store.RateLimitedIndexOutput;
+import org.apache.lucene.store.SleepingLockWrapper;
import org.apache.lucene.store.TrackingDirectoryWrapper;
import org.apache.lucene.store.LockValidatingDirectoryWrapper;
import org.apache.lucene.util.Accountable;
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java?rev=1685382&r1=1685381&r2=1685382&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/IndexWriterConfig.java Sun Jun 14 10:36:12 2015
@@ -24,6 +24,7 @@ import org.apache.lucene.codecs.Codec;
import org.apache.lucene.index.DocumentsWriterPerThread.IndexingChain;
import org.apache.lucene.index.IndexWriter.IndexReaderWarmer;
import org.apache.lucene.search.similarities.Similarity;
+import org.apache.lucene.store.SleepingLockWrapper;
import org.apache.lucene.util.InfoStream;
import org.apache.lucene.util.PrintStreamInfoStream;
import org.apache.lucene.util.SetOnce;
@@ -87,11 +88,11 @@ public final class IndexWriterConfig ext
public final static double DEFAULT_RAM_BUFFER_SIZE_MB = 16.0;
/**
- * Default value for the write lock timeout (1,000 ms).
- *
- * @see #setDefaultWriteLockTimeout(long)
+ * Default value for the write lock timeout (0 ms: no sleeping).
+ * @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
*/
- public static long WRITE_LOCK_TIMEOUT = 1000;
+ @Deprecated
+ public static final long WRITE_LOCK_TIMEOUT = 0;
/** Default setting for {@link #setReaderPooling}. */
public final static boolean DEFAULT_READER_POOLING = false;
@@ -113,24 +114,6 @@ public final class IndexWriterConfig ext
/** Default value for whether calls to {@link IndexWriter#close()} include a commit. */
public final static boolean DEFAULT_COMMIT_ON_CLOSE = true;
- /**
- * Sets the default (for any instance) maximum time to wait for a write lock
- * (in milliseconds).
- */
- public static void setDefaultWriteLockTimeout(long writeLockTimeout) {
- WRITE_LOCK_TIMEOUT = writeLockTimeout;
- }
-
- /**
- * Returns the default write lock timeout for newly instantiated
- * IndexWriterConfigs.
- *
- * @see #setDefaultWriteLockTimeout(long)
- */
- public static long getDefaultWriteLockTimeout() {
- return WRITE_LOCK_TIMEOUT;
- }
-
// indicates whether this config instance is already attached to a writer.
// not final so that it can be cloned properly.
private SetOnce<IndexWriter> writer = new SetOnce<>();
@@ -264,11 +247,12 @@ public final class IndexWriterConfig ext
/**
* Sets the maximum time to wait for a write lock (in milliseconds) for this
- * instance. You can change the default value for all instances by calling
- * {@link #setDefaultWriteLockTimeout(long)}. Note that the value can be zero,
- * for no sleep/retry behavior.
+ * instance. Note that the value can be zero, for no sleep/retry behavior.
*
- * <p>Only takes effect when IndexWriter is first created. */
+ * <p>Only takes effect when IndexWriter is first created.
+ * @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
+ */
+ @Deprecated
public IndexWriterConfig setWriteLockTimeout(long writeLockTimeout) {
this.writeLockTimeout = writeLockTimeout;
return this;
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java?rev=1685382&r1=1685381&r2=1685382&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java Sun Jun 14 10:36:12 2015
@@ -24,6 +24,7 @@ import org.apache.lucene.index.IndexWrit
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.similarities.Similarity;
+import org.apache.lucene.store.SleepingLockWrapper;
import org.apache.lucene.util.InfoStream;
/**
@@ -60,7 +61,11 @@ public class LiveIndexWriterConfig {
/** {@link MergeScheduler} to use for running merges. */
protected volatile MergeScheduler mergeScheduler;
- /** Timeout when trying to obtain the write lock on init. */
+ /**
+ * Timeout when trying to obtain the write lock on init.
+ * @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
+ */
+ @Deprecated
protected volatile long writeLockTimeout;
/** {@link IndexingChain} that determines how documents are
@@ -355,7 +360,9 @@ public class LiveIndexWriterConfig {
* Returns allowed timeout when acquiring the write lock.
*
* @see IndexWriterConfig#setWriteLockTimeout(long)
+ * @deprecated Use {@link SleepingLockWrapper} if you want sleeping.
*/
+ @Deprecated
public long getWriteLockTimeout() {
return writeLockTimeout;
}
Modified: lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterConfig.java?rev=1685382&r1=1685381&r2=1685382&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterConfig.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterConfig.java Sun Jun 14 10:36:12 2015
@@ -63,8 +63,6 @@ public class TestIndexWriterConfig exten
assertEquals(OpenMode.CREATE_OR_APPEND, conf.getOpenMode());
// we don't need to assert this, it should be unspecified
assertTrue(IndexSearcher.getDefaultSimilarity() == conf.getSimilarity());
- assertEquals(IndexWriterConfig.getDefaultWriteLockTimeout(), conf.getWriteLockTimeout());
- assertEquals(IndexWriterConfig.WRITE_LOCK_TIMEOUT, IndexWriterConfig.getDefaultWriteLockTimeout());
assertEquals(IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS, conf.getMaxBufferedDeleteTerms());
assertEquals(IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB, conf.getRAMBufferSizeMB(), 0.0);
assertEquals(IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS, conf.getMaxBufferedDocs());
@@ -179,7 +177,7 @@ public class TestIndexWriterConfig exten
@Test
public void testConstants() throws Exception {
// Tests that the values of the constants does not change
- assertEquals(1000, IndexWriterConfig.WRITE_LOCK_TIMEOUT);
+ assertEquals(0, IndexWriterConfig.WRITE_LOCK_TIMEOUT);
assertEquals(-1, IndexWriterConfig.DISABLE_AUTO_FLUSH);
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DELETE_TERMS);
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH, IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS);