Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-2950

ReliableSpoolingFileEventReader.rollCurrentFile is broken

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.0
    • Fix Version/s: 1.7.0
    • Component/s: None
    • Labels:
      None

      Description

      FLUME-2939 introduced Java 7 API (nio.file) to ReliableSpoolingFileEventReader. However, the committed patch breaks rollCurrentFile on Windows machines.
      File rename might be not atomic, in such cases, and under the assumption that the rolled file and the current file store the same data, Flume only logs a warning and does not assume that the user broke the contract that the spooling directory source demands.
      In order to determine whether the files store the same data, we used the com.google.common.io.Files.equal method. However, FLUME-2939 uses java.nio.file.Files.isSameFile which has different semantics.
      Consequently, this relaxation does not hold anymore. In addition, org.apache.flume.client.avro.TestSpoolingFileLineReader.testDestinationExistsAndSameFileWindows fails.

      I attach a patch that brings back the old check for Files.equal.

        Activity

        Hide
        mpercy Mike Percy added a comment -

        +1. Nice find.

        Show
        mpercy Mike Percy added a comment - +1. Nice find.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit ba64b12670f7b2c9ce079f8898f4601689a51def in flume's branch refs/heads/trunk from Lior Zeno
        [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=ba64b12 ]

        FLUME-2950. ReliableSpoolingFileEventReader.rollCurrentFile is broken

        FLUME-2939 introduced a Java 7 API (nio.file) to
        ReliableSpoolingFileEventReader. However, the committed patch breaks
        rollCurrentFile() on Windows machines. File rename might be not atomic,
        in such cases, and under the assumption that the rolled file and the
        current file store the same data, Flume only logs a warning and does not
        assume that the user broke the contract that the spooling directory
        source demands.

        In order to determine whether the files store the same data, we used the
        com.google.common.io.Files.equal() method. However, FLUME-2939 uses
        java.nio.file.Files.isSameFile() which has different semantics.
        Consequently, this relaxation does not hold anymore. In addition,
        TestSpoolingFileLineReader.testDestinationExistsAndSameFileWindows
        fails. This patch brings back the old check using Files.equal().

        (Lior Zeno via Mike Percy)

        Show
        jira-bot ASF subversion and git services added a comment - Commit ba64b12670f7b2c9ce079f8898f4601689a51def in flume's branch refs/heads/trunk from Lior Zeno [ https://git-wip-us.apache.org/repos/asf?p=flume.git;h=ba64b12 ] FLUME-2950 . ReliableSpoolingFileEventReader.rollCurrentFile is broken FLUME-2939 introduced a Java 7 API (nio.file) to ReliableSpoolingFileEventReader. However, the committed patch breaks rollCurrentFile() on Windows machines. File rename might be not atomic, in such cases, and under the assumption that the rolled file and the current file store the same data, Flume only logs a warning and does not assume that the user broke the contract that the spooling directory source demands. In order to determine whether the files store the same data, we used the com.google.common.io.Files.equal() method. However, FLUME-2939 uses java.nio.file.Files.isSameFile() which has different semantics. Consequently, this relaxation does not hold anymore. In addition, TestSpoolingFileLineReader.testDestinationExistsAndSameFileWindows fails. This patch brings back the old check using Files.equal(). (Lior Zeno via Mike Percy)
        Hide
        mpercy Mike Percy added a comment -

        Pushed to trunk. Thanks for the fix, Lior!

        Show
        mpercy Mike Percy added a comment - Pushed to trunk. Thanks for the fix, Lior!
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Flume-trunk-hbase-1 #176 (See https://builds.apache.org/job/Flume-trunk-hbase-1/176/)
        FLUME-2950. ReliableSpoolingFileEventReader.rollCurrentFile is broken (mpercy: http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=ba64b12670f7b2c9ce079f8898f4601689a51def)

        • flume-ng-core/src/main/java/org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Flume-trunk-hbase-1 #176 (See https://builds.apache.org/job/Flume-trunk-hbase-1/176/ ) FLUME-2950 . ReliableSpoolingFileEventReader.rollCurrentFile is broken (mpercy: http://git-wip-us.apache.org/repos/asf/flume/repo?p=flume.git&a=commit&h=ba64b12670f7b2c9ce079f8898f4601689a51def ) flume-ng-core/src/main/java/org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java

          People

          • Assignee:
            liorze Lior Zeno
            Reporter:
            liorze Lior Zeno
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development