HBASE-13382 IntegrationTestBigLinkedList should use SecureRandom (Dima Spivak)

This commit is contained in:
stack 2015-04-03 15:32:50 -07:00
parent 3a2a29616c
commit f561ef71a5
1 changed files with 4 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import java.io.DataOutput;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.security.SecureRandom;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
@ -303,7 +304,8 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase {
public void initialize(InputSplit arg0, TaskAttemptContext context) public void initialize(InputSplit arg0, TaskAttemptContext context)
throws IOException, InterruptedException { throws IOException, InterruptedException {
numNodes = context.getConfiguration().getLong(GENERATOR_NUM_ROWS_PER_MAP_KEY, 25000000); numNodes = context.getConfiguration().getLong(GENERATOR_NUM_ROWS_PER_MAP_KEY, 25000000);
rand = new Random(); // Use SecureRandom to avoid issue described in HBASE-13382.
rand = new SecureRandom();
} }
@Override @Override
@ -1358,7 +1360,7 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase {
if (cmd.hasOption('n')) { if (cmd.hasOption('n')) {
maxQueries = Long.parseLong(cmd.getOptionValue("n")); maxQueries = Long.parseLong(cmd.getOptionValue("n"));
} }
Random rand = new Random(); Random rand = new SecureRandom();
boolean isSpecificStart = cmd.hasOption('s'); boolean isSpecificStart = cmd.hasOption('s');
byte[] startKey = isSpecificStart ? Bytes.toBytesBinary(cmd.getOptionValue('s')) : null; byte[] startKey = isSpecificStart ? Bytes.toBytesBinary(cmd.getOptionValue('s')) : null;
int logEvery = cmd.hasOption('l') ? Integer.parseInt(cmd.getOptionValue('l')) : 1; int logEvery = cmd.hasOption('l') ? Integer.parseInt(cmd.getOptionValue('l')) : 1;