HDFS-2955. IllegalStateException during standby startup in getCurSegmentTxId. Contributed by Hari Mankude.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1245230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-02-16 22:45:40 +00:00
parent 833e96534f
commit 153e0cc37a
3 changed files with 9 additions and 2 deletions

View File

@ -210,3 +210,5 @@ HDFS-2934. Allow configs to be scoped to all NNs in the nameservice. (todd)
HDFS-2935. Shared edits dir property should be suffixed with nameservice and namenodeID (todd) HDFS-2935. Shared edits dir property should be suffixed with nameservice and namenodeID (todd)
HDFS-2928. ConfiguredFailoverProxyProvider should not create a NameNode proxy with an underlying retry proxy. (Uma Maheswara Rao G via atm) HDFS-2928. ConfiguredFailoverProxyProvider should not create a NameNode proxy with an underlying retry proxy. (Uma Maheswara Rao G via atm)
HDFS-2955. IllegalStateException during standby startup in getCurSegmentTxId. (Hari Mankude via atm)

View File

@ -3168,8 +3168,12 @@ 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() {
return (getEditLog().getLastWrittenTxId() - if (isInStandbyState()) {
getEditLog().getCurSegmentTxId()) + 1; return 0;
} else {
return getEditLog().getLastWrittenTxId() -
getEditLog().getCurSegmentTxId() + 1;
}
} }
@Metric({"LastWrittenTransactionId", "Transaction ID written to the edit log"}) @Metric({"LastWrittenTransactionId", "Transaction ID written to the edit log"})

View File

@ -116,6 +116,7 @@ public class TestHASafeMode {
cluster.restartNameNode(1); cluster.restartNameNode(1);
nn1 = cluster.getNameNode(1); nn1 = cluster.getNameNode(1);
assertEquals(nn1.getNamesystem().getTransactionsSinceLastLogRoll(), 0L);
} }
/** /**