hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HBASE-2269) PerformanceEvaluation "--nomapred" may assign duplicate random seed over multiple testing threads
Date Thu, 11 Mar 2010 23:10:27 GMT

     [ https://issues.apache.org/jira/browse/HBASE-2269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

stack resolved HBASE-2269.
--------------------------

       Resolution: Fixed
    Fix Version/s: 0.21.0
                   0.20.4
     Hadoop Flags: [Reviewed]

I committed your latter suggestion Tatsuya:

{code}
Index: src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java
===================================================================
--- src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java (revision 921459)
+++ src/test/org/apache/hadoop/hbase/PerformanceEvaluation.java (working copy)
@@ -666,7 +666,15 @@
    * Subclass to particularize what happens per row.
    */
   static abstract class Test {
-    protected final Random rand = new Random(System.currentTimeMillis());
+    // 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;
{code}

Thanks for the fix.

> PerformanceEvaluation "--nomapred" may assign duplicate random seed over multiple testing
threads
> -------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-2269
>                 URL: https://issues.apache.org/jira/browse/HBASE-2269
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 0.20.3
>         Environment: Any operating system
>            Reporter: Tatsuya Kawano
>            Priority: Minor
>             Fix For: 0.20.4, 0.21.0
>
>
> When you use PerformanceEvaluation with "--nomapred" option, you will end up having the
same random seeds assigned over multiple testing threads. So you'll get inaccurate results
from "random~~" tests.
> {code:title=PerformanceEvaluation.java}
> 542:  abstract class Test {
> 543:     protected final Random rand = new Random(System.currentTimeMillis());
> {code}
> Milliseconds won't be sufficient; today's JVM is much faster to create multiple Test
objects in one millisecond. You might want to use something like "{{super.hashCode()}}" instead.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message