You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flume.apache.org by Mike Percy <mp...@apache.org> on 2013/04/22 10:02:55 UTC

Review Request: FLUME-2014: Race condition when using local timestamp with BucketPath

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/10699/
-----------------------------------------------------------

Review request for Flume.


Description
-------

This patch changes the behavior of the BucketPath.escapeString() function to only ever call clock.currentTimeMillis() once during an invocation of the method. This prevents a race condition that can cause unexpected results in the interpolated paths.


This addresses bug FLUME-2014.
    https://issues.apache.org/jira/browse/FLUME-2014


Diffs
-----

  flume-ng-core/src/main/java/org/apache/flume/formatter/output/BucketPath.java 971c75c 
  flume-ng-core/src/test/java/org/apache/flume/formatter/output/TestBucketPath.java 9cfefc0 

Diff: https://reviews.apache.org/r/10699/diff/


Testing
-------

Added unit test for the previous condition. All tests pass.

Here is some output from running the new unit test without the patch:

Running org.apache.flume.formatter.output.TestBucketPath
Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.87 sec <<< FAILURE!

Results :

Failed tests:   testDateRace(org.apache.flume.formatter.output.TestBucketPath): Race condition detected expected:<02:[5]0> but was:<02:[0]0>

Tests run: 6, Failures: 1, Errors: 0, Skipped: 0


Thanks,

Mike Percy


Re: Review Request: FLUME-2014: Race condition when using local timestamp with BucketPath

Posted by Hari Shreedharan <hs...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/10699/#review19550
-----------------------------------------------------------

Ship it!


Ship It!

- Hari Shreedharan


On April 22, 2013, 9:27 p.m., Mike Percy wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/10699/
> -----------------------------------------------------------
> 
> (Updated April 22, 2013, 9:27 p.m.)
> 
> 
> Review request for Flume.
> 
> 
> Description
> -------
> 
> This patch changes the behavior of the BucketPath.escapeString() function to only ever call clock.currentTimeMillis() once during an invocation of the method. This prevents a race condition that can cause unexpected results in the interpolated paths.
> 
> 
> This addresses bug FLUME-2014.
>     https://issues.apache.org/jira/browse/FLUME-2014
> 
> 
> Diffs
> -----
> 
>   flume-ng-core/src/main/java/org/apache/flume/formatter/output/BucketPath.java 971c75c 
>   flume-ng-core/src/test/java/org/apache/flume/formatter/output/TestBucketPath.java 9cfefc0 
> 
> Diff: https://reviews.apache.org/r/10699/diff/
> 
> 
> Testing
> -------
> 
> Added unit test for the previous condition. All tests pass.
> 
> Here is some output from running the new unit test without the patch:
> 
> Running org.apache.flume.formatter.output.TestBucketPath
> Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.87 sec <<< FAILURE!
> 
> Results :
> 
> Failed tests:   testDateRace(org.apache.flume.formatter.output.TestBucketPath): Race condition detected expected:<02:[5]0> but was:<02:[0]0>
> 
> Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
> 
> 
> Thanks,
> 
> Mike Percy
> 
>


Re: Review Request: FLUME-2014: Race condition when using local timestamp with BucketPath

Posted by Mike Percy <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/10699/
-----------------------------------------------------------

(Updated April 22, 2013, 9:27 p.m.)


Review request for Flume.


Changes
-------

Good catch Hari! Fixed.

We need unit tests for the timeZone stuff, I filed FLUME-2018 to track that.


Description
-------

This patch changes the behavior of the BucketPath.escapeString() function to only ever call clock.currentTimeMillis() once during an invocation of the method. This prevents a race condition that can cause unexpected results in the interpolated paths.


This addresses bug FLUME-2014.
    https://issues.apache.org/jira/browse/FLUME-2014


Diffs (updated)
-----

  flume-ng-core/src/main/java/org/apache/flume/formatter/output/BucketPath.java 971c75c 
  flume-ng-core/src/test/java/org/apache/flume/formatter/output/TestBucketPath.java 9cfefc0 

Diff: https://reviews.apache.org/r/10699/diff/


Testing
-------

Added unit test for the previous condition. All tests pass.

Here is some output from running the new unit test without the patch:

Running org.apache.flume.formatter.output.TestBucketPath
Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.87 sec <<< FAILURE!

Results :

Failed tests:   testDateRace(org.apache.flume.formatter.output.TestBucketPath): Race condition detected expected:<02:[5]0> but was:<02:[0]0>

Tests run: 6, Failures: 1, Errors: 0, Skipped: 0


Thanks,

Mike Percy


Re: Review Request: FLUME-2014: Race condition when using local timestamp with BucketPath

Posted by Hari Shreedharan <hs...@cloudera.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/10699/#review19542
-----------------------------------------------------------


Looks good, Mike. Just one comment below


flume-ng-core/src/main/java/org/apache/flume/formatter/output/BucketPath.java
<https://reviews.apache.org/r/10699/#comment40346>

    timeZone needs to be passed to the replaceShorthand() call.


- Hari Shreedharan


On April 22, 2013, 8:02 a.m., Mike Percy wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/10699/
> -----------------------------------------------------------
> 
> (Updated April 22, 2013, 8:02 a.m.)
> 
> 
> Review request for Flume.
> 
> 
> Description
> -------
> 
> This patch changes the behavior of the BucketPath.escapeString() function to only ever call clock.currentTimeMillis() once during an invocation of the method. This prevents a race condition that can cause unexpected results in the interpolated paths.
> 
> 
> This addresses bug FLUME-2014.
>     https://issues.apache.org/jira/browse/FLUME-2014
> 
> 
> Diffs
> -----
> 
>   flume-ng-core/src/main/java/org/apache/flume/formatter/output/BucketPath.java 971c75c 
>   flume-ng-core/src/test/java/org/apache/flume/formatter/output/TestBucketPath.java 9cfefc0 
> 
> Diff: https://reviews.apache.org/r/10699/diff/
> 
> 
> Testing
> -------
> 
> Added unit test for the previous condition. All tests pass.
> 
> Here is some output from running the new unit test without the patch:
> 
> Running org.apache.flume.formatter.output.TestBucketPath
> Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.87 sec <<< FAILURE!
> 
> Results :
> 
> Failed tests:   testDateRace(org.apache.flume.formatter.output.TestBucketPath): Race condition detected expected:<02:[5]0> but was:<02:[0]0>
> 
> Tests run: 6, Failures: 1, Errors: 0, Skipped: 0
> 
> 
> Thanks,
> 
> Mike Percy
> 
>