You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2020/06/03 21:17:16 UTC

[hadoop] branch branch-2.10 updated: HDFS-14054. TestLeaseRecovery2: testHardLeaseRecoveryAfterNameNodeRestart2 and testHardLeaseRecoveryWithRenameAfterNameNodeRestart are flaky. Contributed by Zsolt Venczel.

This is an automated email from the ASF dual-hosted git repository.

inigoiri pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new b411fce  HDFS-14054. TestLeaseRecovery2: testHardLeaseRecoveryAfterNameNodeRestart2 and testHardLeaseRecoveryWithRenameAfterNameNodeRestart are flaky. Contributed by Zsolt Venczel.
b411fce is described below

commit b411fcee866125c94b0e8c8a87d4c718b9f189d2
Author: Inigo Goiri <in...@apache.org>
AuthorDate: Thu Nov 15 09:29:14 2018 -0800

    HDFS-14054. TestLeaseRecovery2: testHardLeaseRecoveryAfterNameNodeRestart2 and testHardLeaseRecoveryWithRenameAfterNameNodeRestart are flaky. Contributed by Zsolt Venczel.
    
    (cherry picked from commit 993c2140ccfb4c6dfd09c0c686b85a4b58cb39a2)
---
 .../org/apache/hadoop/hdfs/TestLeaseRecovery2.java  | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

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 85eaf2b..eeb1014 100755
--- 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
@@ -496,7 +496,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>() {
@@ -504,16 +511,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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org