LUCENE-3023: fixed TestFlushByRamOrCountsPolicy test-case and removed uncommented leftovers from RT branch

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1098504 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-05-02 07:19:57 +00:00
parent c096f2e1e6
commit 0b5ba4404c
3 changed files with 4 additions and 28 deletions

View File

@ -207,10 +207,6 @@ public abstract class DocumentsWriterPerThreadPool {
public abstract ThreadState getAndLock(Thread requestingThread, DocumentsWriter documentsWriter, Document doc);
//public abstract void clearThreadBindings(ThreadState perThread);
//public abstract void clearAllThreadBindings();
/**
* Returns an iterator providing access to all {@link ThreadState}
* instances.

View File

@ -82,16 +82,4 @@ public class ThreadAffinityDocumentsWriterThreadPool extends DocumentsWriterPerT
minThreadState.lock();
return minThreadState;
}
/*
@Override
public void clearThreadBindings(ThreadState perThread) {
threadBindings.clear();
}
@Override
public void clearAllThreadBindings() {
threadBindings.clear();
}
*/
}

View File

@ -53,12 +53,12 @@ public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {
}
for (int i = 0; i < numThreads.length; i++) {
// with a 512 mb ram buffer we should never stall
runFlushByRam(numThreads[i], 512.d, true);
// with a 256 mb ram buffer we should never stall
runFlushByRam(numThreads[i], 256.d, true);
}
}
protected void runFlushByRam(int numThreads, double maxRam,
protected void runFlushByRam(int numThreads, double maxRamMB,
boolean ensureNotStalled) throws IOException, CorruptIndexException,
LockObtainFailedException, InterruptedException {
final int numDocumentsToIndex = 50 + random.nextInt(150);
@ -67,12 +67,11 @@ public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {
MockDefaultFlushPolicy flushPolicy = new MockDefaultFlushPolicy();
IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(random)).setFlushPolicy(flushPolicy);
final int numDWPT = 1 + random.nextInt(8);
DocumentsWriterPerThreadPool threadPool = new ThreadAffinityDocumentsWriterThreadPool(
numDWPT);
iwc.setIndexerThreadPool(threadPool);
iwc.setRAMBufferSizeMB(1 + random.nextInt(10) + random.nextDouble());
iwc.setRAMBufferSizeMB(maxRamMB);
iwc.setMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH);
iwc.setMaxBufferedDeleteTerms(IndexWriterConfig.DISABLE_AUTO_FLUSH);
IndexWriter writer = new IndexWriter(dir, iwc);
@ -272,13 +271,6 @@ public class TestFlushByRamOrCountsPolicy extends LuceneTestCase {
assertFalse(
"single thread must not block numThreads: " + numThreads[i],
docsWriter.healthiness.hasBlocked());
// this assumption is too strict in this test
// } else {
// if (docsWriter.healthiness.wasStalled) {
// // TODO maybe this assumtion is too strickt
// assertTrue(" we should have blocked here numThreads: "
// + numThreads[i], docsWriter.healthiness.hasBlocked());
// }
}
assertActiveBytesAfter(flushControl);
writer.close(true);