mirror of https://github.com/apache/lucene.git
fix intermittant false test fail
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1037406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0b1a67945b
commit
7853af4298
|
@ -90,7 +90,6 @@ class TermVectorsReader implements Cloneable {
|
|||
assert format == tvdFormat;
|
||||
assert format == tvfFormat;
|
||||
|
||||
assert (tvx.length()-FORMAT_SIZE) % 16 == 0;
|
||||
numTotalDocs = (int) (tvx.length() >> 4);
|
||||
|
||||
if (-1 == docStoreOffset) {
|
||||
|
|
|
@ -57,6 +57,7 @@ public class TestIndexWriterOnDiskFull extends LuceneTestCase {
|
|||
MockDirectoryWrapper dir = new MockDirectoryWrapper(random, new RAMDirectory());
|
||||
dir.setMaxSizeInBytes(diskFree);
|
||||
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()));
|
||||
writer.setInfoStream(VERBOSE ? System.out : null);
|
||||
MergeScheduler ms = writer.getConfig().getMergeScheduler();
|
||||
if (ms instanceof ConcurrentMergeScheduler)
|
||||
// This test intentionally produces exceptions
|
||||
|
@ -101,6 +102,7 @@ public class TestIndexWriterOnDiskFull extends LuceneTestCase {
|
|||
|
||||
// Make sure reader can open the index:
|
||||
IndexReader.open(dir, true).close();
|
||||
_TestUtil.checkIndex(dir);
|
||||
}
|
||||
|
||||
dir.close();
|
||||
|
@ -109,6 +111,7 @@ public class TestIndexWriterOnDiskFull extends LuceneTestCase {
|
|||
diskFree += 500;
|
||||
} else {
|
||||
//_TestUtil.syncConcurrentMerges(writer);
|
||||
dir.setMaxSizeInBytes(0);
|
||||
writer.close();
|
||||
dir.close();
|
||||
break;
|
||||
|
|
|
@ -90,14 +90,19 @@ public class MockIndexOutputWrapper extends IndexOutput {
|
|||
}
|
||||
|
||||
if (dir.maxSize != 0 && freeSpace <= len) {
|
||||
if (freeSpace > 0 && freeSpace < len) {
|
||||
if (freeSpace > 0) {
|
||||
realUsage += freeSpace;
|
||||
delegate.writeBytes(b, offset, (int) freeSpace);
|
||||
}
|
||||
if (realUsage > dir.maxUsedSize) {
|
||||
dir.maxUsedSize = realUsage;
|
||||
}
|
||||
throw new IOException("fake disk full at " + dir.getRecomputedActualSizeInBytes() + " bytes when writing " + name);
|
||||
String message = "fake disk full at " + dir.getRecomputedActualSizeInBytes() + " bytes when writing " + name + " (file length=" + delegate.length();
|
||||
if (freeSpace > 0) {
|
||||
message += "; wrote " + freeSpace + " of " + len + " bytes";
|
||||
}
|
||||
message += ")";
|
||||
throw new IOException(message);
|
||||
} else {
|
||||
if (dir.randomState.nextBoolean()) {
|
||||
final int half = len/2;
|
||||
|
|
Loading…
Reference in New Issue