Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-7988

Replace usage of ExactSizeInputStream with LimitInputStream.

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
    • Hadoop Flags:
      Reviewed

      Description

      HDFS has a class named ExactSizeInputStream used in the protobuf translation layer. This class wraps another InputStream, but constraints the readable bytes to a specified length. The functionality is nearly identical to LimitInputStream in Hadoop Common, with some differences in semantics regarding premature EOF. This issue proposes to eliminate ExactSizeInputStream in favor of LimitInputStream to reduce the size of the codebase.

      1. HDFS-7988.001.patch
        10 kB
        Walter Su
      2. HDFS-7988.002.patch
        10 kB
        Walter Su

        Activity

        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Hdfs-trunk #2571 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2571/)
        HDFS-7988. Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3)

        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java
        • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #2571 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2571/ ) HDFS-7988 . Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3) hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #633 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/633/)
        HDFS-7988. Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3)

        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #633 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/633/ ) HDFS-7988 . Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3) hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #716 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/716/)
        HDFS-7988. Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3)

        • hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #716 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/716/ ) HDFS-7988 . Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3) hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk #1438 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1438/)
        HDFS-7988. Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3)

        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #1438 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/1438/ ) HDFS-7988 . Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3) hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Mapreduce-trunk #2646 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2646/)
        HDFS-7988. Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3)

        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk #2646 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2646/ ) HDFS-7988 . Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3) hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #705 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/705/)
        HDFS-7988. Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3)

        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #705 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/705/ ) HDFS-7988 . Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3) hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-trunk-Commit #8863 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8863/)
        HDFS-7988. Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3)

        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java
        • hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #8863 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8863/ ) HDFS-7988 . Replace usage of ExactSizeInputStream with LimitInputStream. (wheat9: rev 298a8cb096906b5d688842f6520e90dc9779f0b3) hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/util/TestExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/ExactSizeInputStream.java hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        Hide
        wheat9 Haohui Mai added a comment -

        I've committed the patch to trunk and branch-2. Thanks Walter Su for the contribution.

        Show
        wheat9 Haohui Mai added a comment - I've committed the patch to trunk and branch-2. Thanks Walter Su for the contribution.
        Hide
        wheat9 Haohui Mai added a comment -

        +1

        Show
        wheat9 Haohui Mai added a comment - +1
        Hide
        hadoopqa Hadoop QA added a comment -
        +1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 0s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 test4tests 0m 0s The patch appears to include 1 new or modified test files.
        +1 mvninstall 11m 30s trunk passed
        +1 compile 0m 56s trunk passed with JDK v1.8.0_66
        +1 compile 0m 46s trunk passed with JDK v1.7.0_85
        +1 checkstyle 0m 17s trunk passed
        +1 mvnsite 0m 56s trunk passed
        +1 mvneclipse 0m 19s trunk passed
        +1 findbugs 2m 53s trunk passed
        +1 javadoc 0m 42s trunk passed with JDK v1.8.0_66
        +1 javadoc 0m 40s trunk passed with JDK v1.7.0_85
        +1 mvninstall 0m 54s the patch passed
        +1 compile 0m 56s the patch passed with JDK v1.8.0_66
        +1 javac 0m 56s the patch passed
        +1 compile 0m 46s the patch passed with JDK v1.7.0_85
        +1 javac 0m 46s the patch passed
        +1 checkstyle 0m 16s the patch passed
        +1 mvnsite 0m 56s the patch passed
        +1 mvneclipse 0m 18s the patch passed
        +1 whitespace 0m 0s Patch has no whitespace issues.
        +1 findbugs 3m 13s the patch passed
        +1 javadoc 0m 43s the patch passed with JDK v1.8.0_66
        +1 javadoc 0m 36s the patch passed with JDK v1.7.0_85
        +1 unit 1m 33s hadoop-hdfs-client in the patch passed with JDK v1.8.0_66.
        +1 unit 1m 27s hadoop-hdfs-client in the patch passed with JDK v1.7.0_85.
        +1 asflicense 0m 35s Patch does not generate ASF License warnings.
        35m 38s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:0ca8df7
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12773778/HDFS-7988.002.patch
        JIRA Issue HDFS-7988
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux eac8d9a00812 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / 8228697
        findbugs v3.0.0
        JDK v1.7.0_85 Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/13612/testReport/
        modules C: hadoop-hdfs-project/hadoop-hdfs-client U: hadoop-hdfs-project/hadoop-hdfs-client
        Max memory used 75MB
        Powered by Apache Yetus http://yetus.apache.org
        Console output https://builds.apache.org/job/PreCommit-HDFS-Build/13612/console

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 reexec 0m 0s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 1 new or modified test files. +1 mvninstall 11m 30s trunk passed +1 compile 0m 56s trunk passed with JDK v1.8.0_66 +1 compile 0m 46s trunk passed with JDK v1.7.0_85 +1 checkstyle 0m 17s trunk passed +1 mvnsite 0m 56s trunk passed +1 mvneclipse 0m 19s trunk passed +1 findbugs 2m 53s trunk passed +1 javadoc 0m 42s trunk passed with JDK v1.8.0_66 +1 javadoc 0m 40s trunk passed with JDK v1.7.0_85 +1 mvninstall 0m 54s the patch passed +1 compile 0m 56s the patch passed with JDK v1.8.0_66 +1 javac 0m 56s the patch passed +1 compile 0m 46s the patch passed with JDK v1.7.0_85 +1 javac 0m 46s the patch passed +1 checkstyle 0m 16s the patch passed +1 mvnsite 0m 56s the patch passed +1 mvneclipse 0m 18s the patch passed +1 whitespace 0m 0s Patch has no whitespace issues. +1 findbugs 3m 13s the patch passed +1 javadoc 0m 43s the patch passed with JDK v1.8.0_66 +1 javadoc 0m 36s the patch passed with JDK v1.7.0_85 +1 unit 1m 33s hadoop-hdfs-client in the patch passed with JDK v1.8.0_66. +1 unit 1m 27s hadoop-hdfs-client in the patch passed with JDK v1.7.0_85. +1 asflicense 0m 35s Patch does not generate ASF License warnings. 35m 38s Subsystem Report/Notes Docker Image:yetus/hadoop:0ca8df7 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12773778/HDFS-7988.002.patch JIRA Issue HDFS-7988 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux eac8d9a00812 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 8228697 findbugs v3.0.0 JDK v1.7.0_85 Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/13612/testReport/ modules C: hadoop-hdfs-project/hadoop-hdfs-client U: hadoop-hdfs-project/hadoop-hdfs-client Max memory used 75MB Powered by Apache Yetus http://yetus.apache.org Console output https://builds.apache.org/job/PreCommit-HDFS-Build/13612/console This message was automatically generated.
        Hide
        walter.k.su Walter Su added a comment -

        rebased.

        Show
        walter.k.su Walter Su added a comment - rebased.
        Hide
        wheat9 Haohui Mai added a comment -

        Hi Walter Su can you please rebase the patch? Thanks.

        Show
        wheat9 Haohui Mai added a comment - Hi Walter Su can you please rebase the patch? Thanks.
        Hide
        hadoopqa Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12707132/HDFS-7988.001.patch
        against trunk revision 80278a5.

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

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. There were no new javadoc warning messages.

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

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

        -1 core tests. The patch failed these unit tests in hadoop-hdfs-project/hadoop-hdfs:

        org.apache.hadoop.tracing.TestTracing

        Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/10064//testReport/
        Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/10064//console

        This message is automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12707132/HDFS-7988.001.patch against trunk revision 80278a5. +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javadoc . There were no new javadoc warning messages. +1 eclipse:eclipse . The patch built with eclipse:eclipse. +1 findbugs . The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. -1 core tests . The patch failed these unit tests in hadoop-hdfs-project/hadoop-hdfs: org.apache.hadoop.tracing.TestTracing Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/10064//testReport/ Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/10064//console This message is automatically generated.
        Hide
        walter.k.su Walter Su added a comment -

        Currently, hadoop heavily depends on Guava. Guava provide LimitInputStream (ver<=14) and {{ByteStreams.limit(InputStream in,
        long limit)}}. ByteStreams.limit is stable. LimitInputStream has always been @Beta. So that's why we copied LimitInputStream to hadoop.util package in HADOOP-11286.
        Right now, we can remove ExactSizeInputStream.
        In the future, when we stop support Guava (ver<=14) , we can also remove hadoop.util.LimitInputStream and replace it with ByteStreams.limit(..)

        Show
        walter.k.su Walter Su added a comment - Currently, hadoop heavily depends on Guava. Guava provide LimitInputStream (ver<=14) and {{ByteStreams.limit(InputStream in, long limit)}}. ByteStreams.limit is stable. LimitInputStream has always been @Beta. So that's why we copied LimitInputStream to hadoop.util package in HADOOP-11286 . Right now, we can remove ExactSizeInputStream . In the future, when we stop support Guava (ver<=14) , we can also remove hadoop.util.LimitInputStream and replace it with ByteStreams.limit(..)

          People

          • Assignee:
            walter.k.su Walter Su
            Reporter:
            cnauroth Chris Nauroth
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development