You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Jonathan Hsieh <jo...@cloudera.com> on 2012/07/03 18:36:01 UTC

[Jira Down] HBASE-6306 - TestFSUtils fails against hadoop 2.0

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
// jon@cloudera.com

Re: [Jira Down] HBASE-6306 - TestFSUtils fails against hadoop 2.0

Posted by Jonathan Hsieh <jo...@cloudera.com>.
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 <ap...@apache.org> 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 <jo...@cloudera.com> 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
> > // jon@cloudera.com
> >
> >
>
>
>
> --
> Best regards,
>
>    - Andy
>
> Problems worthy of attack prove their worth by hitting back. - Piet
> Hein (via Tom White)
>



-- 
// Jonathan Hsieh (shay)
// Software Engineer, Cloudera
// jon@cloudera.com

Re: [Jira Down] HBASE-6306 - TestFSUtils fails against hadoop 2.0

Posted by Andrew Purtell <ap...@apache.org>.
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 <jo...@cloudera.com> 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
> // jon@cloudera.com
>
>



-- 
Best regards,

   - Andy

Problems worthy of attack prove their worth by hitting back. - Piet
Hein (via Tom White)