hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [48/50] [abbrv] hadoop git commit: Addendum fix for HDFS-10817 to fix failure of the added testFSReadLockLongHoldingReport in branch-2.
Date Thu, 01 Sep 2016 15:50:44 GMT
Addendum fix for HDFS-10817 to fix failure of the added testFSReadLockLongHoldingReport in
branch-2.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6c600360
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6c600360
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6c600360

Branch: refs/heads/HDFS-7240
Commit: 6c600360ca469d5fe0f017d681585db06c80c9cc
Parents: 6f4b0d3
Author: Zhe Zhang <zhz@apache.org>
Authored: Wed Aug 31 23:43:59 2016 -0700
Committer: Zhe Zhang <zhz@apache.org>
Committed: Wed Aug 31 23:43:59 2016 -0700

----------------------------------------------------------------------
 .../hdfs/server/namenode/TestFSNamesystem.java  | 50 +++-----------------
 1 file changed, 6 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/6c600360/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSNamesystem.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSNamesystem.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSNamesystem.java
index ccc8a6e..b85b6aba 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSNamesystem.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSNamesystem.java
@@ -59,6 +59,7 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeoutException;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 public class TestFSNamesystem {
@@ -431,54 +432,15 @@ public class TestFSNamesystem {
     t2.start();
     t1.join();
     t2.join();
+    // Look for the differentiating class names in the stack trace
+    String stackTracePatternString =
+        String.format("INFO.+%s(.+\n){4}\\Q%%s\\E\\.run", readLockLogStmt);
     Pattern t1Pattern = Pattern.compile(
-        String.format("\\Q%s\\E.+%s", t1.getName(), readLockLogStmt));
+        String.format(stackTracePatternString, t1.getClass().getName()));
     assertTrue(t1Pattern.matcher(logs.getOutput()).find());
     Pattern t2Pattern = Pattern.compile(
-        String.format("\\Q%s\\E.+%s", t2.getName(), readLockLogStmt));
+        String.format(stackTracePatternString, t2.getClass().getName()));
     assertFalse(t2Pattern.matcher(logs.getOutput()).find());
-
-    // Spin up a bunch of threads all grabbing the lock at once; assign some
-    // to go over threshold and some under. Check that they all log correctly.
-    logs.clearOutput();
-    final int threadCount = 50;
-    List<Thread> threads = new ArrayList<>(threadCount);
-    for (int i = 0; i < threadCount; i++) {
-      threads.add(new Thread() {
-        @Override
-        public void run() {
-          try {
-            long sleepTime;
-            if (this.getName().hashCode() % 2 == 0) {
-              sleepTime = readLockReportingThreshold + 10;
-            } else {
-              sleepTime = readLockReportingThreshold / 2;
-            }
-            fsn.readLock();
-            Thread.sleep(sleepTime);
-            fsn.readUnlock();
-          } catch (InterruptedException e) {
-            fail("Interrupted during testing");
-          }
-        }
-      });
-    }
-    for (Thread t : threads) {
-      t.start();
-    }
-    for (Thread t : threads) {
-      t.join();
-    }
-    for (Thread t : threads) {
-      Pattern p = Pattern.compile(
-          String.format("\\Q%s\\E.+%s", t.getName(), readLockLogStmt));
-      boolean foundLog = p.matcher(logs.getOutput()).find();
-      if (t.getName().hashCode() % 2 == 0) {
-        assertTrue(foundLog);
-      } else {
-        assertFalse(foundLog);
-      }
-    }
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message