hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1150241 - in /hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode: Checkpointer.java EditLogBackupInputStream.java SecondaryNameNode.java
Date Sun, 24 Jul 2011 00:07:13 GMT
Author: todd
Date: Sun Jul 24 00:07:12 2011
New Revision: 1150241

URL: http://svn.apache.org/viewvc?rev=1150241&view=rev
Log:
Move SecondaryNameNode.rollForwardByApplyingEdits to Checkpointer. Remove unused code in EditLogBackupInputStream

In response to Konstantin's review at:
https://issues.apache.org/jira/browse/HDFS-1073?focusedCommentId=13070021&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13070021

Modified:
    hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java
    hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/EditLogBackupInputStream.java
    hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java

Modified: hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java?rev=1150241&r1=1150240&r2=1150241&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java
(original)
+++ hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/Checkpointer.java
Sun Jul 24 00:07:12 2011
@@ -24,6 +24,7 @@ import static org.apache.hadoop.hdfs.ser
 import java.io.File;
 import java.io.IOException;
 import java.net.InetSocketAddress;
+import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -39,6 +40,8 @@ import org.apache.hadoop.http.HttpServer
 import org.apache.hadoop.io.MD5Hash;
 import org.apache.hadoop.util.Daemon;
 
+import com.google.common.collect.Lists;
+
 /**
  * The Checkpointer is responsible for supporting periodic checkpoints 
  * of the HDFS metadata.
@@ -240,7 +243,7 @@ class Checkpointer extends Daemon {
             backupNode.nnHttpAddress, log, bnStorage);
       }
   
-      SecondaryNameNode.rollForwardByApplyingLogs(manifest, bnImage);
+      rollForwardByApplyingLogs(manifest, bnImage);
     }
 
     long txid = bnImage.getLastAppliedTxId();
@@ -271,4 +274,22 @@ class Checkpointer extends Daemon {
     int httpPort = httpSocAddr.getPort();
     return new InetSocketAddress(infoBindAddress, httpPort);
   }
+
+  static void rollForwardByApplyingLogs(
+      RemoteEditLogManifest manifest,
+      FSImage dstImage) throws IOException {
+    NNStorage dstStorage = dstImage.getStorage();
+  
+    List<File> editsFiles = Lists.newArrayList();
+    for (RemoteEditLog log : manifest.getLogs()) {
+      File f = dstStorage.findFinalizedEditsFile(
+          log.getStartTxId(), log.getEndTxId());
+      if (log.getStartTxId() > dstImage.getLastAppliedTxId()) {
+        editsFiles.add(f);
+      }
+    }
+    LOG.info("Checkpointer about to load edits from " +
+        editsFiles.size() + " file(s).");
+    dstImage.loadEdits(editsFiles);
+  }
 }

Modified: hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/EditLogBackupInputStream.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/EditLogBackupInputStream.java?rev=1150241&r1=1150240&r2=1150241&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/EditLogBackupInputStream.java
(original)
+++ hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/EditLogBackupInputStream.java
Sun Jul 24 00:07:12 2011
@@ -42,10 +42,6 @@ class EditLogBackupInputStream extends E
       super(new byte[0]);
     }
 
-    byte[] getData() {
-      return super.buf;
-    }
-
     void setData(byte[] newBytes) {
       super.buf = newBytes;
       super.count = newBytes == null ? 0 : newBytes.length;

Modified: hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java?rev=1150241&r1=1150240&r2=1150241&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
(original)
+++ hadoop/common/branches/HDFS-1073/hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
Sun Jul 24 00:07:12 2011
@@ -71,7 +71,6 @@ import org.apache.hadoop.util.StringUtil
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
 
 /**********************************************************
  * The Secondary NameNode is a helper to the primary NameNode.
@@ -854,26 +853,8 @@ public class SecondaryNameNode implement
       dstImage.reloadFromImageFile(file);
     }
     
-    rollForwardByApplyingLogs(manifest, dstImage);
+    Checkpointer.rollForwardByApplyingLogs(manifest, dstImage);
     dstImage.saveFSImageInAllDirs(dstImage.getLastAppliedTxId());
     dstStorage.writeAll();
   }
-  
-  static void rollForwardByApplyingLogs(
-      RemoteEditLogManifest manifest,
-      FSImage dstImage) throws IOException {
-    NNStorage dstStorage = dstImage.getStorage();
-
-    List<File> editsFiles = Lists.newArrayList();
-    for (RemoteEditLog log : manifest.getLogs()) {
-      File f = dstStorage.findFinalizedEditsFile(
-          log.getStartTxId(), log.getEndTxId());
-      if (log.getStartTxId() > dstImage.getLastAppliedTxId()) {
-        editsFiles.add(f);
-      }
-    }
-    LOG.info("SecondaryNameNode about to load edits from " +
-        editsFiles.size() + " file(s).");
-    dstImage.loadEdits(editsFiles);
-  }
 }



Mime
View raw message