Repository: hadoop Updated Branches: refs/heads/trunk eeaf8edaa -> 993c2140c
HDFS-14054. TestLeaseRecovery2: testHardLeaseRecoveryAfterNameNodeRestart2 and testHardLeaseRecoveryWithRenameAfterNameNodeRestart are flaky. Contributed by Zsolt Venczel. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/993c2140 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/993c2140 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/993c2140 Branch: refs/heads/trunk Commit: 993c2140ccfb4c6dfd09c0c686b85a4b58cb39a2 Parents: eeaf8ed Author: Inigo Goiri <inigo...@apache.org> Authored: Thu Nov 15 09:29:14 2018 -0800 Committer: Inigo Goiri <inigo...@apache.org> Committed: Thu Nov 15 09:29:14 2018 -0800 ---------------------------------------------------------------------- .../apache/hadoop/hdfs/TestLeaseRecovery2.java | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/993c2140/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRecovery2.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRecovery2.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRecovery2.java index 5f16a99..bcd3cdc 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRecovery2.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRecovery2.java @@ -562,7 +562,14 @@ public class TestLeaseRecovery2 { // set the hard limit to be 1 second cluster.setLeasePeriod(LONG_LEASE_PERIOD, SHORT_LEASE_PERIOD); - + + // Normally, the in-progress edit log would be finalized by + // FSEditLog#endCurrentLogSegment. For testing purposes, we + // disable that here. + FSEditLog spyLog = spy(cluster.getNameNode().getFSImage().getEditLog()); + doNothing().when(spyLog).endCurrentLogSegment(Mockito.anyBoolean()); + DFSTestUtil.setEditLogForTesting(cluster.getNamesystem(), spyLog); + // Make sure lease recovery begins. final String path = fileStr; GenericTestUtils.waitFor(new Supplier<Boolean>() { @@ -570,16 +577,10 @@ public class TestLeaseRecovery2 { public Boolean get() { String holder = NameNodeAdapter.getLeaseHolderForPath(cluster.getNameNode(), path); - return holder.startsWith(HdfsServerConstants.NAMENODE_LEASE_HOLDER); + return holder!=null && holder + .startsWith(HdfsServerConstants.NAMENODE_LEASE_HOLDER); } - }, (int)SHORT_LEASE_PERIOD, (int)SHORT_LEASE_PERIOD * 10); - - // Normally, the in-progress edit log would be finalized by - // FSEditLog#endCurrentLogSegment. For testing purposes, we - // disable that here. - FSEditLog spyLog = spy(cluster.getNameNode().getFSImage().getEditLog()); - doNothing().when(spyLog).endCurrentLogSegment(Mockito.anyBoolean()); - DFSTestUtil.setEditLogForTesting(cluster.getNamesystem(), spyLog); + }, (int)SHORT_LEASE_PERIOD, (int)SHORT_LEASE_PERIOD * 20); cluster.restartNameNode(false); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org