Pārlūkot izejas kodu

HADOOP-3083. The fsimage does not store leases. This would have to be
reworked in the next release to support appends. (dhruba)



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@644898 13f79535-47bb-0310-9956-ffa450edef68

Dhruba Borthakur 17 gadi atpakaļ
vecāks
revīzija
bd0645d716

+ 3 - 0
CHANGES.txt

@@ -491,6 +491,9 @@ Trunk (unreleased changes)
     APIs in FileOutputFormat: setOutputPath, getOutputPath, getWorkOutputPath.
     (Amareshwari Sriramadasu via nigel)
 
+    HADOOP-3083. The fsimage does not store leases. This would have to be
+    reworked in the next release to support appends. (dhruba)
+
 Release 0.16.3 - Unreleased
 
   BUG FIXES

+ 4 - 28
src/java/org/apache/hadoop/dfs/FSNamesystem.java

@@ -4365,35 +4365,11 @@ class FSNamesystem implements FSConstants, FSNamesystemMBean {
     }
   }
 
-  /** 
-   * Serializes leases
+  /**
+   * Serializes leases. This current code does not save leases but will do
+   * so in the future.
    */
   void saveFilesUnderConstruction(DataOutputStream out) throws IOException {
-    synchronized (sortedLeases) {
-      int count = 0;
-      for (Lease lease : sortedLeases) {
-        count += lease.getPaths().size();
-      }
-      out.writeInt(count); // write the size
-      for (Lease lease : sortedLeases) {
-        Collection<StringBytesWritable> files = lease.getPaths();
-        for (Iterator<StringBytesWritable> i = files.iterator(); i.hasNext();){
-          String path = i.next().getString();
-          
-          // verify that path exists in namespace
-          INode node = dir.getFileINode(path);
-          if (node == null) {
-            throw new IOException("saveLeases found path " + path +
-                                  " but no matching entry in namespace.");
-          }
-          if (!node.isUnderConstruction()) {
-            throw new IOException("saveLeases found path " + path +
-                                  " but is not under construction.");
-          }
-          INodeFileUnderConstruction cons = (INodeFileUnderConstruction) node;
-          FSImage.writeINodeUnderConstruction(out, cons, path);
-        }
-      }
-    }
+    out.writeInt(0);      // the number of leases
   }
 }

+ 3 - 1
src/test/org/apache/hadoop/dfs/TestFileCreation.java

@@ -353,8 +353,10 @@ public class TestFileCreation extends TestCase {
 
   /**
    * Test that file leases are persisted across namenode restarts.
+   * This test is currently not triggered because more HDFS work is 
+   * is needed to handle persistent leases.
    */
-  public void testFileCreationNamenodeRestart() throws IOException {
+  public void XXXtestFileCreationNamenodeRestart() throws IOException {
     Configuration conf = new Configuration();
     final int MAX_IDLE_TIME = 2000; // 2s
     conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);