HDFS-12836. startTxId could be greater than endTxId when tailing in-progress edit log. Contributed by Chao Sun.

This commit is contained in:
Wei-Chiu Chuang 2017-12-01 12:01:21 -08:00 committed by Chen Liang
parent 9599c91518
commit 12dc7ff566
2 changed files with 25 additions and 0 deletions

View File

@ -622,6 +622,12 @@ public class QuorumJournalManager implements JournalManager {
// than committedTxnId. This ensures the consistency.
if (onlyDurableTxns && inProgressOk) {
endTxId = Math.min(endTxId, committedTxnId);
if (endTxId < remoteLog.getStartTxId()) {
LOG.warn("Found endTxId (" + endTxId + ") that is less than " +
"the startTxId (" + remoteLog.getStartTxId() +
") - setting it to startTxId.");
endTxId = remoteLog.getStartTxId();
}
}
EditLogInputStream elis = EditLogFileInputStream.fromUrl(

View File

@ -398,6 +398,25 @@ public class TestStandbyInProgressTail {
waitForFileInfo(nn1, "/test", "/test2", "/test3");
}
@Test
public void testNonUniformConfig() throws Exception {
// Test case where some NNs (in this case the active NN) in the cluster
// do not have in-progress tailing enabled.
Configuration newConf = cluster.getNameNode(0).getConf();
newConf.setBoolean(
DFSConfigKeys.DFS_HA_TAILEDITS_INPROGRESS_KEY,
false);
cluster.restartNameNode(0);
cluster.transitionToActive(0);
cluster.getNameNode(0).getRpcServer().mkdirs("/test",
FsPermission.createImmutable((short) 0755), true);
cluster.getNameNode(0).getRpcServer().rollEdits();
cluster.getNameNode(1).getNamesystem().getEditLogTailer().doTailEdits();
assertNotNull(NameNodeAdapter.getFileInfo(nn1, "/test", true));
}
/**
* Check that no edits files are present in the given storage dirs.
*/