You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2011/12/16 18:06:16 UTC

svn commit: r1215226 - /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/RCFile.java

Author: namit
Date: Fri Dec 16 17:06:15 2011
New Revision: 1215226

URL: http://svn.apache.org/viewvc?rev=1215226&view=rev
Log:
HIVE-2660 Need better exception handling in RCFile tolerate corruptions
mode (Ramkumar Vadali via namit)


Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/RCFile.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/RCFile.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/RCFile.java?rev=1215226&r1=1215225&r2=1215226&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/RCFile.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/io/RCFile.java Fri Dec 16 17:06:15 2011
@@ -158,6 +158,11 @@ public class RCFile {
   public static final String TOLERATE_CORRUPTIONS_CONF_STR =
     "hive.io.rcfile.tolerate.corruptions";
 
+  // HACK: We actually need BlockMissingException, but that is not available
+  // in all hadoop versions.
+  public static final String BLOCK_MISSING_MESSAGE =
+    "Could not obtain block";
+
   /*
    * these header and Sync are kept from SequenceFile, for compatible of
    * SequenceFile's format.
@@ -1549,18 +1554,18 @@ public class RCFile {
       try {
         ret = nextKeyBuffer();
         this.currentValueBuffer();
-      } catch (EOFException eof) {
-        LOG.warn("Ignoring EOFException in file " + file +
-                 " after offset " + currentOffset, eof);
-        ret = -1;
-      } catch (ChecksumException ce) {
-        LOG.warn("Ignoring ChecksumException in file " + file +
-                 " after offset " + currentOffset, ce);
-        ret = -1;
       } catch (IOException ioe) {
-        // We have an IOException other than EOF or ChecksumException
-        // This is likely a read-error, not corruption, re-throw.
-        throw ioe;
+        // A BlockMissingException indicates a temporary error,
+        // not a corruption. Re-throw this exception.
+        String msg = ioe.getMessage();
+        if (msg != null && msg.startsWith(BLOCK_MISSING_MESSAGE)) {
+          LOG.warn("Re-throwing block-missing exception" + ioe);
+          throw ioe;
+        }
+        // We have an IOException other than a BlockMissingException.
+        LOG.warn("Ignoring IOException in file " + file +
+                 " after offset " + currentOffset, ioe);
+        ret = -1;
       } catch (Throwable t) {
         // We got an exception that is not IOException
         // (typically OOM, IndexOutOfBounds, InternalError).