hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r944566 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java src/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java
Date Sat, 15 May 2010 05:05:10 GMT
Author: dhruba
Date: Sat May 15 05:05:10 2010
New Revision: 944566

URL: http://svn.apache.org/viewvc?rev=944566&view=rev
Log:
HDFS-970. fsync fsimage to disk before closing fsimage file.
(Todd Lipcon via dhruba)


Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=944566&r1=944565&r2=944566&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Sat May 15 05:05:10 2010
@@ -18,6 +18,9 @@ Trunk (unreleased changes)
     HDFS 1021. specify correct server principal for RefreshAuthorizationPolicyProtocol 
     and RefreshUserToGroupMappingsProtocol protocols in DFSAdmin (for HADOOP-6612) (boryas)
 
+    HDFS-970. fsync fsimage to disk before closing fsimage file.
+    (Todd Lipcon via dhruba)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java?rev=944566&r1=944565&r2=944566&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java Sat May
15 05:05:10 2010
@@ -728,10 +728,12 @@ public class FSImage extends Storage {
         LOG.error("Cannot delete chekpoint time file: "
                   + timeFile.getCanonicalPath());
     }
-    DataOutputStream out = new DataOutputStream(
-                                                new FileOutputStream(timeFile));
+    FileOutputStream fos = new FileOutputStream(timeFile);
+    DataOutputStream out = new DataOutputStream(fos);
     try {
       out.writeLong(checkpointTime);
+      out.flush();
+      fos.getChannel().force(true);
     } finally {
       out.close();
     }
@@ -1229,9 +1231,9 @@ public class FSImage extends Storage {
     //
     // Write out data
     //
+    FileOutputStream fos = new FileOutputStream(newFile);
     DataOutputStream out = new DataOutputStream(
-                                                new BufferedOutputStream(
-                                                                         new FileOutputStream(newFile)));
+      new BufferedOutputStream(fos));
     try {
       out.writeInt(FSConstants.LAYOUT_VERSION);
       out.writeInt(namespaceID);
@@ -1246,6 +1248,9 @@ public class FSImage extends Storage {
       fsNamesys.saveFilesUnderConstruction(out);
       fsNamesys.saveSecretManagerState(out);
       strbuf = null;
+
+      out.flush();
+      fos.getChannel().force(true);
     } finally {
       out.close();
     }

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java?rev=944566&r1=944565&r2=944566&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java
(original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java
Sat May 15 05:05:10 2010
@@ -195,6 +195,7 @@ class TransferFsImage implements FSConst
       if (output != null) {
         for (int i = 0; i < output.length; i++) {
           if (output[i] != null) {
+            output[i].getChannel().force(true);
             output[i].close();
           }
         }



Mime
View raw message