HBASE-2268 PerformanceEvaluation --nomapred may assign duplicate random seed over multiple testing threads

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@922070 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-03-11 23:33:53 +00:00
parent 59955d1a5b
commit 685d6093b0
2 changed files with 12 additions and 3 deletions

View File

@ -233,6 +233,8 @@ Release 0.21.0 - Unreleased
(dhruba borthakur via Stack)
HBASE-2308 Fix the bin/rename_table.rb script, make it work again
HBASE-2307 hbase-2295 changed hregion size, testheapsize broke... fix it
HBASE-2269 PerformanceEvaluation "--nomapred" may assign duplicate random
seed over multiple testing threads (Tatsuya Kawano via Stack)
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -96,7 +96,7 @@ public class PerformanceEvaluation implements HConstants {
public static final byte [] FAMILY_NAME = Bytes.toBytes("info");
public static final byte [] QUALIFIER_NAME = Bytes.toBytes("data");
protected HTableDescriptor TABLE_DESCRIPTOR; {
protected static HTableDescriptor TABLE_DESCRIPTOR; {
TABLE_DESCRIPTOR = new HTableDescriptor("TestTable");
TABLE_DESCRIPTOR.addFamily(new HColumnDescriptor(FAMILY_NAME));
}
@ -539,8 +539,15 @@ public class PerformanceEvaluation implements HConstants {
* A test.
* Subclass to particularize what happens per row.
*/
abstract class Test {
protected final Random rand = new Random(System.currentTimeMillis());
static abstract class Test {
// Below is make it so when Tests are all running in the one
// jvm, that they each have a differently seeded Random.
private static final Random randomSeed =
new Random(System.currentTimeMillis());
private static long nextRandomSeed() {
return randomSeed.nextLong();
}
protected final Random rand = new Random(nextRandomSeed());
protected final int startRow;
protected final int perClientRunRows;
protected final int totalRows;