accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] ctubbsii commented on a change in pull request #15: Added random pausing to continuous ingest
Date Wed, 27 Jun 2018 20:33:00 GMT
ctubbsii commented on a change in pull request #15: Added random pausing to continuous ingest
URL: https://github.com/apache/accumulo-testing/pull/15#discussion_r198631045
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/testing/core/continuous/ContinuousIngest.java
 ##########
 @@ -45,11 +45,43 @@
   private static final byte[] EMPTY_BYTES = new byte[0];
 
   private static List<ColumnVisibility> visibilities;
+  private static long lastPause;
+  private static long pauseWaitMs;
 
   private static ColumnVisibility getVisibility(Random rand) {
     return visibilities.get(rand.nextInt(visibilities.size()));
   }
 
+  private static boolean pauseEnabled(Properties props) {
+    String value = props.getProperty(TestProps.CI_INGEST_PAUSE_ENABLED);
+    return value != null && value.equals("true");
+  }
+
+  private static int getPauseWaitMs(Properties props, Random rand) {
+    int waitMin = Integer.parseInt(props.getProperty(TestProps.CI_INGEST_PAUSE_WAIT_MIN));
+    int waitMax = Integer.parseInt(props.getProperty(TestProps.CI_INGEST_PAUSE_WAIT_MAX));
+    return (rand.nextInt(waitMax - waitMin) + waitMin) * 1000;
+  }
+
+  private static int getPauseDurationMs(Properties props, Random rand) {
+    int durationMin = Integer.parseInt(props.getProperty(TestProps.CI_INGEST_PAUSE_DURATION_MIN));
+    int durationMax = Integer.parseInt(props.getProperty(TestProps.CI_INGEST_PAUSE_DURATION_MAX));
+    return (rand.nextInt(durationMax - durationMin) + durationMin) * 1000;
 
 Review comment:
   `rand.nextInt(0)` throws an exception. Should check that max is strictly greater than min
before using the difference in the `rand.nextInt()`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message