HBASE-8993 TestHRegionOnCluster.testDataCorrectnessReplayingRecoveredEdits fails
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1504714 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
320d23cb35
commit
6574aee773
|
@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import org.apache.hadoop.hbase.MediumTests;
|
import org.apache.hadoop.hbase.MediumTests;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
|
import org.mortbay.log.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that need to spin up a cluster testing an {@link HRegion}. Use
|
* Tests that need to spin up a cluster testing an {@link HRegion}. Use
|
||||||
|
@ -49,7 +50,7 @@ import org.junit.experimental.categories.Category;
|
||||||
public class TestHRegionOnCluster {
|
public class TestHRegionOnCluster {
|
||||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||||
|
|
||||||
@Test (timeout=180000)
|
@Test (timeout=300000)
|
||||||
public void testDataCorrectnessReplayingRecoveredEdits() throws Exception {
|
public void testDataCorrectnessReplayingRecoveredEdits() throws Exception {
|
||||||
final int NUM_MASTERS = 1;
|
final int NUM_MASTERS = 1;
|
||||||
final int NUM_RS = 3;
|
final int NUM_RS = 3;
|
||||||
|
@ -71,6 +72,7 @@ public class TestHRegionOnCluster {
|
||||||
assertTrue(hbaseAdmin.isTableAvailable(TABLENAME));
|
assertTrue(hbaseAdmin.isTableAvailable(TABLENAME));
|
||||||
|
|
||||||
// Put data: r1->v1
|
// Put data: r1->v1
|
||||||
|
Log.info("Loading r1 to v1 into " + Bytes.toString(TABLENAME));
|
||||||
HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
|
HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
|
||||||
putDataAndVerify(table, "r1", FAMILY, "v1", 1);
|
putDataAndVerify(table, "r1", FAMILY, "v1", 1);
|
||||||
|
|
||||||
|
@ -81,6 +83,7 @@ public class TestHRegionOnCluster {
|
||||||
int targetServerNum = (originServerNum + 1) % NUM_RS;
|
int targetServerNum = (originServerNum + 1) % NUM_RS;
|
||||||
HRegionServer targetServer = cluster.getRegionServer(targetServerNum);
|
HRegionServer targetServer = cluster.getRegionServer(targetServerNum);
|
||||||
assertFalse(originServer.equals(targetServer));
|
assertFalse(originServer.equals(targetServer));
|
||||||
|
Log.info("Moving " + regionInfo.getEncodedName() + " to " + targetServer.getServerName());
|
||||||
hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
|
hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
|
||||||
Bytes.toBytes(targetServer.getServerName().getServerName()));
|
Bytes.toBytes(targetServer.getServerName().getServerName()));
|
||||||
do {
|
do {
|
||||||
|
@ -88,9 +91,11 @@ public class TestHRegionOnCluster {
|
||||||
} while (cluster.getServerWith(regionInfo.getRegionName()) == originServerNum);
|
} while (cluster.getServerWith(regionInfo.getRegionName()) == originServerNum);
|
||||||
|
|
||||||
// Put data: r2->v2
|
// Put data: r2->v2
|
||||||
|
Log.info("Loading r2 to v2 into " + Bytes.toString(TABLENAME));
|
||||||
putDataAndVerify(table, "r2", FAMILY, "v2", 2);
|
putDataAndVerify(table, "r2", FAMILY, "v2", 2);
|
||||||
|
|
||||||
// Move region to origin server
|
// Move region to origin server
|
||||||
|
Log.info("Moving " + regionInfo.getEncodedName() + " to " + originServer.getServerName());
|
||||||
hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
|
hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(),
|
||||||
Bytes.toBytes(originServer.getServerName().getServerName()));
|
Bytes.toBytes(originServer.getServerName().getServerName()));
|
||||||
do {
|
do {
|
||||||
|
@ -98,9 +103,11 @@ public class TestHRegionOnCluster {
|
||||||
} while (cluster.getServerWith(regionInfo.getRegionName()) == targetServerNum);
|
} while (cluster.getServerWith(regionInfo.getRegionName()) == targetServerNum);
|
||||||
|
|
||||||
// Put data: r3->v3
|
// Put data: r3->v3
|
||||||
|
Log.info("Loading r3 to v3 into " + Bytes.toString(TABLENAME));
|
||||||
putDataAndVerify(table, "r3", FAMILY, "v3", 3);
|
putDataAndVerify(table, "r3", FAMILY, "v3", 3);
|
||||||
|
|
||||||
// Kill target server
|
// Kill target server
|
||||||
|
Log.info("Killing target server " + targetServer.getServerName());
|
||||||
targetServer.kill();
|
targetServer.kill();
|
||||||
cluster.getRegionServerThreads().get(targetServerNum).join();
|
cluster.getRegionServerThreads().get(targetServerNum).join();
|
||||||
// Wait until finish processing of shutdown
|
// Wait until finish processing of shutdown
|
||||||
|
@ -108,10 +115,12 @@ public class TestHRegionOnCluster {
|
||||||
Thread.sleep(5);
|
Thread.sleep(5);
|
||||||
}
|
}
|
||||||
// Kill origin server
|
// Kill origin server
|
||||||
|
Log.info("Killing origin server " + targetServer.getServerName());
|
||||||
originServer.kill();
|
originServer.kill();
|
||||||
cluster.getRegionServerThreads().get(originServerNum).join();
|
cluster.getRegionServerThreads().get(originServerNum).join();
|
||||||
|
|
||||||
// Put data: r4->v4
|
// Put data: r4->v4
|
||||||
|
Log.info("Loading r4 to v4 into " + Bytes.toString(TABLENAME));
|
||||||
putDataAndVerify(table, "r4", FAMILY, "v4", 4);
|
putDataAndVerify(table, "r4", FAMILY, "v4", 4);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue