HBASE-699 Fix TestMigrate up on Hudson
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@669392 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b01f2f1c87
commit
b3437875a6
|
@ -60,6 +60,7 @@ Hbase Change Log
|
|||
HBASE-652 dropping table fails silently if table isn't disabled
|
||||
HBASE-683 can not get svn revision # at build time if locale is not english
|
||||
(Rong-En Fan via Stack)
|
||||
HBASE-699 Fix TestMigrate up on Hudson
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-559 MR example job to count table rows
|
||||
|
|
|
@ -76,7 +76,7 @@ class HMerge implements HConstants {
|
|||
throws IOException {
|
||||
HConnection connection = HConnectionManager.getConnection(conf);
|
||||
boolean masterIsRunning = connection.isMasterRunning();
|
||||
HConnectionManager.deleteConnection(conf);
|
||||
HConnectionManager.deleteConnectionInfo(conf);
|
||||
if (Bytes.equals(tableName, META_TABLE_NAME)) {
|
||||
if (masterIsRunning) {
|
||||
throw new IllegalStateException(
|
||||
|
|
|
@ -97,11 +97,21 @@ public class HConnectionManager implements HConstants {
|
|||
* Delete connection information for the instance specified by the configuration
|
||||
* @param conf
|
||||
*/
|
||||
public static void deleteConnection(HBaseConfiguration conf) {
|
||||
public static void deleteConnectionInfo(HBaseConfiguration conf) {
|
||||
synchronized (HBASE_INSTANCES) {
|
||||
HBASE_INSTANCES.remove(conf.get(HBASE_DIR));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the static map of connection info.
|
||||
*/
|
||||
public static void deleteConnectionInfo() {
|
||||
synchronized (HBASE_INSTANCES) {
|
||||
HBASE_INSTANCES.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Encapsulates finding the servers for an HBase instance */
|
||||
private static class TableServers implements HConnection, HConstants {
|
||||
|
|
|
@ -332,7 +332,12 @@ public class HTable {
|
|||
public byte [] getTableName() {
|
||||
return this.tableName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used by unit tests and tools to do low-level manipulations. Not for
|
||||
* general use.
|
||||
* @return An HConnection instance.
|
||||
*/
|
||||
public HConnection getConnection() {
|
||||
return this.connection;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public abstract class HBaseClusterTestCase extends HBaseTestCase {
|
|||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
try {
|
||||
HConnectionManager.deleteConnection(conf);
|
||||
HConnectionManager.deleteConnectionInfo(conf);
|
||||
if (this.cluster != null) {
|
||||
try {
|
||||
this.cluster.shutdown();
|
||||
|
|
|
@ -129,7 +129,7 @@ public class TestMigrate extends HBaseTestCase {
|
|||
// Delete any cached connections. Need to do this because connection was
|
||||
// created earlier when no master was around. The fact that there was no
|
||||
// master gets cached. Need to delete so we go get master afresh.
|
||||
HConnectionManager.deleteConnection(this.conf);
|
||||
HConnectionManager.deleteConnectionInfo();
|
||||
|
||||
LOG.info("Start a cluster against migrated FS");
|
||||
// Up number of retries. Needed while cluster starts up. Its been set to 1
|
||||
|
@ -153,10 +153,9 @@ public class TestMigrate extends HBaseTestCase {
|
|||
LOG.info(TABLENAME + " exists. Now waiting till startcode " +
|
||||
"changes before opening a scanner");
|
||||
waitOnStartCodeChange(retries);
|
||||
// Delete again so we go get it all fresh.
|
||||
HConnectionManager.deleteConnectionInfo();
|
||||
HTable t = new HTable(this.conf, TABLENAME);
|
||||
// Force client to relocate the region now the start code has changed
|
||||
t.getConnection().relocateRegion(Bytes.toBytes(TABLENAME),
|
||||
HConstants.EMPTY_BYTE_ARRAY);
|
||||
int count = 0;
|
||||
LOG.info("OPENING SCANNER");
|
||||
Scanner s = t.getScanner(TABLENAME_COLUMNS);
|
||||
|
@ -175,6 +174,7 @@ public class TestMigrate extends HBaseTestCase {
|
|||
s.close();
|
||||
}
|
||||
} finally {
|
||||
HConnectionManager.deleteConnectionInfo();
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue