|
|
Vivekanand Vellanki 2010-11-11, 08:44
Hi,
I was looking at the test cases for HDFS and found the following test - org.apache.hadoop.hdfs.TestSetTimes.testTimes
>From the below, it appears that getAccessTime() for a directory should return 0. Is this true?
System.out.println("Creating testdir1 and testdir1/test1.dat."); Path dir1 = new Path("testdir1"); Path file1 = new Path(dir1, "test1.dat"); FSDataOutputStream stm = writeFile(fileSys, file1, replicas); FileStatus stat = fileSys.getFileStatus(file1); long atimeBeforeClose = stat.getAccessTime(); String adate = dateForm.format(new Date(atimeBeforeClose)); System.out.println("atime on " + file1 + " before close is " + adate + " (" + atimeBeforeClose + ")"); assertTrue(atimeBeforeClose != 0); stm.close();
<snip>
// // record dir times // stat = fileSys.getFileStatus(dir1); long mdir1 = stat.getAccessTime(); assertTrue(mdir1 == 0);
thanks Vivek
-
Re: atime for a directory
Konstantin Shvachko 2010-11-11, 08:48
Yes HDFS supports aTime only for files. Support for directories would be too expensive. Thanks, --Konstantin
On Thu, Nov 11, 2010 at 12:44 AM, Vivekanand Vellanki <[EMAIL PROTECTED]>wrote:
> Hi, > > I was looking at the test cases for HDFS and found the following test > - org.apache.hadoop.hdfs.TestSetTimes.testTimes > > From the below, it appears that getAccessTime() for a directory should > return 0. Is this true? > > System.out.println("Creating testdir1 and testdir1/test1.dat."); > Path dir1 = new Path("testdir1"); > Path file1 = new Path(dir1, "test1.dat"); > FSDataOutputStream stm = writeFile(fileSys, file1, replicas); > FileStatus stat = fileSys.getFileStatus(file1); > long atimeBeforeClose = stat.getAccessTime(); > String adate = dateForm.format(new Date(atimeBeforeClose)); > System.out.println("atime on " + file1 + " before close is " + > adate + " (" + atimeBeforeClose + ")"); > assertTrue(atimeBeforeClose != 0); > stm.close(); > > <snip> > > // > // record dir times > // > stat = fileSys.getFileStatus(dir1); > long mdir1 = stat.getAccessTime(); > assertTrue(mdir1 == 0); > > thanks > Vivek > > >
-
Re: atime for a directory
Vivekanand Vellanki 2010-11-11, 12:55
Thanks for the prompt response.
________________________________ From: Konstantin Shvachko <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Thu, November 11, 2010 2:18:07 PM Subject: Re: atime for a directory
Yes HDFS supports aTime only for files. Support for directories would be too expensive. Thanks, --Konstantin On Thu, Nov 11, 2010 at 12:44 AM, Vivekanand Vellanki <[EMAIL PROTECTED]> wrote:
Hi, > > >I was looking at the test cases for HDFS and found the following test >- org.apache.hadoop.hdfs.TestSetTimes.testTimes > > >>From the below, it appears that getAccessTime() for a directory should return 0. >Is this true? > > > System.out.println("Creating testdir1 and testdir1/test1.dat."); > Path dir1 = new Path("testdir1"); > Path file1 = new Path(dir1, "test1.dat"); > FSDataOutputStream stm = writeFile(fileSys, file1, replicas); > FileStatus stat = fileSys.getFileStatus(file1); > long atimeBeforeClose = stat.getAccessTime(); > String adate = dateForm.format(new Date(atimeBeforeClose)); > System.out.println("atime on " + file1 + " before close is " + > adate + " (" + atimeBeforeClose + ")"); > assertTrue(atimeBeforeClose != 0); > stm.close(); > > ><snip> > > > // > // record dir times > // > stat = fileSys.getFileStatus(dir1); > long mdir1 = stat.getAccessTime(); > assertTrue(mdir1 == 0); > > >thanks >Vivek > > >
|
|