Author: dhruba
Date: Wed Oct 27 05:22:46 2010
New Revision: 1027816
URL: http://svn.apache.org/viewvc?rev=1027816&view=rev
Log:
MAPREDUCE-2146. Raid does not affect access time of a source file.
(Ramkumar Vadali via dhruba)
Modified:
hadoop/mapreduce/trunk/CHANGES.txt
hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidNode.java
hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=1027816&r1=1027815&r2=1027816&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Wed Oct 27 05:22:46 2010
@@ -350,6 +350,9 @@ Trunk (unreleased changes)
MAPREDUCE-1867. Remove unused methods in
org.apache.hadoop.streaming.StreamUtil. (amareshwari via tomwhite)
+ MAPREDUCE-2146. Raid does not affect access time of a source file.
+ (Ramkumar Vadali via dhruba)
+
Release 0.21.1 - Unreleased
NEW FEATURES
Modified:
hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidNode.java
URL:
http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidNode.java?rev=1027816&r1=1027815&r2=1027816&view=diff
==============================================================================
---
hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidNode.java
(original)
+++
hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidNode.java
Wed Oct 27 05:22:46 2010
@@ -748,6 +748,7 @@ public class RaidNode implements RaidPro
// on the destination namenode may not be synchronised with the timestamp
of the
// source namenode.
outFs.setTimes(outpath, stat.getModificationTime(), -1);
+ inFs.setTimes(inpath, stat.getModificationTime(), stat.getAccessTime());
FileStatus outstat = outFs.getFileStatus(outpath);
FileStatus inStat = inFs.getFileStatus(inpath);
Modified:
hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
URL:
http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java?rev=1027816&r1=1027815&r2=1027816&view=diff
==============================================================================
---
hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
(original)
+++
hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
Wed Oct 27 05:22:46 2010
@@ -317,6 +317,40 @@ public class TestRaidDfs extends TestCas
}
}
+ /**
+ * Test that access time and mtime of a source file do not change after
+ * raiding.
+ */
+ public void testAccessTime() throws Exception {
+ LOG.info("Test testAccessTime started.");
+
+ long blockSize = 8192L;
+ int numBlocks = 8;
+ int repl = 1;
+ mySetup();
+
+ Path file = new Path("/user/dhruba/raidtest/file");
+ Path destPath = new Path("/destraid/user/dhruba/raidtest");
+ createTestFilePartialLastBlock(fileSys, file, repl, numBlocks, blockSize);
+ FileStatus stat = fileSys.getFileStatus(file);
+
+ int[][] corrupt = {{0}, {4}, {7}}; // first, last and middle block
+ try {
+ // Create an instance of the RaidNode
+ Configuration localConf = new Configuration(conf);
+ localConf.set(RaidNode.RAID_LOCATION_KEY, "/destraid");
+ cnode = RaidNode.createRaidNode(null, localConf);
+
+ waitForFileRaided(LOG, fileSys, file, destPath);
+ FileStatus newStat = fileSys.getFileStatus(file);
+
+ assertEquals(stat.getModificationTime(), newStat.getModificationTime());
+ assertEquals(stat.getAccessTime(), newStat.getAccessTime());
+ } finally {
+ myTearDown();
+ }
+ }
+
//
// creates a file and populate it with random data. Returns its crc.
//