Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # dev >> [Jira Down] HBASE-6306 - TestFSUtils fails against hadoop 2.0


Copy link to this message
-
Re: [Jira Down] HBASE-6306 - TestFSUtils fails against hadoop 2.0
done.

Here's review board.
https://reviews.apache.org/r/5723/

Here's the diff (it is small):

diff --git
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
index e12d269..528cf09 100644
--- hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
+++ hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
@@ -267,7 +267,14 @@ public abstract class FSUtils {
   public static String getVersion(FileSystem fs, Path rootdir)
   throws IOException, DeserializationException {
     Path versionFile = new Path(rootdir, HConstants.VERSION_FILE_NAME);
-    FileStatus [] status = fs.listStatus(versionFile);
+    FileStatus[] status = null;
+    try {
+      // hadoop 2.0 throws FNFE if directory does not exist.
+      // hadoop 1.0 returns null if directory does not exist.
+      status = fs.listStatus(versionFile);
+    } catch (FileNotFoundException fnfe) {
+      return null;
+    }
     if (status == null || status.length == 0) return null;
     String version = null;
     byte [] content = new byte [(int)status[0].getLen()];
Jon.

Tue, Jul 3, 2012 at 9:37 AM, Andrew Purtell <[EMAIL PROTECTED]> wrote:

> Did you attach to this mail? Mailing list software strips attachments
> IIRC, should put it up on reviewboard if you want to share.
>
> On Tue, Jul 3, 2012 at 9:36 AM, Jonathan Hsieh <[EMAIL PROTECTED]> wrote:
> > I've attached a simple patch that seems to fix the trunk build.  It is
> > pretty straight forward -- I plan on committing later today.  This patch
> > actually fixes HBASE-6305 - TestLocalHBaseCluster failing against hadoop
> 2.0
> > for 0.96 as well.
> >
> > The test was new for 0.96 so it didn't affect 0.94 on top of hadoop 23 --
> > I'm investigating to see if it is an alternative fix for HBASE-6305
> against
> > 0.94.
> >
> > Jon.
> >
> > --
> > // Jonathan Hsieh (shay)
> > // Software Engineer, Cloudera
> > // [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> Best regards,
>
>    - Andy
>
> Problems worthy of attack prove their worth by hitting back. - Piet
> Hein (via Tom White)
>

--
// Jonathan Hsieh (shay)
// Software Engineer, Cloudera
// [EMAIL PROTECTED]