speed up test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1642234 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-11-27 21:19:20 +00:00
parent 0cd3c669cd
commit 72adebaf7d
1 changed files with 8 additions and 5 deletions

View File

@ -938,7 +938,7 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
ReindexingReader reindexer = null; ReindexingReader reindexer = null;
// TODO: separate refresh thread, search threads, indexing threads // TODO: separate refresh thread, search threads, indexing threads
int numDocs = atLeast(TEST_NIGHTLY ? 20000 : 2000); int numDocs = atLeast(TEST_NIGHTLY ? 20000 : 1000);
int maxID = 0; int maxID = 0;
Path root = createTempDir(); Path root = createTempDir();
int refreshEveryNumDocs = 100; int refreshEveryNumDocs = 100;
@ -1023,7 +1023,7 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
ReindexingReader reindexer = null; ReindexingReader reindexer = null;
// TODO: separate refresh thread, search threads, indexing threads // TODO: separate refresh thread, search threads, indexing threads
int numDocs = atLeast(TEST_NIGHTLY ? 20000 : 2000); int numDocs = atLeast(TEST_NIGHTLY ? 20000 : 1000);
int maxID = 0; int maxID = 0;
Path root = createTempDir(); Path root = createTempDir();
int refreshEveryNumDocs = 100; int refreshEveryNumDocs = 100;
@ -1199,9 +1199,10 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
ReindexingReader reindexer = null; ReindexingReader reindexer = null;
// TODO: separate refresh thread, search threads, indexing threads // TODO: separate refresh thread, search threads, indexing threads
int numDocs = atLeast(3000); int numDocs = atLeast(TEST_NIGHTLY ? 20000 : 1000);
int maxID = 0; int maxID = 0;
int refreshEveryNumDocs = 100; int refreshEveryNumDocs = 100;
int commitCloseNumDocs = 1000;
for(int i=0;i<numDocs;i++) { for(int i=0;i<numDocs;i++) {
if (reindexer == null) { if (reindexer == null) {
reindexer = getReindexer(root); reindexer = getReindexer(root);
@ -1248,16 +1249,18 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {
reindexer.w.deleteDocuments(new Term("id", ""+random().nextInt(i))); reindexer.w.deleteDocuments(new Term("id", ""+random().nextInt(i)));
} }
if (random().nextInt(1000) == 17) { if (random().nextInt(commitCloseNumDocs) == 17) {
if (DEBUG) System.out.println("TEST: commit @ " + (i+1) + " docs"); if (DEBUG) System.out.println("TEST: commit @ " + (i+1) + " docs");
reindexer.commit(); reindexer.commit();
commitCloseNumDocs = (int) (1.25 * commitCloseNumDocs);
} }
// Sometimes close & reopen writer/manager, to confirm the parallel segments persist: // Sometimes close & reopen writer/manager, to confirm the parallel segments persist:
if (random().nextInt(1000) == 17) { if (random().nextInt(commitCloseNumDocs) == 17) {
if (DEBUG) System.out.println("TEST: close writer @ " + (i+1) + " docs"); if (DEBUG) System.out.println("TEST: close writer @ " + (i+1) + " docs");
reindexer.close(); reindexer.close();
reindexer = null; reindexer = null;
commitCloseNumDocs = (int) (1.25 * commitCloseNumDocs);
} }
} }
if (reindexer != null) { if (reindexer != null) {