|
@@ -17,17 +17,19 @@
|
|
|
*/
|
|
|
package org.apache.hadoop.hdfs.server.namenode;
|
|
|
|
|
|
+import static org.apache.hadoop.hdfs.protocol.FSConstants.BUFFER_SIZE;
|
|
|
+
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.net.InetSocketAddress;
|
|
|
-import java.net.URI;
|
|
|
import java.security.DigestInputStream;
|
|
|
import java.security.MessageDigest;
|
|
|
import java.security.PrivilegedAction;
|
|
|
import java.security.PrivilegedExceptionAction;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.Map;
|
|
@@ -35,11 +37,9 @@ import java.util.Map;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
-import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
|
|
import org.apache.hadoop.hdfs.server.common.HdfsConstants;
|
|
|
import org.apache.hadoop.hdfs.server.common.InconsistentFSStateException;
|
|
|
-import static org.apache.hadoop.hdfs.protocol.FSConstants.BUFFER_SIZE;
|
|
|
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
|
|
|
import org.apache.hadoop.http.HttpServer;
|
|
|
import org.apache.hadoop.io.MD5Hash;
|
|
@@ -76,6 +76,9 @@ public class SecondaryNameNode implements Runnable {
|
|
|
public static final Log LOG =
|
|
|
LogFactory.getLog(SecondaryNameNode.class.getName());
|
|
|
|
|
|
+ private final long starttime = System.currentTimeMillis();
|
|
|
+ private volatile long lastCheckpointTime = 0;
|
|
|
+
|
|
|
private String fsName;
|
|
|
private CheckpointStorage checkpointImage;
|
|
|
|
|
@@ -91,8 +94,20 @@ public class SecondaryNameNode implements Runnable {
|
|
|
private Collection<File> checkpointDirs;
|
|
|
private Collection<File> checkpointEditsDirs;
|
|
|
private long checkpointPeriod; // in seconds
|
|
|
- private long checkpointSize; // size (in MB) of current Edit Log
|
|
|
-
|
|
|
+ private long checkpointSize; // size (in bytes) of current Edit Log
|
|
|
+
|
|
|
+ /** {@inheritDoc} */
|
|
|
+ public String toString() {
|
|
|
+ return getClass().getSimpleName() + " Status"
|
|
|
+ + "\nName Node Address : " + nameNodeAddr
|
|
|
+ + "\nStart Time : " + new Date(starttime)
|
|
|
+ + "\nLast Checkpoint Time : " + (lastCheckpointTime == 0? "--": new Date(lastCheckpointTime))
|
|
|
+ + "\nCheckpoint Period : " + checkpointPeriod + " seconds"
|
|
|
+ + "\nCheckpoint Size : " + StringUtils.byteDesc(checkpointSize)
|
|
|
+ + " (= " + checkpointSize + " bytes)"
|
|
|
+ + "\nCheckpoint Dirs : " + checkpointDirs
|
|
|
+ + "\nCheckpoint Edits Dirs: " + checkpointEditsDirs;
|
|
|
+ }
|
|
|
/**
|
|
|
* Utility class to facilitate junit test error simulation.
|
|
|
*/
|
|
@@ -255,6 +270,7 @@ public class SecondaryNameNode implements Runnable {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ infoServer.setAttribute("secondary.name.node", this);
|
|
|
infoServer.setAttribute("name.system.image", checkpointImage);
|
|
|
infoServer.setAttribute(JspHelper.CURRENT_CONF, conf);
|
|
|
infoServer.addInternalServlet("getimage", "/getimage",
|
|
@@ -354,7 +370,6 @@ public class SecondaryNameNode implements Runnable {
|
|
|
// pending edit log.
|
|
|
//
|
|
|
long period = 5 * 60; // 5 minutes
|
|
|
- long lastCheckpointTime = 0;
|
|
|
if (checkpointPeriod < period) {
|
|
|
period = checkpointPeriod;
|
|
|
}
|