hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r563582 - in /lucene/hadoop/branches/branch-0.14: CHANGES.txt src/java/org/apache/hadoop/fs/FsShell.java src/java/org/apache/hadoop/fs/Trash.java src/test/org/apache/hadoop/dfs/TestTrash.java
Date Tue, 07 Aug 2007 17:36:17 GMT
Author: dhruba
Date: Tue Aug  7 10:36:16 2007
New Revision: 563582

URL: http://svn.apache.org/viewvc?view=rev&rev=563582
Log:
HADOOP-1665.  With HDFS Trash enabled and the same file was created
and deleted more than once, the suceeding deletions creates Trash item
names suffixed with a integer.  (Dhruba Borthakur via dhruba)
Merge -c 563565 from trunk to 0.14 branch.


Added:
    lucene/hadoop/branches/branch-0.14/src/test/org/apache/hadoop/dfs/TestTrash.java
      - copied unchanged from r563565, lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestTrash.java
Modified:
    lucene/hadoop/branches/branch-0.14/CHANGES.txt
    lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java
    lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/Trash.java

Modified: lucene/hadoop/branches/branch-0.14/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/CHANGES.txt?view=diff&rev=563582&r1=563581&r2=563582
==============================================================================
--- lucene/hadoop/branches/branch-0.14/CHANGES.txt (original)
+++ lucene/hadoop/branches/branch-0.14/CHANGES.txt Tue Aug  7 10:36:16 2007
@@ -450,7 +450,11 @@
 
 144. HADOOP-1659.  Fix a job id/job name mixup. (Arun C. Murthy via omalley)
 
-145. HADOOP-1666.  FsShell object can be used for multiple fs commands.
+145. HADOOP-1665.  With HDFS Trash enabled and the same file was created
+     and deleted more than once, the suceeding deletions creates Trash item
+     names suffixed with a integer.  (Dhruba Borthakur via dhruba)
+
+146. HADOOP-1666.  FsShell object can be used for multiple fs commands.
      Contributed by Dhruba Borthakur.
 
 Release 0.13.0 - 2007-06-08

Modified: lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java?view=diff&rev=563582&r1=563581&r2=563582
==============================================================================
--- lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/FsShell.java Tue Aug
 7 10:36:16 2007
@@ -54,7 +54,6 @@
     if (this.trash == null) {
       this.trash = new Trash(conf);
     }
-    System.out.println("XXX FsShell init done");
   }
 
   /**
@@ -795,6 +794,13 @@
   private void expunge() throws IOException {
     trash.expunge();
     trash.checkpoint();
+  }
+
+  /**
+   * Returns the Trash object associated with this shell.
+   */
+  public Path getCurrentTrashDir() {
+    return trash.getCurrentTrashDir();
   }
 
   /**

Modified: lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/Trash.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/Trash.java?view=diff&rev=563582&r1=563581&r2=563582
==============================================================================
--- lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/Trash.java (original)
+++ lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/fs/Trash.java Tue Aug  7
10:36:16 2007
@@ -98,6 +98,14 @@
         throw new IOException("Failed to create trash directory: "+trashDir);
       }
       try {
+        //
+        // if the target path in Trash already exists, then append with 
+        // a number. Start from 1.
+        //
+        String orig = trashPath.toString();
+        for (int j = 1; fs.exists(trashPath); j++) {
+          trashPath = new Path(orig + "." + j);
+        }
         if (fs.rename(path, trashPath))           // move to current trash
           return true;
       } catch (IOException e) {
@@ -153,6 +161,13 @@
         }
       }
     }
+  }
+
+  //
+  // get the current working directory
+  //
+  Path getCurrentTrashDir() {
+    return current;
   }
 
   /** Return a {@link Runnable} that periodically empties the trash.



Mime
View raw message