HBASE-7681 Address some recent random test failures
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1439003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a3f0aea354
commit
1cdaa710be
@ -19,6 +19,7 @@ package org.apache.hadoop.hbase;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -61,26 +62,27 @@ public class TestNodeHealthCheckChore {
|
||||
Configuration config = getConfForNodeHealthScript();
|
||||
config.addResource(healthScriptFile.getName());
|
||||
String location = healthScriptFile.getAbsolutePath();
|
||||
long timeout = config.getLong(HConstants.HEALTH_SCRIPT_TIMEOUT, 100);
|
||||
long timeout = config.getLong(HConstants.HEALTH_SCRIPT_TIMEOUT, 200);
|
||||
|
||||
HealthChecker checker = new HealthChecker();
|
||||
checker.init(location, timeout);
|
||||
|
||||
String normalScript = "echo \"I am all fine\"";
|
||||
createScript(normalScript, true);
|
||||
HealthChecker checker = new HealthChecker();
|
||||
checker.init(location, timeout);
|
||||
HealthReport report = checker.checkHealth();
|
||||
assertTrue(report.getStatus() == HealthCheckerExitStatus.SUCCESS);
|
||||
assertEquals(HealthCheckerExitStatus.SUCCESS, report.getStatus());
|
||||
LOG.info("Health Status:" + checker);
|
||||
|
||||
String errorScript = "echo ERROR\n echo \"Server not healthy\"";
|
||||
createScript(errorScript, true);
|
||||
report = checker.checkHealth();
|
||||
assertTrue(report.getStatus() == HealthCheckerExitStatus.FAILED);
|
||||
assertEquals(HealthCheckerExitStatus.FAILED, report.getStatus());
|
||||
LOG.info("Health Status:" + report.getHealthReport());
|
||||
|
||||
String timeOutScript = "sleep 4\n echo\"I am fine\"";
|
||||
createScript(timeOutScript, true);
|
||||
report = checker.checkHealth();
|
||||
assertTrue(report.getStatus() == HealthCheckerExitStatus.TIMED_OUT);
|
||||
assertEquals(HealthCheckerExitStatus.TIMED_OUT, report.getStatus());
|
||||
LOG.info("Health Status:" + report.getHealthReport());
|
||||
|
||||
healthScriptFile.delete();
|
||||
@ -119,7 +121,7 @@ public class TestNodeHealthCheckChore {
|
||||
conf.set(HConstants.HEALTH_SCRIPT_LOC,
|
||||
healthScriptFile.getAbsolutePath());
|
||||
conf.setLong(HConstants.HEALTH_FAILURE_THRESHOLD, 3);
|
||||
conf.setLong(HConstants.HEALTH_SCRIPT_TIMEOUT, 100);
|
||||
conf.setLong(HConstants.HEALTH_SCRIPT_TIMEOUT, 200);
|
||||
return conf;
|
||||
}
|
||||
|
||||
|
@ -859,7 +859,7 @@ public class TestAdmin {
|
||||
assertFalse(admin.tableExists(tableName));
|
||||
final HTable table = TEST_UTIL.createTable(tableName, familyNames,
|
||||
numVersions, blockSize);
|
||||
try {
|
||||
|
||||
int rowCount = 0;
|
||||
byte[] q = new byte[0];
|
||||
|
||||
@ -969,11 +969,9 @@ public class TestAdmin {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
TEST_UTIL.deleteTable(tableName);
|
||||
table.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HADOOP-2156
|
||||
|
@ -106,8 +106,6 @@ public class SimpleRegionObserver extends BaseRegionObserver {
|
||||
Leases leases = re.getRegionServerServices().getLeases();
|
||||
leases.createLease("x", 2000, null);
|
||||
leases.cancelLease("x");
|
||||
Integer lid = re.getRegion().getLock(null, Bytes.toBytes("some row"), true);
|
||||
re.getRegion().releaseRowLock(lid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +77,7 @@ public class TestLruBlockCache {
|
||||
int n = 0;
|
||||
while(cache.getEvictionCount() == 0) {
|
||||
Thread.sleep(200);
|
||||
assertTrue(n++ < 10);
|
||||
assertTrue(n++ < 20);
|
||||
}
|
||||
System.out.println("Background Evictions run: " + cache.getEvictionCount());
|
||||
|
||||
|
@ -22,6 +22,8 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.*;
|
||||
import org.apache.hadoop.mapreduce.Job;
|
||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||
@ -51,6 +53,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
@Category(MediumTests.class)
|
||||
public class TestImportTsv {
|
||||
private static final Log LOG = LogFactory.getLog(TestImportTsv.class);
|
||||
|
||||
@Test
|
||||
public void testTsvParserSpecParsing() {
|
||||
@ -266,7 +269,6 @@ public class TestImportTsv {
|
||||
args = opts.getRemainingArgs();
|
||||
|
||||
try {
|
||||
|
||||
FileSystem fs = FileSystem.get(conf);
|
||||
FSDataOutputStream op = fs.create(new Path(inputFile), true);
|
||||
if (data == null) {
|
||||
@ -280,8 +282,11 @@ public class TestImportTsv {
|
||||
if (conf.get(ImportTsv.BULK_OUTPUT_CONF_KEY) == null) {
|
||||
HTableDescriptor desc = new HTableDescriptor(TAB);
|
||||
desc.addFamily(new HColumnDescriptor(FAM));
|
||||
new HBaseAdmin(conf).createTable(desc);
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
admin.createTable(desc);
|
||||
admin.close();
|
||||
} else { // set the hbaseAdmin as we are not going through main()
|
||||
LOG.info("set the hbaseAdmin");
|
||||
ImportTsv.createHbaseAdmin(conf);
|
||||
}
|
||||
Job job = ImportTsv.createSubmittableJob(conf, args);
|
||||
@ -323,6 +328,7 @@ public class TestImportTsv {
|
||||
// continue
|
||||
}
|
||||
}
|
||||
table.close();
|
||||
assertTrue(verified);
|
||||
} finally {
|
||||
htu1.shutdownMiniMapReduceCluster();
|
||||
|
@ -125,7 +125,7 @@ public class TestSplitLogManager {
|
||||
Mockito.when(sm.isServerOnline(Mockito.any(ServerName.class))).thenReturn(true);
|
||||
Mockito.when(master.getServerManager()).thenReturn(sm);
|
||||
|
||||
to = 4000;
|
||||
to = 6000;
|
||||
conf.setInt("hbase.splitlog.manager.timeout", to);
|
||||
conf.setInt("hbase.splitlog.manager.unassigned.timeout", 2 * to);
|
||||
conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
|
||||
|
@ -140,7 +140,7 @@ public class TestSplitLogWorker {
|
||||
SplitLogWorker slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(), RS, neverEndingTask);
|
||||
slw.start();
|
||||
try {
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1500);
|
||||
byte [] bytes = ZKUtil.getData(zkw, ZKSplitLog.getEncodedNodeName(zkw, TATAS));
|
||||
SplitLogTask slt = SplitLogTask.parseFrom(bytes);
|
||||
assertTrue(slt.isOwned(RS));
|
||||
@ -176,10 +176,10 @@ public class TestSplitLogWorker {
|
||||
slw1.start();
|
||||
slw2.start();
|
||||
try {
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1500);
|
||||
// Assert that either the tot_wkr_failed_to_grab_task_owned count was set of if
|
||||
// not it, that we fell through to the next counter in line and it was set.
|
||||
assertTrue(waitForCounterBoolean(SplitLogCounters.tot_wkr_failed_to_grab_task_owned, 0, 1, 1000, false) ||
|
||||
assertTrue(waitForCounterBoolean(SplitLogCounters.tot_wkr_failed_to_grab_task_owned, 0, 1, 1500, false) ||
|
||||
SplitLogCounters.tot_wkr_failed_to_grab_task_lost_race.get() == 1);
|
||||
byte [] bytes = ZKUtil.getData(zkw, ZKSplitLog.getEncodedNodeName(zkw, TRFT));
|
||||
SplitLogTask slt = SplitLogTask.parseFrom(bytes);
|
||||
@ -207,14 +207,14 @@ public class TestSplitLogWorker {
|
||||
new SplitLogTask.Unassigned(MANAGER).toByteArray(), Ids.OPEN_ACL_UNSAFE,
|
||||
CreateMode.PERSISTENT);
|
||||
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1500);
|
||||
assertEquals(1, slw.taskReadySeq);
|
||||
byte [] bytes = ZKUtil.getData(zkw, PATH);
|
||||
SplitLogTask slt = SplitLogTask.parseFrom(bytes);
|
||||
assertTrue(slt.isOwned(SRV));
|
||||
slt = new SplitLogTask.Unassigned(MANAGER);
|
||||
ZKUtil.setData(zkw, PATH, slt.toByteArray());
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, 1500);
|
||||
} finally {
|
||||
stopSplitLogWorker(slw);
|
||||
}
|
||||
@ -235,7 +235,7 @@ public class TestSplitLogWorker {
|
||||
zkw.getRecoverableZooKeeper().create(PATH1, unassignedManager.toByteArray(),
|
||||
Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
|
||||
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1500);
|
||||
// now the worker is busy doing the above task
|
||||
|
||||
// create another task
|
||||
@ -247,9 +247,9 @@ public class TestSplitLogWorker {
|
||||
final ServerName anotherWorker = new ServerName("another-worker,1,1");
|
||||
SplitLogTask slt = new SplitLogTask.Owned(anotherWorker);
|
||||
ZKUtil.setData(zkw, PATH1, slt.toByteArray());
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, 1500);
|
||||
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, 1500);
|
||||
assertEquals(2, slw.taskReadySeq);
|
||||
byte [] bytes = ZKUtil.getData(zkw, PATH2);
|
||||
slt = SplitLogTask.parseFrom(bytes);
|
||||
@ -274,25 +274,25 @@ public class TestSplitLogWorker {
|
||||
zkw.getRecoverableZooKeeper().create(task,slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
|
||||
CreateMode.PERSISTENT);
|
||||
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 0, 1, 1500);
|
||||
// now the worker is busy doing the above task
|
||||
|
||||
// preempt the task, have it owned by another worker
|
||||
ZKUtil.setData(zkw, task, slt.toByteArray());
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 0, 1, 1500);
|
||||
|
||||
// create a RESCAN node
|
||||
String rescan = ZKSplitLog.getEncodedNodeName(zkw, "RESCAN");
|
||||
rescan = zkw.getRecoverableZooKeeper().create(rescan, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
|
||||
CreateMode.PERSISTENT_SEQUENTIAL);
|
||||
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired, 1, 2, 1500);
|
||||
// RESCAN node might not have been processed if the worker became busy
|
||||
// with the above task. preempt the task again so that now the RESCAN
|
||||
// node is processed
|
||||
ZKUtil.setData(zkw, task, slt.toByteArray());
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, 1000);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, 1500);
|
||||
waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, 1500);
|
||||
|
||||
List<String> nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.splitLogZNode);
|
||||
LOG.debug(nodes);
|
||||
|
@ -149,7 +149,7 @@ public class TestThriftServerCmdLine {
|
||||
cmdLineThread.start();
|
||||
}
|
||||
|
||||
@Test(timeout=60 * 1000)
|
||||
@Test(timeout=120 * 1000)
|
||||
public void testRunThriftServer() throws Exception {
|
||||
List<String> args = new ArrayList<String>();
|
||||
if (implType != null) {
|
||||
|
@ -58,7 +58,7 @@ public class TestMiniClusterLoadSequential {
|
||||
protected static final byte[] CF = Bytes.toBytes("load_test_cf");
|
||||
protected static final int NUM_THREADS = 8;
|
||||
protected static final int NUM_RS = 2;
|
||||
protected static final int TIMEOUT_MS = 120000;
|
||||
protected static final int TIMEOUT_MS = 180000;
|
||||
protected static final HBaseTestingUtility TEST_UTIL =
|
||||
new HBaseTestingUtility();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user