Fix broke jenkins build; Fix TestSplitLogWorker. Remove added assert. Value may have already been set by background thread so assert was checking input at wrong time
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1097689 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d42c217a9
commit
d663e19637
|
@ -67,7 +67,6 @@ public class TestSplitLogWorker {
|
||||||
|
|
||||||
private boolean waitForCounterBoolean(AtomicLong ctr, long oldval, long newval,
|
private boolean waitForCounterBoolean(AtomicLong ctr, long oldval, long newval,
|
||||||
long timems) {
|
long timems) {
|
||||||
assert ctr.get() == oldval;
|
|
||||||
long curt = System.currentTimeMillis();
|
long curt = System.currentTimeMillis();
|
||||||
long endt = curt + timems;
|
long endt = curt + timems;
|
||||||
while (curt < endt) {
|
while (curt < endt) {
|
||||||
|
@ -128,6 +127,7 @@ public class TestSplitLogWorker {
|
||||||
@Test
|
@Test
|
||||||
public void testAcquireTaskAtStartup() throws Exception {
|
public void testAcquireTaskAtStartup() throws Exception {
|
||||||
LOG.info("testAcquireTaskAtStartup");
|
LOG.info("testAcquireTaskAtStartup");
|
||||||
|
ZKSplitLog.Counters.resetCounters();
|
||||||
|
|
||||||
zkw.getZooKeeper().create(ZKSplitLog.getEncodedNodeName(zkw, "tatas"),
|
zkw.getZooKeeper().create(ZKSplitLog.getEncodedNodeName(zkw, "tatas"),
|
||||||
TaskState.TASK_UNASSIGNED.get("mgr"), Ids.OPEN_ACL_UNSAFE,
|
TaskState.TASK_UNASSIGNED.get("mgr"), Ids.OPEN_ACL_UNSAFE,
|
||||||
|
@ -159,6 +159,7 @@ public class TestSplitLogWorker {
|
||||||
@Test
|
@Test
|
||||||
public void testRaceForTask() throws Exception {
|
public void testRaceForTask() throws Exception {
|
||||||
LOG.info("testRaceForTask");
|
LOG.info("testRaceForTask");
|
||||||
|
ZKSplitLog.Counters.resetCounters();
|
||||||
|
|
||||||
zkw.getZooKeeper().create(ZKSplitLog.getEncodedNodeName(zkw, "trft"),
|
zkw.getZooKeeper().create(ZKSplitLog.getEncodedNodeName(zkw, "trft"),
|
||||||
TaskState.TASK_UNASSIGNED.get("manager"), Ids.OPEN_ACL_UNSAFE,
|
TaskState.TASK_UNASSIGNED.get("manager"), Ids.OPEN_ACL_UNSAFE,
|
||||||
|
@ -172,11 +173,10 @@ public class TestSplitLogWorker {
|
||||||
slw2.start();
|
slw2.start();
|
||||||
try {
|
try {
|
||||||
waitForCounter(tot_wkr_task_acquired, 0, 1, 1000);
|
waitForCounter(tot_wkr_task_acquired, 0, 1, 1000);
|
||||||
boolean first =
|
// Assert that either the tot_wkr_failed_to_grab_task_owned count was set of if
|
||||||
waitForCounterBoolean(tot_wkr_failed_to_grab_task_owned, 0, 1, 1000);
|
// not it, that we fell through to the next counter in line and it was set.
|
||||||
boolean second =
|
assertTrue(waitForCounterBoolean(tot_wkr_failed_to_grab_task_owned, 0, 1, 1000) ||
|
||||||
waitForCounterBoolean(tot_wkr_failed_to_grab_task_lost_race, 0, 1, 100);
|
tot_wkr_failed_to_grab_task_lost_race.get() == 1);
|
||||||
assertTrue(first || second);
|
|
||||||
assertTrue(TaskState.TASK_OWNED.equals(ZKUtil.getData(zkw,
|
assertTrue(TaskState.TASK_OWNED.equals(ZKUtil.getData(zkw,
|
||||||
ZKSplitLog.getEncodedNodeName(zkw, "trft")), "svr1") ||
|
ZKSplitLog.getEncodedNodeName(zkw, "trft")), "svr1") ||
|
||||||
TaskState.TASK_OWNED.equals(ZKUtil.getData(zkw,
|
TaskState.TASK_OWNED.equals(ZKUtil.getData(zkw,
|
||||||
|
@ -190,6 +190,7 @@ public class TestSplitLogWorker {
|
||||||
@Test
|
@Test
|
||||||
public void testPreemptTask() throws Exception {
|
public void testPreemptTask() throws Exception {
|
||||||
LOG.info("testPreemptTask");
|
LOG.info("testPreemptTask");
|
||||||
|
ZKSplitLog.Counters.resetCounters();
|
||||||
|
|
||||||
SplitLogWorker slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(),
|
SplitLogWorker slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(),
|
||||||
"tpt_svr", neverEndingTask);
|
"tpt_svr", neverEndingTask);
|
||||||
|
@ -219,6 +220,7 @@ public class TestSplitLogWorker {
|
||||||
@Test
|
@Test
|
||||||
public void testMultipleTasks() throws Exception {
|
public void testMultipleTasks() throws Exception {
|
||||||
LOG.info("testMultipleTasks");
|
LOG.info("testMultipleTasks");
|
||||||
|
ZKSplitLog.Counters.resetCounters();
|
||||||
SplitLogWorker slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(),
|
SplitLogWorker slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(),
|
||||||
"tmt_svr", neverEndingTask);
|
"tmt_svr", neverEndingTask);
|
||||||
slw.start();
|
slw.start();
|
||||||
|
@ -255,6 +257,7 @@ public class TestSplitLogWorker {
|
||||||
@Test
|
@Test
|
||||||
public void testRescan() throws Exception {
|
public void testRescan() throws Exception {
|
||||||
LOG.info("testRescan");
|
LOG.info("testRescan");
|
||||||
|
ZKSplitLog.Counters.resetCounters();
|
||||||
slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(),
|
slw = new SplitLogWorker(zkw, TEST_UTIL.getConfiguration(),
|
||||||
"svr", neverEndingTask);
|
"svr", neverEndingTask);
|
||||||
slw.start();
|
slw.start();
|
||||||
|
|
Loading…
Reference in New Issue