HBASE-2884. TestHFileOutputFormat flaky when map tasks generate identical data

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@980621 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2010-07-30 00:47:21 +00:00
parent 852f3cf9a0
commit d4d88f1ce3
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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);