Browse Source

HADOOP-5225. Workaround for tmp file handling in HDFS. sync() is
incomplete as a result. committed only to 0.19.x. (Raghu Angadi)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@744266 13f79535-47bb-0310-9956-ffa450edef68

Raghu Angadi 16 years ago
parent
commit
71b8e06f16

+ 5 - 0
CHANGES.txt

@@ -4,6 +4,11 @@ Hadoop Change Log
 
 
 Release 0.19.1 - Unreleased
 Release 0.19.1 - Unreleased
 
 
+  INCOMPATIBLE CHANGES
+
+    HADOOP-5225. Workaround for tmp file handling in HDFS. sync() is 
+    incomplete as a result. committed only to 0.19.x. (Raghu Angadi)
+
   IMPROVEMENTS
   IMPROVEMENTS
 
 
     HADOOP-4739. Fix spelling and grammar, improve phrasing of some sections in
     HADOOP-4739. Fix spelling and grammar, improve phrasing of some sections in

+ 2 - 5
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java

@@ -304,14 +304,11 @@ public class FSDataset implements FSConstants, FSDatasetInterface {
         recoverDetachedBlocks(currentDir, detachDir);
         recoverDetachedBlocks(currentDir, detachDir);
       }
       }
 
 
-      // Files that were being written when the datanode was last shutdown
-      // are now moved back to the data directory. It is possible that
-      // in the future, we might want to do some sort of datanode-local
-      // recovery for these blocks. For example, crc validation.
+      // Delete all temporary blocks in the tmp diectory
       //
       //
       this.tmpDir = new File(parent, "tmp");
       this.tmpDir = new File(parent, "tmp");
       if (tmpDir.exists()) {
       if (tmpDir.exists()) {
-        recoverDetachedBlocks(currentDir, tmpDir);
+        FileUtil.fullyDelete(tmpDir);
       }
       }
       this.dataDir = new FSDir(currentDir);
       this.dataDir = new FSDir(currentDir);
       if (!tmpDir.mkdirs()) {
       if (!tmpDir.mkdirs()) {

+ 3 - 0
src/test/org/apache/hadoop/hdfs/TestFileCreationDelete.java

@@ -37,6 +37,9 @@ public class TestFileCreationDelete extends junit.framework.TestCase {
   }
   }
 
 
   public void testFileCreationDeleteParent() throws IOException {
   public void testFileCreationDeleteParent() throws IOException {
+    /* XXX This test is temporarily disabled since sync() is not supported in
+     * 0.19.1.*/
+    if (true) return;
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     final int MAX_IDLE_TIME = 2000; // 2s
     final int MAX_IDLE_TIME = 2000; // 2s
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);

+ 12 - 0
src/test/org/apache/hadoop/hdfs/TestRenameWhileOpen.java

@@ -42,6 +42,9 @@ public class TestRenameWhileOpen extends junit.framework.TestCase {
    * move /user/dir1 /user/dir3
    * move /user/dir1 /user/dir3
    */
    */
   public void testWhileOpenRenameParent() throws IOException {
   public void testWhileOpenRenameParent() throws IOException {
+    /* XXX This test is temporarily disabled since sync() is not supported in
+     * 0.18.3. This is a 0.18.3 only change. */
+    if (true) return;
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     final int MAX_IDLE_TIME = 2000; // 2s
     final int MAX_IDLE_TIME = 2000; // 2s
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
@@ -114,6 +117,9 @@ public class TestRenameWhileOpen extends junit.framework.TestCase {
    * move /user/dir1 /user/dir3
    * move /user/dir1 /user/dir3
    */
    */
   public void testWhileOpenRenameParentToNonexistentDir() throws IOException {
   public void testWhileOpenRenameParentToNonexistentDir() throws IOException {
+    /* XXX This test is temporarily disabled since sync() is not supported in
+     * 0.19.1. */
+    if (true) return;
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     final int MAX_IDLE_TIME = 2000; // 2s
     final int MAX_IDLE_TIME = 2000; // 2s
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
@@ -186,6 +192,9 @@ public class TestRenameWhileOpen extends junit.framework.TestCase {
    * move /user/dir1/file1 /user/dir2/
    * move /user/dir1/file1 /user/dir2/
    */
    */
   public void testWhileOpenRenameToExistentDirectory() throws IOException {
   public void testWhileOpenRenameToExistentDirectory() throws IOException {
+    /* XXX This test is temporarily disabled since sync() is not supported in
+     * 0.19.1 */
+    if (true) return;
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     final int MAX_IDLE_TIME = 2000; // 2s
     final int MAX_IDLE_TIME = 2000; // 2s
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
@@ -248,6 +257,9 @@ public class TestRenameWhileOpen extends junit.framework.TestCase {
    * move /user/dir1/file1 /user/dir2/
    * move /user/dir1/file1 /user/dir2/
    */
    */
   public void testWhileOpenRenameToNonExistentDirectory() throws IOException {
   public void testWhileOpenRenameToNonExistentDirectory() throws IOException {
+    /* XXX This test is temporarily disabled since sync() is not supported in
+     * 0.19.1 */
+    if (true) return;
     Configuration conf = new Configuration();
     Configuration conf = new Configuration();
     final int MAX_IDLE_TIME = 2000; // 2s
     final int MAX_IDLE_TIME = 2000; // 2s
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);