You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by to...@apache.org on 2010/07/30 02:47:21 UTC

svn commit: r980621 - in /hbase/trunk: CHANGES.txt src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java

Author: todd
Date: Fri Jul 30 00:47:21 2010
New Revision: 980621

URL: http://svn.apache.org/viewvc?rev=980621&view=rev
Log:
HBASE-2884. TestHFileOutputFormat flaky when map tasks generate identical data

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=980621&r1=980620&r2=980621&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Jul 30 00:47:21 2010
@@ -458,6 +458,8 @@ Release 0.21.0 - Unreleased
                gets suspended on tty output (Alexey Kovyrin via Stack)
    HBASE-2852  Bloom filter NPE (pranav via jgray)
    HBASE-2820  hbck throws an error if HBase root dir isn't on the default FS
+   HBASE-2884  TestHFileOutputFormat flaky when map tasks generate identical
+               data
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java?rev=980621&r1=980620&r2=980621&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat.java Fri Jul 30 00:47:21 2010
@@ -106,10 +106,15 @@ public class TestHFileOutputFormat  {
       byte keyBytes[] = new byte[keyLength];
       byte valBytes[] = new byte[valLength];
       
-      Random random = new Random(System.currentTimeMillis());
+      int taskId = context.getTaskAttemptID().getTaskID().getId();
+      assert taskId < Byte.MAX_VALUE : "Unit tests dont support > 127 tasks!";
+
+      Random random = new Random();
       for (int i = 0; i < ROWSPERSPLIT; i++) {
 
         random.nextBytes(keyBytes);
+        // Ensure that unique tasks generate unique keys
+        keyBytes[keyLength - 1] = (byte)(taskId & 0xFF);
         random.nextBytes(valBytes);
         ImmutableBytesWritable key = new ImmutableBytesWritable(keyBytes);