diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java index dbbe6f1ec5..d5a31dffd4 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/AcidUtils.java @@ -1936,22 +1936,26 @@ public static void findOriginals(FileSystem fs, Path dir, private static List tryListLocatedHdfsStatus(Ref useFileIds, FileSystem fs, Path directory) { - List childrenWithId = null; if (useFileIds == null) { - return childrenWithId; + return null; } - Boolean val = useFileIds.value; + + List childrenWithId = null; + final Boolean val = useFileIds.value; if (val == null || val) { try { childrenWithId = SHIMS.listLocatedHdfsStatus(fs, directory, hiddenFileFilter); if (val == null) { useFileIds.value = true; } - } catch (Throwable t) { - LOG.error("Failed to get files with ID; using regular API: " + t.getMessage()); - if (val == null && t instanceof UnsupportedOperationException) { + } catch (UnsupportedOperationException uoe) { + LOG.info("Failed to get files with ID; using regular API: " + uoe.getMessage()); + if (val == null) { useFileIds.value = false; } + } catch (IOException ioe) { + LOG.info("Failed to get files with ID; using regular API: " + ioe.getMessage()); + LOG.debug("Failed to get files with ID", ioe); } } return childrenWithId; @@ -3137,11 +3141,14 @@ public static TxnType getTxnType(Configuration conf, ASTNode tree) { useFileIds.value = true; // The call succeeded, so presumably the API is there. } return result; - } catch (Throwable t) { - LOG.error("Failed to get files with ID; using regular API: " + t.getMessage()); - if (val == null && t instanceof UnsupportedOperationException) { + } catch (UnsupportedOperationException uoe) { + LOG.warn("Failed to get files with ID; using regular API: " + uoe.getMessage()); + if (val == null) { useFileIds.value = false; } + } catch (IOException ioe) { + LOG.info("Failed to get files with ID; using regular API: " + ioe.getMessage()); + LOG.debug("Failed to get files with ID", ioe); } } diff --git a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java index f71f5a58b1..87842138c3 100644 --- a/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java +++ b/shims/common/src/main/java/org/apache/hadoop/hive/shims/HadoopShims.java @@ -251,6 +251,19 @@ RecordReader getRecordReader(JobConf job, CombineFileSplit split, Reporter repor Class> rrClass) throws IOException; } + /** + * List a directory for file status with ID. + * + * @param fs The {@code FileSystem} to load the path + * @param path The directory to list + * @param filter A filter to use on the files in the directory + * @return A list of file status with IDs + * @throws IOException An I/O exception of some sort has occurred + * @throws FileNotFoundException If the path is not found in the + * {@code FileSystem} + * @throws UnsupportedOperationException the {@code FileSystem} is not a + * {@code DistributedFileSystem} + */ List listLocatedHdfsStatus( FileSystem fs, Path path, PathFilter filter) throws IOException;