Apache Lucene open-source search software
LUCENE-2885: add WaitForMerges tasks to benchmark
Michael McCandless3e8f55cd0da8
diff --git a/modules/benchmark/CHANGES.txt b/modules/benchmark/CHANGES.txtindex 58f0f708a3c..82c005c3ea9 100644--- a/modules/benchmark/CHANGES.txt+++ b/modules/benchmark/CHANGES.txt@@ -2,6 +2,10 @@ Lucene Benchmark Contrib Change LogThe Benchmark contrib package contains code for benchmarking Lucene in a variety of ways.+01/24/2011+ LUCENE-2885: Add WaitForMerges task (calls IndexWriter.waitForMerges()).+ (Mike McCandless)+10/10/2010The locally built patched version of the Xerces-J jar introducedas part of LUCENE-1591 is no longer required, because Xercesdiff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/WaitForMergesTask.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/WaitForMergesTask.javanew file mode 100644index 00000000000..6cd1c16ff13--- /dev/null+++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/WaitForMergesTask.java@@ -0,0 +1,40 @@+package org.apache.lucene.benchmark.byTask.tasks;+/**+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import java.util.HashMap;+import java.util.Map;++import org.apache.lucene.benchmark.byTask.PerfRunData;+import org.apache.lucene.index.IndexWriter;+import org.apache.lucene.index.IndexReader;++/**+ * Waits for merges to finish.+ */+public class WaitForMergesTask extends PerfTask {++ public WaitForMergesTask(PerfRunData runData) {+ super(runData);+ }++ @Override+ public int doLogic() throws Exception {+ getRunData().getIndexWriter().waitForMerges();+ return 1;+ }+}diff --git a/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java b/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.javaindex 90c970f402b..1df92fc92c4 100755--- a/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java+++ b/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java@@ -514,6 +514,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase {"{ [ AddDoc]: 4} : * ","ResetInputs ","{ [ AddDoc]: 4} : * ",+ "WaitForMerges","CloseIndex",};@@ -549,6 +550,7 @@ public class TestPerfTasksLogic extends BenchmarkTestCase {" ResetSystemErase"," CreateIndex"," { \"AddDocs\" AddDoc > : * ",+ " WaitForMerges"," CloseIndex","} : 2",};