Return-Path: X-Original-To: apmail-hadoop-hdfs-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 08EABC8E5 for ; Fri, 21 Jun 2013 16:44:19 +0000 (UTC) Received: (qmail 86528 invoked by uid 500); 21 Jun 2013 16:44:13 -0000 Delivered-To: apmail-hadoop-hdfs-user-archive@hadoop.apache.org Received: (qmail 86076 invoked by uid 500); 21 Jun 2013 16:44:09 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 86069 invoked by uid 99); 21 Jun 2013 16:44:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jun 2013 16:44:08 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jltz922181@gmail.com designates 209.85.215.46 as permitted sender) Received: from [209.85.215.46] (HELO mail-la0-f46.google.com) (209.85.215.46) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jun 2013 16:44:02 +0000 Received: by mail-la0-f46.google.com with SMTP id eg20so7665102lab.33 for ; Fri, 21 Jun 2013 09:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SjRmwzmV1+WTB75iTUJ8ojYll4F3szHOcyveBJat7jY=; b=ldwj810kL6QKgvcVUPw2pSBJWF9OxRYHhWSjOgSn53HdPkcBvEMuJhPvCFmNZdcpzl 2YAhxDRjkadfOKGhWOdaZovfXfD55/s/hcVRMtxjoYeJPSFMbnNaPptjJtJ7dQt1jaTS PABIlnqprF13LAWJA76DwTJ++Sb+gCm2V4RddT2p7GN1gdw1AFhhcADfGigOjGmRbG2i kjPLtEtp67ol3+kpL1mNaIaPgt7816Raq45IEqlR5NSWwhEW6FtgRpAAZ3vDfeX1PJj+ xsaMoQebzvdNLllMLVfq3dUAyjOw2BV5gA+pE1JSVW1HBTmzduNU/faLyoHpZSvJGGgu iXHQ== MIME-Version: 1.0 X-Received: by 10.112.63.2 with SMTP id c2mr7913329lbs.6.1371833021710; Fri, 21 Jun 2013 09:43:41 -0700 (PDT) Received: by 10.112.80.68 with HTTP; Fri, 21 Jun 2013 09:43:41 -0700 (PDT) In-Reply-To: <1C40D33AEC9DCA40A06F4637B6E58ABF46ABD19B@LAX-EX-MB2.datadirect.datadirectnet.com> References: <1C40D33AEC9DCA40A06F4637B6E58ABF46ABD19B@LAX-EX-MB2.datadirect.datadirectnet.com> Date: Fri, 21 Jun 2013 09:43:41 -0700 Message-ID: Subject: Re: how to turn on NativeIO.posixFadviseIfPossible From: Jun Li To: user@hadoop.apache.org Content-Type: multipart/alternative; boundary=001a11c3e880f348c104dfacc336 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c3e880f348c104dfacc336 Content-Type: text/plain; charset=ISO-8859-1 Hi Leo, Following your instruction, the following is what I got: [junli@mercoop-26 Linux-amd64-64]$ objdump -Tt libhadoop.so | grep -I fadvise 0000000000004d70 g F .text 000000000000006f Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise 0000000000004d70 g DF .text 000000000000006f Base Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise Apparently the part of "the GLIBC" is not there The libhadoop.so is the one that I downloaded as part of the tar.gz of hadoop.1.1.2 from the Hadoop Apache web site. Could you let me know how I can use the source code directory in the downloaded Hadoop Apache package, to re-compile the libhadoop.so and to make sure that the fadvise call is able to get referenced? Regards, Jun On Fri, Jun 21, 2013 at 9:19 AM, Leo Leung wrote: > This looks like a compilation problem on the native hadoop libraries. > > Please locate the libhadoop.so library on your system and run > [shell] objdump -Tt libhadoop.so | grep -I fadvise > > If you don't see something like the following *the GLIBC* part (that > means the system where the share lib was compiled did not have it) > > 00000000000056a0 g F .text 00000000000000a3 > Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise > 0000000000000000 F *UND* 0000000000000000 > posix_fadvise@@GLIBC_2.2.5 > 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.2.5 posix_fadvise > 00000000000056a0 g DF .text 00000000000000a3 Base > Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise > > Note: objdump is from binutils- rpm (you can use yum install to install > it if you don't have it) > > > -----Original Message----- > From: Jun Li [mailto:jltz922181@gmail.com] > Sent: Friday, June 21, 2013 1:35 AM > To: user@hadoop.apache.org > Subject: how to turn on NativeIO.posixFadviseIfPossible > > Hi, > > I downloaded the current stable version from the Apache Hadoop web site, > hadoop-1.1.2. My machine is an AMD-based machine and Redhat Enterprise 6.1. > The detailed Linux kernel version is: > 2.6.32-131.0.15.el6.x86_64 > > I ran the TestNativeIO.java under the distribution directory of > "test/org/apache/hadoop/io/nativeio/TestNativeIO.java" and tried to > understand how NativeIO.posixFadviseIfPossible behaves, in particular, to > check whether "posix_fadvise" is turned on or not. I am interested in this > call as it is used in Read-Ahead-Pool to cache data to the OS's buffer > cache. The following is the test case that I ran: > > @Test > public void testPosixFadvise() throws Exception { > FileInputStream fis = new FileInputStream("/dev/zero"); > try { > NativeIO.posixFadviseIfPossible(fis.getFD(), 0, 0, > NativeIO.POSIX_FADV_SEQUENTIAL); > } catch (NativeIOException noe) { > // we should just skip the unit test on machines where we don't > // have fadvise support > assumeTrue(false); > } finally { > fis.close(); > } > > However, when I stepped into the code and reached "NativeIO.java" > under the package of "org.apache.hadoop.io.nativeio", in the particular > call below: > > public static void posixFadviseIfPossible( > FileDescriptor fd, long offset, long len, int flags) > throws NativeIOException { > > if (nativeLoaded && fadvisePossible) { > try { > posix_fadvise(fd, offset, len, flags); > } catch (UnsupportedOperationException uoe) { > fadvisePossible = false; > } catch (UnsatisfiedLinkError ule) { > fadvisePossible = false; > } > } > } > > The call to "posix_fadvise" threw the "UnsupportedOperationException" > exception. > > I further traced to the native library, and in the code "NativeIO.c", I > found > > JNIEXPORT void JNICALL > Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise( > JNIEnv *env, jclass clazz, > jobject fd_object, jlong offset, jlong len, jint flags) { #ifndef > HAVE_POSIX_FADVISE > THROW(env, "java/lang/UnsupportedOperationException", > "fadvise support not available"); #else > > ... > } > > I believe that the problem of throwing the exception is because > "HAVE_POSIX_FADVISE" is not defined. I made sure that the native IO > library is loaded properly in the Java code, as I can successfully run the > other test cases in "TestNativeIO.java". > > So my question is: should I re-compile the "libhadoop" in order to get the > version of the shared library that can have "HAVE_POSIX_FADVISE" > turned on? Or by default, FADVISE is turned on already? > > Thank you! > --001a11c3e880f348c104dfacc336 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Leo,

