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 2014/05/09 14:25:59 UTC
svn commit: r1593526 -
/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Author: rmuir
Date: Fri May 9 12:25:59 2014
New Revision: 1593526
URL: http://svn.apache.org/r1593526
Log:
LUCENE-5661: add workaround for race conditions in the LiveIWC api
Modified:
lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1593526&r1=1593525&r2=1593526&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java Fri May 9 12:25:59 2014
@@ -1040,19 +1040,22 @@ public abstract class LuceneTestCase ext
if (rarely(r)) {
// change flush parameters:
// this is complicated because the api requires you "invoke setters in a magical order!"
- boolean flushByRam = r.nextBoolean();
- if (flushByRam) {
- c.setRAMBufferSizeMB(TestUtil.nextInt(r, 1, 10));
- c.setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH);
- } else {
- if (rarely(r)) {
- // crazy value
- c.setMaxBufferedDocs(TestUtil.nextInt(r, 2, 15));
+ // LUCENE-5661: workaround for race conditions in the API
+ synchronized (c) {
+ boolean flushByRam = r.nextBoolean();
+ if (flushByRam) {
+ c.setRAMBufferSizeMB(TestUtil.nextInt(r, 1, 10));
+ c.setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH);
} else {
- // reasonable value
- c.setMaxBufferedDocs(TestUtil.nextInt(r, 16, 1000));
+ if (rarely(r)) {
+ // crazy value
+ c.setMaxBufferedDocs(TestUtil.nextInt(r, 2, 15));
+ } else {
+ // reasonable value
+ c.setMaxBufferedDocs(TestUtil.nextInt(r, 16, 1000));
+ }
+ c.setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH);
}
- c.setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH);
}
didChange = true;
}