Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.21.0, 0.22.0
    • Fix Version/s: 0.21.0
    • Component/s: fs
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Release Note:
      FSOutputDataStream implement Syncable interface to provide hflush and hsync APIs to the application users.

      Description

      Earlier this year, Yahoo, Facebook, and Hbase developers had a roundtable discussion where we agreed to support three types of flush in HDFS (API1, 2, and 3) and the append project aims to implement API2. Here is a proposal to expose these APIs to application users.
      1. Three flush APIs

      • API1: flushes out from the address space of client into the socket to the data nodes. On the return of the call there is no guarantee that that data is out of the underlying node and no guarantee of having reached a DN. New readers will eventually see this data if there are no failures.
      • API2: flushes out to all replicas of the block. The data is in the buffers of the DNs but not on the DN's OS buffers. New readers will see the data after the call has returned.
      • API3: flushes out to all replicas and all replicas have done posix fsync equivalent - ie the OS has flushed it to the disk device (but the disk may have it in its cache).

      2. Support flush APIs in FS

      • FSDataOutputStream#flush supports API1
      • FSDataOutputStream implements Syncable interface defined below. If its wrapped output stream (i.e. each file system's stream) is Syncable, FSDataOutputStream#hflush() and hsync() call its wrapped output stream's hflush & hsync.
          public interface Syncable {
            public void hflush() throws IOException;  // support API2
            public void hsync() throws IOException;   // support API3
          }
        
      • In each file system, if only hflush() is implemented, hsync() by default calls hflush(). If only hsync() is implemented, hflush() by default calls flush().
      1. hflushCommon2.patch
        5 kB
        Hairong Kuang
      2. hflushCommon2.patch
        5 kB
        Hairong Kuang
      3. hflushCommon1.patch
        5 kB
        Hairong Kuang

        Issue Links

          Activity

          Tom White made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Tom White made changes -
          Fix Version/s 0.22.0 [ 12314296 ]
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Common-trunk #144 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Common-trunk/144/)
          . Implement Syncable interface in FSDataOutputStream to expose flush APIs to application users. Contributed by Hairong Kuang.

          Show
          Hudson added a comment - Integrated in Hadoop-Common-trunk #144 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Common-trunk/144/ ) . Implement Syncable interface in FSDataOutputStream to expose flush APIs to application users. Contributed by Hairong Kuang.
          Suresh Srinivas made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Suresh Srinivas added a comment -

          I committed the patch to both trunk and 21. Thank you Hairong.

          Show
          Suresh Srinivas added a comment - I committed the patch to both trunk and 21. Thank you Hairong.
          Suresh Srinivas made changes -
          Release Note FSOutputDataStream implement Syncable interface to provide hflush and hsync APIs to the application users.
          Fix Version/s 0.22.0 [ 12314296 ]
          Affects Version/s 0.21.0 [ 12313563 ]
          Affects Version/s 0.22.0 [ 12314296 ]
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Common-trunk-Commit #76 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Common-trunk-Commit/76/)
          . Implement Syncable interface in FSDataOutputStream to expose flush APIs to application users. Contributed by Hairong Kuang.

          Show
          Hudson added a comment - Integrated in Hadoop-Common-trunk-Commit #76 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Common-trunk-Commit/76/ ) . Implement Syncable interface in FSDataOutputStream to expose flush APIs to application users. Contributed by Hairong Kuang.
          Hairong Kuang made changes -
          Link This issue relates to HDFS-744 [ HDFS-744 ]
          Hairong Kuang made changes -
          Attachment hflushCommon2.patch [ 12423645 ]
          Hairong Kuang made changes -
          Attachment hflushCommon.patch [ 12423078 ]
          Hide
          Hairong Kuang added a comment -

          Here is the new ant test-patch result:

          [exec] +1 overall.
          [exec]
          [exec] +1 @author. The patch does not contain any @author tags.
          [exec]
          [exec] +1 tests included. The patch appears to include 3 new or modified tests.
          [exec]
          [exec] +1 javadoc. The javadoc tool did not generate any warning messages.
          [exec]
          [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings.
          [exec]
          [exec] +1 findbugs. The patch does not introduce any new Findbugs warnings.
          [exec]
          [exec] +1 release audit. The applied patch does not increase the total number of release audit warnings.

          Show
          Hairong Kuang added a comment - Here is the new ant test-patch result: [exec] +1 overall. [exec] [exec] +1 @author. The patch does not contain any @author tags. [exec] [exec] +1 tests included. The patch appears to include 3 new or modified tests. [exec] [exec] +1 javadoc. The javadoc tool did not generate any warning messages. [exec] [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings. [exec] [exec] +1 findbugs. The patch does not introduce any new Findbugs warnings. [exec] [exec] +1 release audit. The applied patch does not increase the total number of release audit warnings.
          Hairong Kuang made changes -
          Attachment hflushCommon2.patch [ 12423628 ]
          Hide
          Hairong Kuang added a comment -

          Thank Sanjay and Stack for your review. Here is a patch that adds a @Deprecated annotation to FSDataOutputStream#sync() to remove the javac warning.

          Show
          Hairong Kuang added a comment - Thank Sanjay and Stack for your review. Here is a patch that adds a @Deprecated annotation to FSDataOutputStream#sync() to remove the javac warning.
          Hide
          stack added a comment -

          +1 on patch.

          Show
          stack added a comment - +1 on patch.
          Hide
          Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12423266/hflushCommon1.patch
          against trunk revision 829289.

          +1 @author. The patch does not contain any @author tags.

          +1 tests included. The patch appears to include 3 new or modified tests.

          +1 javadoc. The javadoc tool did not generate any warning messages.

          -1 javac. The applied patch generated 174 javac compiler warnings (more than the trunk's current 172 warnings).

          +1 findbugs. The patch does not introduce any new Findbugs warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          +1 core tests. The patch passed core unit tests.

          +1 contrib tests. The patch passed contrib unit tests.

          Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/testReport/
          Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
          Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/artifact/trunk/build/test/checkstyle-errors.html
          Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/console

          This message is automatically generated.

          Show
          Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12423266/hflushCommon1.patch against trunk revision 829289. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 3 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. -1 javac. The applied patch generated 174 javac compiler warnings (more than the trunk's current 172 warnings). +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/artifact/trunk/build/test/checkstyle-errors.html Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/110/console This message is automatically generated.
          Hairong Kuang made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Hadoop Flags [Reviewed]
          Hide
          Sanjay Radia added a comment -

          +1

          Show
          Sanjay Radia added a comment - +1
          Hairong Kuang made changes -
          Attachment hflushCommon1.patch [ 12423266 ]
          Hide
          Hairong Kuang added a comment -

          This patch removes Syncable implementation in RawLocalFileSystem and makes the default implementation of hflush & hsync to be flush in FSDataOutputStream.

          Show
          Hairong Kuang added a comment - This patch removes Syncable implementation in RawLocalFileSystem and makes the default implementation of hflush & hsync to be flush in FSDataOutputStream.
          Hide
          Hairong Kuang added a comment -

          > 3. makes LocalFSFileOutputStream of RawLocalFileSystem to implement the Syncable interface and also makes it a BufferedOutputStream
          The reason that I made this change is that LocalFSFileOutputStream of RawLocalFileSystem implements Syncable in the trunk although there is a bug. My patch fixed the bug. But another option is to remove the Syncable implementation in RawLocalFileSystem because I guess most users use LocalFileSystem anyway.

          Show
          Hairong Kuang added a comment - > 3. makes LocalFSFileOutputStream of RawLocalFileSystem to implement the Syncable interface and also makes it a BufferedOutputStream The reason that I made this change is that LocalFSFileOutputStream of RawLocalFileSystem implements Syncable in the trunk although there is a bug. My patch fixed the bug. But another option is to remove the Syncable implementation in RawLocalFileSystem because I guess most users use LocalFileSystem anyway.
          Hairong Kuang made changes -
          Link This issue blocks HDFS-731 [ HDFS-731 ]
          Hairong Kuang made changes -
          Field Original Value New Value
          Attachment hflushCommon.patch [ 12423078 ]
          Hide
          Hairong Kuang added a comment -

          This patch
          1. defines Syncable interface
          2. makes FSDataOutputStream to implement Syncable interface
          3. makes LocalFSFileOutputStream of RawLocalFileSystem to implement the Syncable interface and also makes it a BufferedOutputStream
          4. implement a unit test to test 2 and 3.

          Show
          Hairong Kuang added a comment - This patch 1. defines Syncable interface 2. makes FSDataOutputStream to implement Syncable interface 3. makes LocalFSFileOutputStream of RawLocalFileSystem to implement the Syncable interface and also makes it a BufferedOutputStream 4. implement a unit test to test 2 and 3.
          Hairong Kuang created issue -

            People

            • Assignee:
              Hairong Kuang
              Reporter:
              Hairong Kuang
            • Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development