From 934a56e55f6d8089c1cad7fdf18b9266a688b548 Mon Sep 17 00:00:00 2001 From: Doron Cohen Date: Fri, 13 Apr 2007 19:30:03 +0000 Subject: [PATCH] contrib/benchmark: better error handling and javadocs around "exhaustive" doc making. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@528617 13f79535-47bb-0310-9956-ffa450edef68 --- contrib/benchmark/CHANGES.txt | 4 ++++ .../org/apache/lucene/benchmark/byTask/package.html | 9 +++++---- .../lucene/benchmark/byTask/tasks/TaskSequence.java | 9 +++++++-- .../apache/lucene/benchmark/byTask/utils/Config.java | 11 +++++++---- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/contrib/benchmark/CHANGES.txt b/contrib/benchmark/CHANGES.txt index e2ff946b88a..7d6ede3dc19 100644 --- a/contrib/benchmark/CHANGES.txt +++ b/contrib/benchmark/CHANGES.txt @@ -4,6 +4,10 @@ The Benchmark contrib package contains code for benchmarking Lucene in a variety $Id:$ +4/13/07 + +Better error handling and javadocs around "exhaustive" doc making. + 3/25/07 LUCENE-849: diff --git a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html index a33df5228e2..ab2db0b66ad 100644 --- a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html +++ b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/package.html @@ -212,11 +212,12 @@ The following is an informal description of the supported syntax.
Example - { AddDoc AddDoc } : 30 - would do addDoc 60 times in a row.
Exhaustive repeating: use * instead of - a number to repeat forever. + a number to repeat exhaustively. This is sometimes useful, for adding as many files as a doc maker can create, - without iterating over the same files again, but in the case that the exact - number of files is not known in advance. For insance, TREC files extracted - from a zip file. + without iterating over the same file again, especially when the exact + number of documents is not known in advance. For insance, TREC files extracted + from a zip file. Note: when using this, you must also set + doc.maker.forever to false.
Example - { AddDoc } : * - would add docs until the doc maker is "exhausted". diff --git a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java index 0da5705bb21..d917e125164 100644 --- a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java +++ b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java @@ -67,8 +67,13 @@ public class TaskSequence extends PerfTask { */ public void setRepetitions(int repetitions) throws Exception { this.repetitions = repetitions; - if (repetitions==REPEAT_EXHAUST && isParallel()) { - throw new Exception("REPEAT_EXHAUST is not allowed for parallel tasks"); + if (repetitions==REPEAT_EXHAUST) { + if (isParallel()) { + throw new Exception("REPEAT_EXHAUST is not allowed for parallel tasks"); + } + if (getRunData().getConfig().get("doc.maker.forever",true)) { + throw new Exception("REPEAT_EXHAUST requires setting doc.maker.forever=false"); + } } setSequenceName(); } diff --git a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java index 150e8392d9f..41ede6bee32 100644 --- a/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java +++ b/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java @@ -195,9 +195,11 @@ public class Config { public int newRound () { roundNumber++; + StringBuffer sb = new StringBuffer("--> Round ").append(roundNumber-1).append("-->").append(roundNumber); + // log changes in values if (valByRound.size()>0) { - StringBuffer sb = new StringBuffer("--> Round ").append(roundNumber-1).append("-->").append(roundNumber).append(": "); + sb.append(": "); for (Iterator iter = valByRound.keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); Object a = valByRound.get(name); @@ -213,10 +215,11 @@ public class Config { sb.append(" ").append(name).append(":").append(ab[n1]).append("-->").append(ab[n2]); } } - System.out.println(); - System.out.println(sb.toString()); - System.out.println(); } + + System.out.println(); + System.out.println(sb.toString()); + System.out.println(); return roundNumber; }