hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject git commit: HBASE-12258 TestHbaseFsck is flaky and has some multithreading issues
Date Wed, 15 Oct 2014 01:04:46 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 dc998bf78 -> 5ca2e4c71


HBASE-12258 TestHbaseFsck is flaky and has some multithreading issues

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


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

Branch: refs/heads/branch-1
Commit: 5ca2e4c7168ca19a85a2e865c8ba493008c758c2
Parents: dc998bf
Author: manukranthk <manukranthk@fb.com>
Authored: Tue Oct 14 15:40:23 2014 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Tue Oct 14 17:44:00 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/5ca2e4c7/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 70afecc..f5d295d 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
@@ -45,6 +45,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;
@@ -1909,11 +1910,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);
@@ -1940,11 +1940,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);
@@ -1969,11 +1968,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);


Mime
View raw message