Review Board 1.7.22


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

Review Request #10699 - Created April 22, 2013 and updated

Mike Percy
FLUME-2014
Reviewers
Flume
flume-git
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.

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
Total:
1
Open:
0
Resolved:
1
Dropped:
0
Status:
From:
Description From Last Updated Status
Review request changed
Updated (April 22, 2013, 9:27 p.m.)
Good catch Hari! Fixed.

We need unit tests for the timeZone stuff, I filed FLUME-2018 to track that.
Ship it!
Posted (April 22, 2013, 9:46 p.m.)
Ship It!