F= ollowing your instruction,=A0 the following is what I got:

[junli@me= rcoop-26 Linux-amd64-64]$ objdump -Tt libhadoop.so | grep -I fadvise
000= 0000000004d70 g=A0=A0=A0=A0 F .text=A0=A0=A0 000000000000006f=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 Java_org_apache_hadoop_io_nativeio_NativeIO_pos= ix_1fadvise
0000000000004d70 g=A0=A0=A0 DF .text=A0=A0=A0 000000000000006f=A0 Base=A0= =A0=A0=A0=A0=A0=A0 Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvi= se

Apparently the part of "the GLIBC" is not there <= br>
The libhadoop.so is the one that I downloaded as part of the= =A0 tar.gz of hadoop.1.1.2 from the Hadoop Apache web site.

Could you let me know how I can use the source code directory in = the downloaded Hadoop Apache package, to re-compile the libhadoop.so and to= make sure that the fadvise call is able to get referenced?

Regards,

Jun



On Fri, Jun 21, 2013 at 9:19 AM, Leo Leung <lleung@ddn.co= m> wrote:
This looks like a compilation problem on the= native hadoop libraries.

Please locate the libhadoop.so library on your system and run
[shell] =A0objdump -Tt libhadoop.so | grep -I fadvise

If you don't see something like the following *the GLIBC* part =A0(that= means the system where the share lib was compiled did not have it)

