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-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 long getTransactionsSinceLastCheckpoint() {
@Metric({"TransactionsSinceLastLogRoll",
"Number of transactions since last edit log roll"})
public long getTransactionsSinceLastLogRoll() {
return (getEditLog().getLastWrittenTxId() -
getEditLog().getCurSegmentTxId()) + 1;
if (isInStandbyState()) {
return 0;
} else {
return getEditLog().getLastWrittenTxId() -
getEditLog().getCurSegmentTxId() + 1;
}
}
@Metric({"LastWrittenTransactionId", "Transaction ID written to the edit log"})

View File

@ -116,6 +116,7 @@ private void restartStandby() throws IOException {
cluster.restartNameNode(1);
nn1 = cluster.getNameNode(1);
assertEquals(nn1.getNamesystem().getTransactionsSinceLastLogRoll(), 0L);
}
/**