HBASE-10552 HFilePerformanceEvaluation.GaussianRandomReadBenchmark fails sometimes.

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1569126 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2014-02-17 22:33:21 +00:00
parent aee76671fe
commit e8e5a7a881
1 changed files with 3 additions and 5 deletions

View File

@ -349,10 +349,7 @@ public class HFilePerformanceEvaluation {
void doRow(int i) throws Exception { void doRow(int i) throws Exception {
HFileScanner scanner = this.reader.getScanner(false, true); HFileScanner scanner = this.reader.getScanner(false, true);
byte[] gaussianRandomRowBytes = getGaussianRandomRowBytes(); byte[] gaussianRandomRowBytes = getGaussianRandomRowBytes();
if (scanner.seekTo(gaussianRandomRowBytes) < 0) { scanner.seekTo(gaussianRandomRowBytes);
LOG.info("Not able to seekTo " + new String(gaussianRandomRowBytes));
return;
}
for (int ii = 0; ii < 30; ii++) { for (int ii = 0; ii < 30; ii++) {
if (!scanner.next()) { if (!scanner.next()) {
LOG.info("NOTHING FOLLOWS"); LOG.info("NOTHING FOLLOWS");
@ -366,7 +363,8 @@ public class HFilePerformanceEvaluation {
private byte [] getGaussianRandomRowBytes() { private byte [] getGaussianRandomRowBytes() {
int r = (int) randomData.nextGaussian((double)totalRows / 2.0, int r = (int) randomData.nextGaussian((double)totalRows / 2.0,
(double)totalRows / 10.0); (double)totalRows / 10.0);
return format(r); // make sure r falls into [0,totalRows)
return format(Math.min(totalRows, Math.max(r,0)));
} }
} }