From 2f35956eb831c11436b785c37bed0bd93550ab99 Mon Sep 17 00:00:00 2001 From: Josh Elser Date: Wed, 23 Nov 2016 13:25:53 -0500 Subject: [PATCH] HBASE-17171 Proactively catch the case when no time remains for random reads The framework sets a configuration property to control how long reads should be executed. When writes take too long, no time remains for reads and the user sees an error about a property they must set. We should prevent this case and log an appropriate message. Also fixes a rogue character in the class-level javadoc. Signed-off-by: Michael Stack --- ...ionTestTimeBoundedRequestsWithRegionReplicas.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestTimeBoundedRequestsWithRegionReplicas.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestTimeBoundedRequestsWithRegionReplicas.java index b8e939fdb5b..008c6a63269 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestTimeBoundedRequestsWithRegionReplicas.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestTimeBoundedRequestsWithRegionReplicas.java @@ -75,7 +75,7 @@ import com.google.common.collect.Lists; * These parameters (and some other parameters from LoadTestTool) can be used to * control behavior, given values are default: *
- * -Dhbase.DIntegrationTestTimeBoundedRequestsWithRegionReplicas.runtime=600000
+ * -Dhbase.IntegrationTestTimeBoundedRequestsWithRegionReplicas.runtime=600000
  * -DIntegrationTestTimeBoundedRequestsWithRegionReplicas.num_regions_per_server=5
  * -DIntegrationTestTimeBoundedRequestsWithRegionReplicas.get_timeout_ms=5000
  * -DIntegrationTestTimeBoundedRequestsWithRegionReplicas.num_keys_per_server=2500
@@ -202,6 +202,16 @@ public class IntegrationTestTimeBoundedRequestsWithRegionReplicas extends Integr
     // set the intended run time for the reader. The reader will do read requests
     // to random keys for this amount of time.
     long remainingTime = runtime - (System.currentTimeMillis() - start);
+    if (remainingTime <= 0) {
+      LOG.error("The amount of time left for the test to perform random reads is "
+          + "non-positive. Increase the test execution time via "
+          + String.format(RUN_TIME_KEY,
+                IntegrationTestTimeBoundedRequestsWithRegionReplicas.class.getSimpleName())
+          + " or reduce the amount of data written per server via "
+          + IntegrationTestTimeBoundedRequestsWithRegionReplicas.class.getSimpleName()
+          + "." + IntegrationTestIngest.NUM_KEYS_PER_SERVER_KEY);
+      throw new IllegalArgumentException("No time remains to execute random reads");
+    }
     LOG.info("Reading random keys from the table for " + remainingTime/60000 + " min");
     this.conf.setLong(
       String.format(RUN_TIME_KEY, TimeBoundedMultiThreadedReader.class.getSimpleName())