[ 
https://issues.apache.org/jira/browse/OOZIE-1140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13537303#comment-13537303
 ] 

Robert Kanter commented on OOZIE-1140:
--------------------------------------

Assuming that you run this test sometime uniformly distributed within a single 
hour (and assuming my math is correct), there's only about a 0.1% chance of 
running into this issue (in other words, if you ran this test once per hour, it 
would fail only 1 out of every 1000 hours (i.e. 1000 runs)); so, its super rare 
for this to happen :)
                
> TestLogStreamer.testStreamLog fails when its started within the first 4 
> seconds after the hour
> ----------------------------------------------------------------------------------------------
>
>                 Key: OOZIE-1140
>                 URL: https://issues.apache.org/jira/browse/OOZIE-1140
>             Project: Oozie
>          Issue Type: Bug
>          Components: tests
>            Reporter: Robert Kanter
>            Assignee: Robert Kanter
>             Fix For: trunk
>
>         Attachments: OOZIE-1140.patch
>
>
> If TestLogStreamer.testStreamLog is started within the first 4 seconds after 
> the hour (e.g. 3:00:00 - 3:00:04, 4:00:00 - 4:00:04, etc) then it will fail 
> with this exception:
> {code}
> junit.framework.AssertionFailedError: expected:<7> but was:<5>
>       at junit.framework.Assert.fail(Assert.java:50)
>       at junit.framework.Assert.failNotEquals(Assert.java:287)
>       at junit.framework.Assert.assertEquals(Assert.java:67)
>       at junit.framework.Assert.assertEquals(Assert.java:199)
>       at junit.framework.Assert.assertEquals(Assert.java:205)
>       at 
> org.apache.oozie.util.TestLogStreamer.testStreamLog(TestLogStreamer.java:144)
> ...
> {code}
> The test creates some log files and sets their modified time based on the 
> starting time of the test; then it verifies that the right files were picked 
> up when trying to stream log files from a 5 second window starting 10 seconds 
> before the starting time of the test.  However, for gz files, we use the time 
> from their name instead of the modified file time, and assume they last for 
> an hour; but, they don't store second or minute granularity.  
> So, if the test is started within the first 4 seconds, for example at 8:00:03 
> on 12/20/2012, then the gz file will be named {{oozie.log-2012-12-20-08.gz}} 
> and the window we're looking to stream files from is between 7:59:53 and 
> 7:59:58.  The start and end times of the gz file would be considered to be 
> 8:00:00 and 9:00:00 respectively, which doesn't overlap with the window (and 
> the test expects the gz file to fall into the window).  If the test is 
> started after the first 4 seconds, for example at 8:07:00, then the gz file 
> will be named {{oozie.log-2012-12-20-08.gz}} still, but the window would be 
> 8:06:50 to 8:06:55, which overlaps with the gz file start and end times of 
> 8:00:00 and 9:00:00 (so it works as expected).  
> One solution is to change the test to use hours instead of seconds for its 
> window.  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to