HBASE-12258 TestHbaseFsck is flaky and has some multithreading issues

Signed-off-by: Elliott Clark <eclark@apache.org>
This commit is contained in:
manukranthk 2014-10-14 15:40:23 -07:00 committed by Elliott Clark
parent 3544f4e98b
commit f9c534bac3
1 changed files with 7 additions and 9 deletions

View File

@ -49,6 +49,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -2074,11 +2075,10 @@ public class TestHBaseFsck {
@Override @Override
public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException { public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException {
return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) { return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) {
boolean attemptedFirstHFile = false; AtomicBoolean attemptedFirstHFile = new AtomicBoolean(false);
@Override @Override
protected void checkHFile(Path p) throws IOException { protected void checkHFile(Path p) throws IOException {
if (!attemptedFirstHFile) { if (attemptedFirstHFile.compareAndSet(false, true)) {
attemptedFirstHFile = true;
assertTrue(fs.delete(p, true)); // make sure delete happened. assertTrue(fs.delete(p, true)); // make sure delete happened.
} }
super.checkHFile(p); super.checkHFile(p);
@ -2105,11 +2105,10 @@ public class TestHBaseFsck {
@Override @Override
public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException { public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException {
return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) { return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) {
boolean attemptedFirstFamDir = false; AtomicBoolean attemptedFirstHFile = new AtomicBoolean(false);
@Override @Override
protected void checkColFamDir(Path p) throws IOException { protected void checkColFamDir(Path p) throws IOException {
if (!attemptedFirstFamDir) { if (attemptedFirstHFile.compareAndSet(false, true)) {
attemptedFirstFamDir = true;
assertTrue(fs.delete(p, true)); // make sure delete happened. assertTrue(fs.delete(p, true)); // make sure delete happened.
} }
super.checkColFamDir(p); super.checkColFamDir(p);
@ -2134,11 +2133,10 @@ public class TestHBaseFsck {
@Override @Override
public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException { public HFileCorruptionChecker createHFileCorruptionChecker(boolean sidelineCorruptHFiles) throws IOException {
return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) { return new HFileCorruptionChecker(conf, executor, sidelineCorruptHFiles) {
boolean attemptedFirstRegionDir = false; AtomicBoolean attemptedFirstHFile = new AtomicBoolean(false);
@Override @Override
protected void checkRegionDir(Path p) throws IOException { protected void checkRegionDir(Path p) throws IOException {
if (!attemptedFirstRegionDir) { if (attemptedFirstHFile.compareAndSet(false, true)) {
attemptedFirstRegionDir = true;
assertTrue(fs.delete(p, true)); // make sure delete happened. assertTrue(fs.delete(p, true)); // make sure delete happened.
} }
super.checkRegionDir(p); super.checkRegionDir(p);