hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject svn commit: r1565770 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java
Date Fri, 07 Feb 2014 19:46:49 GMT
Author: mbertozzi
Date: Fri Feb  7 19:46:48 2014
New Revision: 1565770

URL: http://svn.apache.org/r1565770
Log:
HBASE-10480 TestLogRollPeriod#testWithEdits may fail due to insufficient waiting

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java?rev=1565770&r1=1565769&r2=1565770&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java
Fri Feb  7 19:46:48 2014
@@ -164,7 +164,17 @@ public class TestLogRollPeriod {
     });
 
     // Sleep until we should get at least min-LogRoll events
+    long wtime = System.currentTimeMillis();
     Thread.sleep((minRolls + 1) * LOG_ROLL_PERIOD);
+    // Do some extra sleep in case the machine is slow,
+    // and the log-roll is not triggered exactly on LOG_ROLL_PERIOD.
+    final int NUM_RETRIES = 1 + 8 * (minRolls - paths.size());
+    for (int retry = 0; paths.size() < minRolls && retry < NUM_RETRIES; ++retry)
{
+      Thread.sleep(LOG_ROLL_PERIOD / 4);
+    }
+    wtime = System.currentTimeMillis() - wtime;
+    LOG.info(String.format("got %d rolls after %dms (%dms each) - expected at least %d rolls",
+                           paths.size(), wtime, wtime / paths.size(), minRolls));
     assertFalse(paths.size() < minRolls);
   }
 }



Mime
View raw message