Sorry for the commit spam. I am cherry picking a bunch of commits from trunk to another branch.
-- Hari Shreedharan On Friday, August 24, 2012 at 10:23 AM, [email protected] wrote: > 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/4f42f04f > Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/4f42f04f > Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/4f42f04f > > Branch: refs/heads/flume-1.3.0 > Commit: 4f42f04f42088f417d42aceb7dab25e864fd5b6b > Parents: 29b62f3 > Author: Brock Noland <[email protected] (mailto:[email protected])> > Authored: Wed Aug 22 13:19:54 2012 -0500 > Committer: Hari Shreedharan <[email protected] > (mailto:[email protected])> > Committed: Fri Aug 24 10:20:58 2012 -0700 > > ---------------------------------------------------------------------- > .../apache/flume/channel/file/TestFileChannel.java | 10 +++++++--- > 1 files changed, 7 insertions(+), 3 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/flume/blob/4f42f04f/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"); > }
