HBASE-5042 TestReadWriteConsistencyControl should be renamed
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1378804 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8e7185b507
commit
e88e87d7fe
|
@ -1,6 +1,4 @@
|
||||||
/**
|
/**
|
||||||
* Copyright 2010 The Apache Software Foundation
|
|
||||||
*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
|
@ -27,8 +25,12 @@ import java.util.Random;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a hammer test that verifies MultiVersionConsistencyControl in a
|
||||||
|
* multiple writer single reader scenario.
|
||||||
|
*/
|
||||||
@Category(SmallTests.class)
|
@Category(SmallTests.class)
|
||||||
public class TestReadWriteConsistencyControl extends TestCase {
|
public class TestMultiVersionConsistencyControl extends TestCase {
|
||||||
static class Writer implements Runnable {
|
static class Writer implements Runnable {
|
||||||
final AtomicBoolean finished;
|
final AtomicBoolean finished;
|
||||||
final MultiVersionConsistencyControl mvcc;
|
final MultiVersionConsistencyControl mvcc;
|
||||||
|
@ -39,6 +41,7 @@ public class TestReadWriteConsistencyControl extends TestCase {
|
||||||
this.mvcc = mvcc;
|
this.mvcc = mvcc;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Random rnd = new Random();
|
private Random rnd = new Random();
|
||||||
public boolean failed = false;
|
public boolean failed = false;
|
||||||
|
|
||||||
|
@ -51,8 +54,7 @@ public class TestReadWriteConsistencyControl extends TestCase {
|
||||||
// 500 * 1000 = 500,000ns = 500 usec
|
// 500 * 1000 = 500,000ns = 500 usec
|
||||||
// 1 * 100 = 100ns = 1usec
|
// 1 * 100 = 100ns = 1usec
|
||||||
try {
|
try {
|
||||||
if (sleepTime > 0)
|
if (sleepTime > 0) Thread.sleep(0, sleepTime * 1000);
|
||||||
Thread.sleep(0, sleepTime * 1000);
|
|
||||||
} catch (InterruptedException e1) {
|
} catch (InterruptedException e1) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -84,8 +86,7 @@ public class TestReadWriteConsistencyControl extends TestCase {
|
||||||
long newPrev = mvcc.memstoreReadPoint();
|
long newPrev = mvcc.memstoreReadPoint();
|
||||||
if (newPrev < prev) {
|
if (newPrev < prev) {
|
||||||
// serious problem.
|
// serious problem.
|
||||||
System.out.println("Reader got out of order, prev: " +
|
System.out.println("Reader got out of order, prev: " + prev + " next was: " + newPrev);
|
||||||
prev + " next was: " + newPrev);
|
|
||||||
readerFailed.set(true);
|
readerFailed.set(true);
|
||||||
// might as well give up
|
// might as well give up
|
||||||
failedAt.set(newPrev);
|
failedAt.set(newPrev);
|
||||||
|
@ -126,11 +127,8 @@ public class TestReadWriteConsistencyControl extends TestCase {
|
||||||
assertTrue(statuses[i].get());
|
assertTrue(statuses[i].get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@org.junit.Rule
|
@org.junit.Rule
|
||||||
public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
|
public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu = new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();
|
||||||
new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue