Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

contrib/benchmark: better error handling and javadocs around "exhaustive" doc making.

Doron Cohen934a56e55f6d
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.
<br>Example - <font color="#FF0066">{ AddDoc AddDoc } : 30</font> - would do
addDoc 60 times in a row.
<br><b>Exhaustive repeating</b>: use <font color="#FF0066">*</font> 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
+ <font color="#FF0066">doc.maker.forever</font> to false.
<br>Example - <font color="#FF0066">{ AddDoc } : *</font> - would add docs
until the doc maker is "exhausted".
</li>
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;
}