HDFS-4138. BackupNode startup fails due to uninitialized edit log. Contributed by Kihwal Lee.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1406734 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Konstantin Shvachko 2012-11-07 17:45:01 +00:00
parent 3c02237459
commit 1ab97373de
3 changed files with 6 additions and 17 deletions

View File

@ -1966,6 +1966,9 @@ Release 0.23.5 - UNRELEASED
HDFS-4090. getFileChecksum() result incompatible when called against HDFS-4090. getFileChecksum() result incompatible when called against
zero-byte files. (Kihwal Lee via daryn) zero-byte files. (Kihwal Lee via daryn)
HDFS-4138. BackupNode startup fails due to uninitialized edit log.
(Kihwal Lee via shv)
Release 0.23.4 - UNRELEASED Release 0.23.4 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -78,10 +78,6 @@ public class BackupNode extends NameNode {
String nnHttpAddress; String nnHttpAddress;
/** Checkpoint manager */ /** Checkpoint manager */
Checkpointer checkpointManager; Checkpointer checkpointManager;
/** ClusterID to which BackupNode belongs to */
String clusterId;
/** Block pool Id of the peer namenode of this BackupNode */
String blockPoolId;
BackupNode(Configuration conf, NamenodeRole role) throws IOException { BackupNode(Configuration conf, NamenodeRole role) throws IOException {
super(conf, role); super(conf, role);
@ -145,6 +141,7 @@ public class BackupNode extends NameNode {
CommonConfigurationKeys.FS_TRASH_INTERVAL_DEFAULT); CommonConfigurationKeys.FS_TRASH_INTERVAL_DEFAULT);
NamespaceInfo nsInfo = handshake(conf); NamespaceInfo nsInfo = handshake(conf);
super.initialize(conf); super.initialize(conf);
namesystem.setBlockPoolId(nsInfo.getBlockPoolID());
if (false == namesystem.isInSafeMode()) { if (false == namesystem.isInSafeMode()) {
namesystem.setSafeMode(SafeModeAction.SAFEMODE_ENTER); namesystem.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
@ -155,9 +152,6 @@ public class BackupNode extends NameNode {
namesystem.leaseManager.setLeasePeriod( namesystem.leaseManager.setLeasePeriod(
HdfsConstants.LEASE_SOFTLIMIT_PERIOD, Long.MAX_VALUE); HdfsConstants.LEASE_SOFTLIMIT_PERIOD, Long.MAX_VALUE);
clusterId = nsInfo.getClusterID();
blockPoolId = nsInfo.getBlockPoolID();
// register with the active name-node // register with the active name-node
registerWith(nsInfo); registerWith(nsInfo);
// Checkpoint daemon should start after the rpc server started // Checkpoint daemon should start after the rpc server started
@ -219,7 +213,7 @@ public class BackupNode extends NameNode {
} }
/* @Override */// NameNode /* @Override */// NameNode
public boolean setSafeMode(@SuppressWarnings("unused") SafeModeAction action) public boolean setSafeMode(SafeModeAction action)
throws IOException { throws IOException {
throw new UnsupportedActionException("setSafeMode"); throw new UnsupportedActionException("setSafeMode");
} }
@ -415,14 +409,6 @@ public class BackupNode extends NameNode {
return nsInfo; return nsInfo;
} }
String getBlockPoolId() {
return blockPoolId;
}
String getClusterId() {
return clusterId;
}
@Override @Override
protected NameNodeHAContext createHAContext() { protected NameNodeHAContext createHAContext() {
return new BNHAContext(); return new BNHAContext();

View File

@ -3507,7 +3507,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
@Metric({"TransactionsSinceLastLogRoll", @Metric({"TransactionsSinceLastLogRoll",
"Number of transactions since last edit log roll"}) "Number of transactions since last edit log roll"})
public long getTransactionsSinceLastLogRoll() { public long getTransactionsSinceLastLogRoll() {
if (isInStandbyState()) { if (isInStandbyState() || !getEditLog().isSegmentOpen()) {
return 0; return 0;
} else { } else {
return getEditLog().getLastWrittenTxId() - return getEditLog().getLastWrittenTxId() -