flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject git commit: FLUME-1504: Test file channel times out randomly
Date Wed, 22 Aug 2012 18:20:16 GMT
Updated Branches:
  refs/heads/trunk eb7eab659 -> 0c73dc7e7


FLUME-1504: Test file channel times out randomly

(Hari Shreedharan via Brock Noland)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/0c73dc7e
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/0c73dc7e
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/0c73dc7e

Branch: refs/heads/trunk
Commit: 0c73dc7e784bd4bc67c1e1d3a91470769ac0473e
Parents: eb7eab6
Author: Brock Noland <brock@apache.org>
Authored: Wed Aug 22 13:19:54 2012 -0500
Committer: Brock Noland <brock@apache.org>
Committed: Wed Aug 22 13:19:54 2012 -0500

----------------------------------------------------------------------
 .../apache/flume/channel/file/TestFileChannel.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/0c73dc7e/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannel.java
----------------------------------------------------------------------
diff --git a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannel.java
b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannel.java
index 720fa27..3dededf 100644
--- a/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannel.java
+++ b/flume-ng-channels/flume-file-channel/src/test/java/org/apache/flume/channel/file/TestFileChannel.java
@@ -791,7 +791,9 @@ public class TestFileChannel {
    */
   @Test
   public void testTakeTransactionCrossingCheckpoint() throws Exception {
-    channel = createFileChannel();
+    Map<String, String> overrides = Maps.newHashMap();
+    overrides.put(FileChannelConfiguration.CHECKPOINT_INTERVAL, "10000");
+    channel = createFileChannel(overrides);
     channel.start();
     Assert.assertTrue(channel.isOpen());
     List<String> in = Lists.newArrayList();
@@ -822,7 +824,7 @@ public class TestFileChannel {
     tx.commit();
     tx.close();
     channel.stop();
-    channel = createFileChannel();
+    channel = createFileChannel(overrides);
     channel.start();
     Assert.assertTrue(channel.isOpen());
     // we should not geet the item we took of the queue above
@@ -852,6 +854,7 @@ public class TestFileChannel {
     Set<String> set = Sets.newHashSet();
     Map<String, String> overrides = Maps.newHashMap();
     overrides.put(FileChannelConfiguration.CAPACITY, String.valueOf(2));
+    overrides.put(FileChannelConfiguration.CHECKPOINT_INTERVAL, "10000");
     FileChannel channel = createFileChannel(overrides);
     channel.start();
     //Force a checkpoint by committing a transaction
@@ -899,6 +902,7 @@ public class TestFileChannel {
     Set<String> set = Sets.newHashSet();
     Map<String, String> overrides = Maps.newHashMap();
     overrides.put(FileChannelConfiguration.CAPACITY, String.valueOf(2));
+    overrides.put(FileChannelConfiguration.CHECKPOINT_INTERVAL, "10000");
     FileChannel channel = createFileChannel(overrides);
     channel.start();
     //Force a checkpoint by committing a transaction
@@ -916,7 +920,7 @@ public class TestFileChannel {
     long t1 = System.currentTimeMillis();
     while (checkpoint.lastModified() < t1) {
       TimeUnit.MILLISECONDS.sleep(500);
-      if(t1 - checkpoint.lastModified() > 15000){
+      if(System.currentTimeMillis() - checkpoint.lastModified() > 15000){
         throw new TimeoutException("Checkpoint was expected,"
                 + " but did not happen");
       }


Mime
View raw message