HBASE-6202 Medium tests fail with jdk1.7
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1351423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ee16d9aad
commit
52f7000373
|
@ -235,7 +235,9 @@ public class TestClassLoading {
|
||||||
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
|
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
|
||||||
HBaseAdmin admin = new HBaseAdmin(this.conf);
|
HBaseAdmin admin = new HBaseAdmin(this.conf);
|
||||||
if (admin.tableExists(tableName)) {
|
if (admin.tableExists(tableName)) {
|
||||||
admin.disableTable(tableName);
|
if (admin.isTableEnabled(tableName)) {
|
||||||
|
admin.disableTable(tableName);
|
||||||
|
}
|
||||||
admin.deleteTable(tableName);
|
admin.deleteTable(tableName);
|
||||||
}
|
}
|
||||||
admin.createTable(htd);
|
admin.createTable(htd);
|
||||||
|
@ -337,7 +339,9 @@ public class TestClassLoading {
|
||||||
|
|
||||||
HBaseAdmin admin = new HBaseAdmin(this.conf);
|
HBaseAdmin admin = new HBaseAdmin(this.conf);
|
||||||
if (admin.tableExists(tableName)) {
|
if (admin.tableExists(tableName)) {
|
||||||
admin.disableTable(tableName);
|
if (admin.isTableEnabled(tableName)) {
|
||||||
|
admin.disableTable(tableName);
|
||||||
|
}
|
||||||
admin.deleteTable(tableName);
|
admin.deleteTable(tableName);
|
||||||
}
|
}
|
||||||
admin.createTable(htd);
|
admin.createTable(htd);
|
||||||
|
@ -439,7 +443,9 @@ public class TestClassLoading {
|
||||||
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
|
"|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3");
|
||||||
HBaseAdmin admin = new HBaseAdmin(this.conf);
|
HBaseAdmin admin = new HBaseAdmin(this.conf);
|
||||||
if (admin.tableExists(tableName)) {
|
if (admin.tableExists(tableName)) {
|
||||||
admin.disableTable(tableName);
|
if (admin.isTableEnabled(tableName)) {
|
||||||
|
admin.disableTable(tableName);
|
||||||
|
}
|
||||||
admin.deleteTable(tableName);
|
admin.deleteTable(tableName);
|
||||||
}
|
}
|
||||||
admin.createTable(htd);
|
admin.createTable(htd);
|
||||||
|
|
|
@ -916,75 +916,87 @@ public class TestMasterObserver {
|
||||||
cp.resetStates();
|
cp.resetStates();
|
||||||
|
|
||||||
HTable table = UTIL.createTable(TEST_TABLE, TEST_FAMILY);
|
HTable table = UTIL.createTable(TEST_TABLE, TEST_FAMILY);
|
||||||
int countOfRegions = UTIL.createMultiRegions(table, TEST_FAMILY);
|
|
||||||
UTIL.waitUntilAllRegionsAssigned(countOfRegions);
|
|
||||||
|
|
||||||
NavigableMap<HRegionInfo, ServerName> regions = table.getRegionLocations();
|
try {
|
||||||
Map.Entry<HRegionInfo, ServerName> firstGoodPair = null;
|
int countOfRegions = UTIL.createMultiRegions(table, TEST_FAMILY);
|
||||||
for (Map.Entry<HRegionInfo, ServerName> e: regions.entrySet()) {
|
UTIL.waitUntilAllRegionsAssigned(countOfRegions);
|
||||||
if (e.getValue() != null) {
|
|
||||||
firstGoodPair = e;
|
NavigableMap<HRegionInfo, ServerName> regions = table.getRegionLocations();
|
||||||
break;
|
Map.Entry<HRegionInfo, ServerName> firstGoodPair = null;
|
||||||
|
for (Map.Entry<HRegionInfo, ServerName> e: regions.entrySet()) {
|
||||||
|
if (e.getValue() != null) {
|
||||||
|
firstGoodPair = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
assertNotNull("Found a non-null entry", firstGoodPair);
|
||||||
assertNotNull("Found a non-null entry", firstGoodPair);
|
LOG.info("Found " + firstGoodPair.toString());
|
||||||
LOG.info("Found " + firstGoodPair.toString());
|
// Try to force a move
|
||||||
// Try to force a move
|
Collection<ServerName> servers = master.getClusterStatus().getServers();
|
||||||
Collection<ServerName> servers = master.getClusterStatus().getServers();
|
String destName = null;
|
||||||
String destName = null;
|
String serverNameForFirstRegion = firstGoodPair.getValue().toString();
|
||||||
String serverNameForFirstRegion = firstGoodPair.getValue().toString();
|
LOG.info("serverNameForFirstRegion=" + serverNameForFirstRegion);
|
||||||
LOG.info("serverNameForFirstRegion=" + serverNameForFirstRegion);
|
boolean found = false;
|
||||||
boolean found = false;
|
// Find server that is NOT carrying the first region
|
||||||
// Find server that is NOT carrying the first region
|
for (ServerName info : servers) {
|
||||||
for (ServerName info : servers) {
|
LOG.info("ServerName=" + info);
|
||||||
LOG.info("ServerName=" + info);
|
if (!serverNameForFirstRegion.equals(info.getServerName())) {
|
||||||
if (!serverNameForFirstRegion.equals(info.getServerName())) {
|
destName = info.toString();
|
||||||
destName = info.toString();
|
found = true;
|
||||||
found = true;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
assertTrue("Found server", found);
|
||||||
assertTrue("Found server", found);
|
LOG.info("Found " + destName);
|
||||||
LOG.info("Found " + destName);
|
master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
|
||||||
master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
|
firstGoodPair.getKey().getEncodedNameAsBytes(),Bytes.toBytes(destName)));
|
||||||
firstGoodPair.getKey().getEncodedNameAsBytes(),Bytes.toBytes(destName)));
|
assertTrue("Coprocessor should have been called on region move",
|
||||||
assertTrue("Coprocessor should have been called on region move",
|
cp.wasMoveCalled());
|
||||||
cp.wasMoveCalled());
|
|
||||||
|
// make sure balancer is on
|
||||||
// make sure balancer is on
|
master.balanceSwitch(true);
|
||||||
master.balanceSwitch(true);
|
assertTrue("Coprocessor should have been called on balance switch",
|
||||||
assertTrue("Coprocessor should have been called on balance switch",
|
cp.wasBalanceSwitchCalled());
|
||||||
cp.wasBalanceSwitchCalled());
|
|
||||||
|
// turn balancer off
|
||||||
// force region rebalancing
|
master.balanceSwitch(false);
|
||||||
master.balanceSwitch(false);
|
|
||||||
// move half the open regions from RS 0 to RS 1
|
// wait for assignments to finish, if any
|
||||||
HRegionServer rs = cluster.getRegionServer(0);
|
AssignmentManager mgr = master.getAssignmentManager();
|
||||||
byte[] destRS = Bytes.toBytes(cluster.getRegionServer(1).getServerName().toString());
|
Collection<AssignmentManager.RegionState> transRegions =
|
||||||
List<HRegionInfo> openRegions = ProtobufUtil.getOnlineRegions(rs);
|
mgr.copyRegionsInTransition().values();
|
||||||
int moveCnt = openRegions.size()/2;
|
for (AssignmentManager.RegionState state : transRegions) {
|
||||||
for (int i=0; i<moveCnt; i++) {
|
mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
|
||||||
HRegionInfo info = openRegions.get(i);
|
|
||||||
if (!info.isMetaTable()) {
|
|
||||||
master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
|
|
||||||
openRegions.get(i).getEncodedNameAsBytes(), destRS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// move half the open regions from RS 0 to RS 1
|
||||||
|
HRegionServer rs = cluster.getRegionServer(0);
|
||||||
|
byte[] destRS = Bytes.toBytes(cluster.getRegionServer(1).getServerName().toString());
|
||||||
|
List<HRegionInfo> openRegions = ProtobufUtil.getOnlineRegions(rs);
|
||||||
|
int moveCnt = openRegions.size()/2;
|
||||||
|
for (int i=0; i<moveCnt; i++) {
|
||||||
|
HRegionInfo info = openRegions.get(i);
|
||||||
|
if (!info.isMetaTable()) {
|
||||||
|
master.moveRegion(null,RequestConverter.buildMoveRegionRequest(
|
||||||
|
openRegions.get(i).getEncodedNameAsBytes(), destRS));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for assignments to finish
|
||||||
|
transRegions = mgr.copyRegionsInTransition().values();
|
||||||
|
for (AssignmentManager.RegionState state : transRegions) {
|
||||||
|
mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
|
||||||
|
}
|
||||||
|
|
||||||
|
// now trigger a balance
|
||||||
|
master.balanceSwitch(true);
|
||||||
|
boolean balanceRun = master.balance();
|
||||||
|
assertTrue("Coprocessor should be called on region rebalancing",
|
||||||
|
cp.wasBalanceCalled());
|
||||||
|
table.close();
|
||||||
|
} finally {
|
||||||
|
UTIL.deleteTable(TEST_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for assignments to finish
|
|
||||||
AssignmentManager mgr = master.getAssignmentManager();
|
|
||||||
Collection<AssignmentManager.RegionState> transRegions =
|
|
||||||
mgr.copyRegionsInTransition().values();
|
|
||||||
for (AssignmentManager.RegionState state : transRegions) {
|
|
||||||
mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
|
|
||||||
}
|
|
||||||
|
|
||||||
// now trigger a balance
|
|
||||||
master.balanceSwitch(true);
|
|
||||||
boolean balanceRun = master.balance();
|
|
||||||
assertTrue("Coprocessor should be called on region rebalancing",
|
|
||||||
cp.wasBalanceCalled());
|
|
||||||
table.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@org.junit.Rule
|
@org.junit.Rule
|
||||||
|
|
|
@ -83,8 +83,7 @@ public class TestSplitLogManager {
|
||||||
private SplitLogManager slm;
|
private SplitLogManager slm;
|
||||||
private Configuration conf;
|
private Configuration conf;
|
||||||
|
|
||||||
private final static HBaseTestingUtility TEST_UTIL =
|
private static HBaseTestingUtility TEST_UTIL;
|
||||||
new HBaseTestingUtility();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional amount of time we wait for events to happen. Added where unit
|
* Additional amount of time we wait for events to happen. Added where unit
|
||||||
|
@ -115,6 +114,7 @@ public class TestSplitLogManager {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
|
TEST_UTIL = new HBaseTestingUtility();
|
||||||
TEST_UTIL.startMiniZKCluster();
|
TEST_UTIL.startMiniZKCluster();
|
||||||
conf = TEST_UTIL.getConfiguration();
|
conf = TEST_UTIL.getConfiguration();
|
||||||
// Use a different ZK wrapper instance for each tests.
|
// Use a different ZK wrapper instance for each tests.
|
||||||
|
@ -222,7 +222,6 @@ public class TestSplitLogManager {
|
||||||
conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
|
conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
|
||||||
to = to + 2 * 100;
|
to = to + 2 * 100;
|
||||||
|
|
||||||
|
|
||||||
slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
|
slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
|
||||||
slm.finishInitialization();
|
slm.finishInitialization();
|
||||||
waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, 100);
|
waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, 100);
|
||||||
|
@ -504,7 +503,12 @@ public class TestSplitLogManager {
|
||||||
@Test(timeout=45000)
|
@Test(timeout=45000)
|
||||||
public void testVanishingTaskZNode() throws Exception {
|
public void testVanishingTaskZNode() throws Exception {
|
||||||
LOG.info("testVanishingTaskZNode");
|
LOG.info("testVanishingTaskZNode");
|
||||||
|
|
||||||
|
int to = 1000;
|
||||||
|
conf.setInt("hbase.splitlog.manager.timeout", to);
|
||||||
|
conf.setInt("hbase.splitlog.manager.timeoutmonitor.period", 100);
|
||||||
conf.setInt("hbase.splitlog.manager.unassigned.timeout", 0);
|
conf.setInt("hbase.splitlog.manager.unassigned.timeout", 0);
|
||||||
|
|
||||||
slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
|
slm = new SplitLogManager(zkw, conf, stopper, DUMMY_MASTER, null);
|
||||||
slm.finishInitialization();
|
slm.finishInitialization();
|
||||||
FileSystem fs = TEST_UTIL.getTestFileSystem();
|
FileSystem fs = TEST_UTIL.getTestFileSystem();
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class TestEnvironmentEdgeManager {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testManageSingleton() {
|
public void testManageSingleton() {
|
||||||
|
EnvironmentEdgeManager.reset();
|
||||||
EnvironmentEdge edge = EnvironmentEdgeManager.getDelegate();
|
EnvironmentEdge edge = EnvironmentEdgeManager.getDelegate();
|
||||||
assertNotNull(edge);
|
assertNotNull(edge);
|
||||||
assertTrue(edge instanceof DefaultEnvironmentEdge);
|
assertTrue(edge instanceof DefaultEnvironmentEdge);
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class TestFSTableDescriptors {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAndUpdate() throws IOException {
|
public void testCreateAndUpdate() throws IOException {
|
||||||
Path testdir = UTIL.getDataTestDir();
|
Path testdir = UTIL.getDataTestDir("testCreateAndUpdate");
|
||||||
HTableDescriptor htd = new HTableDescriptor("testCreate");
|
HTableDescriptor htd = new HTableDescriptor("testCreate");
|
||||||
FileSystem fs = FileSystem.get(UTIL.getConfiguration());
|
FileSystem fs = FileSystem.get(UTIL.getConfiguration());
|
||||||
assertTrue(FSTableDescriptors.createTableDescriptor(fs, testdir, htd));
|
assertTrue(FSTableDescriptors.createTableDescriptor(fs, testdir, htd));
|
||||||
|
|
Loading…
Reference in New Issue