You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2014/10/15 03:03:51 UTC

git commit: HBASE-12258 TestHbaseFsck is flaky and has some multithreading issues

Repository: hbase
Updated Branches:
  refs/heads/master 3544f4e98 -> f9c534bac


HBASE-12258 TestHbaseFsck is flaky and has some multithreading issues

Signed-off-by: Elliott Clark <ec...@apache.org>


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

Branch: refs/heads/master
Commit: f9c534bac333bf530181e80e216135caaa5cafdb
Parents: 3544f4e
Author: manukranthk <ma...@fb.com>
Authored: Tue Oct 14 15:40:23 2014 -0700
Committer: Elliott Clark <ec...@apache.org>
Committed: Tue Oct 14 17:36:31 2014 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/util/TestHBaseFsck.java | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/f9c534ba/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
index 064922d..d3e62fe 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
@@ -49,6 +49,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
@@ -2074,11 +2075,10 @@ public class TestHBaseFsck {
       @Override
       public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException {
         return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) {
-          boolean attemptedFirstHFile = false;
+          AtomicBoolean attemptedFirstHFile = new AtomicBoolean(false);
           @Override
           protected void checkHFile(Path p) throws IOException {
-            if (!attemptedFirstHFile) {
-              attemptedFirstHFile = true;
+            if (attemptedFirstHFile.compareAndSet(false, true)) {
               assertTrue(fs.delete(p, true)); // make sure delete happened.
             }
             super.checkHFile(p);
@@ -2105,11 +2105,10 @@ public class TestHBaseFsck {
       @Override
       public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException {
         return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) {
-          boolean attemptedFirstFamDir = false;
+          AtomicBoolean attemptedFirstHFile = new AtomicBoolean(false);
           @Override
           protected void checkColFamDir(Path p) throws IOException {
-            if (!attemptedFirstFamDir) {
-              attemptedFirstFamDir = true;
+            if (attemptedFirstHFile.compareAndSet(false, true)) {
               assertTrue(fs.delete(p, true)); // make sure delete happened.
             }
             super.checkColFamDir(p);
@@ -2134,11 +2133,10 @@ public class TestHBaseFsck {
       @Override
       public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException {
         return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) {
-          boolean attemptedFirstRegionDir = false;
+          AtomicBoolean attemptedFirstHFile = new AtomicBoolean(false);
           @Override
           protected void checkRegionDir(Path p) throws IOException {
-            if (!attemptedFirstRegionDir) {
-              attemptedFirstRegionDir = true;
+            if (attemptedFirstHFile.compareAndSet(false, true)) {
               assertTrue(fs.delete(p, true)); // make sure delete happened.
             }
             super.checkRegionDir(p);