You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by we...@apache.org on 2019/12/12 11:24:52 UTC

[hadoop] branch branch-2.9 updated (8ebaf02 -> 3d6d78f)

This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a change to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/hadoop.git.


    from 8ebaf02  HADOOP-16754. Fix docker failed to build yetus/hadoop
     new 51782c4  HDFS-13511. Provide specialized exception when block length cannot be obtained. Contributed by Gabor Bota.
     new 3d6d78f  HDFS-15050. Optimize log information when DFSInputStream meet CannotObtainBlockLengthException. Contributed by Xiaoqiao He.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../hdfs/CannotObtainBlockLengthException.java     | 67 ++++++++++++++++++++++
 .../org/apache/hadoop/hdfs/DFSInputStream.java     |  2 +-
 2 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[hadoop] 02/02: HDFS-15050. Optimize log information when DFSInputStream meet CannotObtainBlockLengthException. Contributed by Xiaoqiao He.

Posted by we...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/hadoop.git

commit 3d6d78fc9163b47660be1e6e2f686b3e31fb47b4
Author: He Xiaoqiao <he...@apache.org>
AuthorDate: Wed Dec 11 16:33:26 2019 -0800

    HDFS-15050. Optimize log information when DFSInputStream meet CannotObtainBlockLengthException. Contributed by Xiaoqiao He.
    
    Signed-off-by: Wei-Chiu Chuang <we...@apache.org>
    (cherry picked from commit 99af49878cc47f5750b6c0edadc8a4c2fcd7a7c6)
    (cherry picked from commit 8ba4e13dcc4ad16e8483d33a31ed52e1b8d4e686)
    (cherry picked from commit 974706c5fdd7c875922b38a2efffb6b7bda8cdf5)
    (cherry picked from commit 3138b79e561bb5258db1f6a70b7e0ae768784eac)
---
 .../apache/hadoop/hdfs/CannotObtainBlockLengthException.java | 12 ++++++++++++
 .../src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java
index 6da1d67..d6b2856 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java
@@ -52,4 +52,16 @@ public class CannotObtainBlockLengthException extends IOException {
     super("Cannot obtain block length for " + locatedBlock);
   }
 
+  /**
+   * Constructs an {@code CannotObtainBlockLengthException} with the
+   * specified LocatedBlock and file that failed to obtain block length.
+   *
+   * @param locatedBlock
+   *        The LocatedBlock instance which block length can not be obtained
+   * @param src The file which include this block
+   */
+  public CannotObtainBlockLengthException(LocatedBlock locatedBlock,
+      String src) {
+    super("Cannot obtain block length for " + locatedBlock + " of " + src);
+  }
 }
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
index 735d124..939c45c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
@@ -451,7 +451,7 @@ public class DFSInputStream extends FSInputStream
       return 0;
     }
 
-    throw new CannotObtainBlockLengthException(locatedblock);
+    throw new CannotObtainBlockLengthException(locatedblock, src);
   }
 
   public long getFileLength() {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[hadoop] 01/02: HDFS-13511. Provide specialized exception when block length cannot be obtained. Contributed by Gabor Bota.

Posted by we...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/hadoop.git

commit 51782c46579d32fa38129ee8068da7ee6c3bd2fe
Author: Xiao Chen <xi...@apache.org>
AuthorDate: Tue Jun 5 21:24:25 2018 -0700

    HDFS-13511. Provide specialized exception when block length cannot be obtained. Contributed by Gabor Bota.
    
    (cherry picked from commit 774c1f199e11d886d0c0a1069325f0284da35deb)
    (cherry picked from commit 3b646a98365f0e7fb0690df63b1da6f7270c6e71)
    (cherry picked from commit d675a955e244ae60139742bce806c0411d78576d)
---
 .../hdfs/CannotObtainBlockLengthException.java     | 55 ++++++++++++++++++++++
 .../org/apache/hadoop/hdfs/DFSInputStream.java     |  2 +-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java
new file mode 100644
index 0000000..6da1d67
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/CannotObtainBlockLengthException.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hdfs;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.hadoop.hdfs.protocol.LocatedBlock;
+
+import java.io.IOException;
+
+/**
+ * This exception is thrown when the length of a LocatedBlock instance
+ * can not be obtained.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Unstable
+public class CannotObtainBlockLengthException extends IOException {
+  private static final long serialVersionUID = 1L;
+
+  public CannotObtainBlockLengthException() {
+    super();
+  }
+
+  public CannotObtainBlockLengthException(String message){
+    super(message);
+  }
+
+  /**
+   * Constructs an {@code CannotObtainBlockLengthException} with the
+   * specified LocatedBlock that failed to obtain block length.
+   *
+   * @param locatedBlock
+   *        The LocatedBlock instance which block length can not be obtained
+   */
+  public CannotObtainBlockLengthException(LocatedBlock locatedBlock) {
+    super("Cannot obtain block length for " + locatedBlock);
+  }
+
+}
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
index 5c2dfc4..735d124 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java
@@ -451,7 +451,7 @@ public class DFSInputStream extends FSInputStream
       return 0;
     }
 
-    throw new IOException("Cannot obtain block length for " + locatedblock);
+    throw new CannotObtainBlockLengthException(locatedblock);
   }
 
   public long getFileLength() {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org