Review Board 1.7.22


Fix for issue FLUME-1993, access violation in Windows with spoolDir source.

Review Request #10607 - Created April 18, 2013 and submitted

Paul Chavez
flume-1.4
FLUME-1993
Reviewers
Flume
flume-git
After checking that the meta file is tracking the right target, don't create a new instance unless it's needed. Otherwise a new instance is requested while the old one is still open for read/write which triggers access exception in Windows.
Unit tests not run. Functional testing for this specific issue has been done on Windows Server 2008 R2
flume-ng-core/src/main/java/org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java
Revision 37f0ee1 New Change
[20] 416 lines
[+20] [+] public int compare(File a, File b) {
417
        PositionTracker tracker =
417
        PositionTracker tracker =
418
            DurablePositionTracker.getInstance(metaFile, nextPath);
418
            DurablePositionTracker.getInstance(metaFile, nextPath);
419
        if (!tracker.getTarget().equals(nextPath)) {
419
        if (!tracker.getTarget().equals(nextPath)) {
420
          tracker.close();
420
          tracker.close();
421
          deleteMetaFile();
421
          deleteMetaFile();
422
        }

   
423
        tracker = DurablePositionTracker.getInstance(metaFile, nextPath);
422
          tracker = DurablePositionTracker.getInstance(metaFile, nextPath);

    
   
423
        }
424

    
   
424

   
425
        // sanity check
425
        // sanity check
426
        Preconditions.checkState(tracker.getTarget().equals(nextPath),
426
        Preconditions.checkState(tracker.getTarget().equals(nextPath),
427
            "Tracker target %s does not equal expected filename %s",
427
            "Tracker target %s does not equal expected filename %s",
428
            tracker.getTarget(), nextPath);
428
            tracker.getTarget(), nextPath);
[+20] [20] 134 lines
  1. flume-ng-core/src/main/java/org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java: Loading...