hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1384592 - in /hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs: CHANGES.HDFS-3077.txt src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
Date Thu, 13 Sep 2012 23:00:23 GMT
Author: todd
Date: Thu Sep 13 23:00:22 2012
New Revision: 1384592

URL: http://svn.apache.org/viewvc?rev=1384592&view=rev
Log:
HDFS-3894. QJM: testRecoverAfterDoubleFailures can be flaky due to IPC client caching. Contributed
by Todd Lipcon.

Modified:
    hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt
    hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java

Modified: hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt?rev=1384592&r1=1384591&r2=1384592&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt
Thu Sep 13 23:00:22 2012
@@ -70,3 +70,5 @@ HDFS-3915. QJM: Failover fails with auth
 HDFS-3906. QJM: quorum timeout on failover with large log segment (todd)
 
 HDFS-3840. JournalNodes log JournalNotFormattedException backtrace error before being formatted
(todd)
+
+HDFS-3894. QJM: testRecoverAfterDoubleFailures can be flaky due to IPC client caching (todd)

Modified: hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java?rev=1384592&r1=1384591&r2=1384592&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
(original)
+++ hadoop/common/branches/HDFS-3077/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
Thu Sep 13 23:00:22 2012
@@ -47,6 +47,7 @@ import org.apache.hadoop.hdfs.server.nam
 import org.apache.hadoop.hdfs.server.namenode.EditLogOutputStream;
 import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
 import org.apache.hadoop.hdfs.util.Holder;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.ipc.ProtobufRpcEngine;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.log4j.Level;
@@ -90,9 +91,10 @@ public class TestQJMWithFaults {
   private static long determineMaxIpcNumber() throws Exception {
     Configuration conf = new Configuration();
     MiniJournalCluster cluster = new MiniJournalCluster.Builder(conf).build();
+    QuorumJournalManager qjm = null;
     long ret;
     try {
-      QuorumJournalManager qjm = createInjectableQJM(cluster);
+      qjm = createInjectableQJM(cluster);
       qjm.format(FAKE_NSINFO);
       doWorkload(cluster, qjm);
       
@@ -110,6 +112,7 @@ public class TestQJMWithFaults {
       ret = ipcCounts.first();
       LOG.info("Max IPC count = " + ret);
     } finally {
+      IOUtils.closeStream(qjm);
       cluster.shutdown();
     }
     return ret;
@@ -136,8 +139,8 @@ public class TestQJMWithFaults {
         
         MiniJournalCluster cluster = new MiniJournalCluster.Builder(conf)
           .build();
+        QuorumJournalManager qjm = null;
         try {
-          QuorumJournalManager qjm;
           qjm = createInjectableQJM(cluster);
           qjm.format(FAKE_NSINFO);
           List<AsyncLogger> loggers = qjm.getLoggerSetForTests().getLoggersForTests();
@@ -150,6 +153,8 @@ public class TestQJMWithFaults {
                 ". This is expected since we injected a failure in the " +
                 "majority.");
           }
+          qjm.close();
+          qjm = null;
 
           // Now should be able to recover
           qjm = createInjectableQJM(cluster);
@@ -165,6 +170,8 @@ public class TestQJMWithFaults {
         } finally {
           cluster.shutdown();
           cluster = null;
+          IOUtils.closeStream(qjm);
+          qjm = null;
         }
       }
     }
@@ -405,7 +412,6 @@ public class TestQJMWithFaults {
         Mockito.withSettings()
           .defaultAnswer(wrapper)
           .extraInterfaces(Closeable.class));
-    Mockito.doNothing().when((Closeable)mock).close();
     return mock;
   }
 
@@ -418,7 +424,12 @@ public class TestQJMWithFaults {
     @SuppressWarnings("unchecked")
     @Override
     public T answer(InvocationOnMock invocation) throws Throwable {
-      beforeCall(invocation);
+      // Don't want to inject an error on close() since that isn't
+      // actually an IPC call!
+      if (!Closeable.class.equals(
+            invocation.getMethod().getDeclaringClass())) {
+        beforeCall(invocation);
+      }
 
       try {
         return (T) invocation.getMethod().invoke(realObj,



Mime
View raw message