diff --git a/contrib/benchmark/CHANGES.txt b/contrib/benchmark/CHANGES.txt index 4622711b908..6773a58fa50 100644 --- a/contrib/benchmark/CHANGES.txt +++ b/contrib/benchmark/CHANGES.txt @@ -4,6 +4,9 @@ The Benchmark contrib package contains code for benchmarking Lucene in a variety $Id:$ +12/16/08 + LUCENE-1492: Added optional readOnly param (default true) to OpenReader task. + 9/9/08 LUCENE-1243: Added new sorting benchmark capabilities. Also Reopen and commit tasks. (Mark Miller via Grant Ingersoll) diff --git a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenReaderTask.java b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenReaderTask.java index fcef25ea91c..1f0c84823e2 100644 --- a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenReaderTask.java +++ b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OpenReaderTask.java @@ -29,15 +29,25 @@ import org.apache.lucene.store.Directory; */ public class OpenReaderTask extends PerfTask { + private boolean readOnly = true; + public OpenReaderTask(PerfRunData runData) { super(runData); } public int doLogic() throws IOException { Directory dir = getRunData().getDirectory(); - IndexReader reader = IndexReader.open(dir); + IndexReader reader = IndexReader.open(dir, readOnly); getRunData().setIndexReader(reader); return 1; } + public void setParams(String params) { + super.setParams(params); + readOnly = Boolean.valueOf(params).booleanValue(); + } + + public boolean supportsParams() { + return true; + } } diff --git a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java index a3f31b22691..a311c4fe339 100755 --- a/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java +++ b/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java @@ -109,7 +109,7 @@ public class TestPerfTasksLogic extends TestCase { "{ AddDoc } : 1000", "Optimize", "CloseIndex", - "OpenReader", + "OpenReader(true)", "{ CountingHighlighterTest(size[1],highlight[1],mergeContiguous[true],maxFrags[1],fields[body]) } : 200", "CloseReader", }; @@ -147,7 +147,7 @@ public class TestPerfTasksLogic extends TestCase { "{ AddDoc } : 1000", "Optimize", "CloseIndex", - "OpenReader", + "OpenReader(false)", "{ CountingHighlighterTest(size[1],highlight[1],mergeContiguous[true],maxFrags[1],fields[body]) } : 200", "CloseReader", };