00000000000056a0 g =A0 =A0 F .text =A000000000000000a3 =A0 =A0 =A0 =A0 =A0 = =A0 =A0Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise
0000000000000000 =A0 =A0 =A0 F *UND* =A00000000000000000 =A0 =A0 =A0 =A0 = =A0 =A0 =A0posix_fadvise@@GLIBC_2.2.5
0000000000000000 =A0 =A0 =A0DF *UND* =A00000000000000000 =A0GLIBC_2.2.5 pos= ix_fadvise
00000000000056a0 g =A0 =A0DF .text =A000000000000000a3 =A0Base =A0 =A0 =A0 = =A0Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise

Note: objdump is from binutils- rpm =A0(you can use yum install to install = it if you don't have it)


-----Original Message-----
From: Jun Li [mailto:jltz922181@gma= il.com]
Sent: Friday, June 21, 2013 1:35 AM
To: user@hadoop.apache.org Subject: how to turn on NativeIO.posixFadviseIfPossible

Hi,

I downloaded the current stable version from the Apache Hadoop web site, ha= doop-1.1.2. My machine is an AMD-based machine and Redhat Enterprise 6.1. T= he detailed Linux kernel version is:
2.6.32-131.0.15.el6.x86_64

=A0I ran the TestNativeIO.java under the distribution directory of "te= st/org/apache/hadoop/io/nativeio/TestNativeIO.java" and tried to under= stand how NativeIO.posixFadviseIfPossible behaves, in particular, to check = whether "posix_fadvise" is turned on or not. I am interested in t= his call as it is used in Read-Ahead-Pool to cache data to the OS's buf= fer cache. =A0The following is the test case that I ran:

@Test
=A0 public void testPosixFadvise() throws Exception {
=A0 =A0 FileInputStream fis =3D new FileInputStream("/dev/zero");=
=A0 =A0 try {
=A0 =A0 =A0 NativeIO.posixFadviseIfPossible(fis.getFD(), 0, 0,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0NativeIO.POSIX_F= ADV_SEQUENTIAL);
=A0 =A0 } catch (NativeIOException noe) {
=A0 =A0 =A0 // we should just skip the unit test on machines where we don&#= 39;t
=A0 =A0 =A0 // have fadvise support
=A0 =A0 =A0 assumeTrue(false);
=A0 =A0 } finally {
=A0 =A0 =A0 fis.close();
=A0 =A0 }

However, when I stepped into the code and reached "NativeIO.java"=
under the package of "org.apache.hadoop.io.nativeio", =A0in the p= articular call below:

public static void posixFadviseIfPossible(
=A0 =A0 =A0 FileDescriptor fd, long offset, long len, int flags)
=A0 =A0 =A0 throws NativeIOException {

=A0 =A0 if (nativeLoaded && fadvisePossible) {
=A0 =A0 =A0 try {
=A0 =A0 =A0 =A0 posix_fadvise(fd, offset, len, flags);
=A0 =A0 =A0 } catch (UnsupportedOperationException uoe) {
=A0 =A0 =A0 =A0 fadvisePossible =3D false;
=A0 =A0 =A0 } catch (UnsatisfiedLinkError ule) {
=A0 =A0 =A0 =A0 fadvisePossible =3D false;
=A0 =A0 =A0 }
=A0 =A0 }
=A0 }

The call to "posix_fadvise" =A0threw the "UnsupportedOperati= onException"
exception.

I further traced to the native library, and in the code "NativeIO.c&qu= ot;, I found

JNIEXPORT void JNICALL
Java_org_apache_hadoop_io_nativeio_NativeIO_posix_1fadvise(
=A0 JNIEnv *env, jclass clazz,
=A0 jobject fd_object, jlong offset, jlong len, jint flags) { #ifndef HAVE_= POSIX_FADVISE
=A0 THROW(env, "java/lang/UnsupportedOperationException",
=A0 =A0 =A0 =A0 "fadvise support not available"); #else

...
}

I believe that the problem of throwing the exception is because "HAVE_= POSIX_FADVISE" is not defined. =A0I made sure that the native IO libra= ry is loaded properly in the Java code, as I can successfully run the other= test cases in "TestNativeIO.java".

So my question is: should I re-compile the "libhadoop" in order t= o get the version of the shared library that can have "HAVE_POSIX_FADV= ISE"
turned on? Or by default, FADVISE is turned on already?

Thank you!

--001a11c3e880f348c104dfacc336--