HBASE-874 deleting a table kills client rpc; no subsequent communication if shell or thrift server, etc. (Jonathan Gray via Jim Kellerman)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@692596 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2008-09-06 00:50:58 +00:00
parent 9553b1c946
commit 2e13c047ab
7 changed files with 22 additions and 27 deletions

View File

@ -76,6 +76,8 @@ Release 0.18.0 - Unreleased
HRegionServer (Jean-Daniel Cryans via Jim Kellerman)
HBASE-840 More options on the row query in REST interface
(Sishen Freecity via Stack)
HBASE-874 deleting a table kills client rpc; no subsequent communication if
shell or thrift server, etc. (Jonathan Gray via Jim Kellerman)
NEW FEATURES
HBASE-787 Postgresql to HBase table replication example (Tim Sell via Stack)

View File

@ -76,7 +76,7 @@ class HMerge implements HConstants {
throws IOException {
HConnection connection = HConnectionManager.getConnection(conf);
boolean masterIsRunning = connection.isMasterRunning();
HConnectionManager.deleteConnectionInfo(conf);
HConnectionManager.deleteConnectionInfo(conf, false);
if (Bytes.equals(tableName, META_TABLE_NAME)) {
if (masterIsRunning) {
throw new IllegalStateException(

View File

@ -267,7 +267,7 @@ public class HBaseAdmin {
}
}
// Delete cached information to prevent clients from using old locations
HConnectionManager.deleteConnectionInfo(conf);
HConnectionManager.deleteConnectionInfo(conf, false);
LOG.info("Deleted " + Bytes.toString(tableName));
}

View File

@ -95,29 +95,18 @@ public class HConnectionManager implements HConstants {
/**
* Delete connection information for the instance specified by the configuration
* @param conf
* @param stopProxy
*/
public static void deleteConnectionInfo(HBaseConfiguration conf) {
public static void deleteConnectionInfo(HBaseConfiguration conf,
boolean stopProxy) {
synchronized (HBASE_INSTANCES) {
TableServers t = HBASE_INSTANCES.remove(conf.get(HBASE_DIR));
if (t != null) {
t.close();
t.close(stopProxy);
}
}
}
/**
* Clear the static map of connection info.
*/
public static void deleteConnectionInfo() {
synchronized (HBASE_INSTANCES) {
for (TableServers t: HBASE_INSTANCES.values()) {
t.close();
}
HBASE_INSTANCES.clear();
}
}
/* Encapsulates finding the servers for an HBase instance */
private static class TableServers implements HConnection, HConstants {
private static final Log LOG = LogFactory.getLog(TableServers.class);
@ -894,15 +883,19 @@ public class HConnectionManager implements HConstants {
return null;
}
void close() {
void close(boolean stopProxy) {
if (master != null) {
HbaseRPC.stopProxy(master);
if (stopProxy) {
HbaseRPC.stopProxy(master);
}
master = null;
masterChecked = false;
}
synchronized (servers) {
for (HRegionInterface i: servers.values()) {
HbaseRPC.stopProxy(i);
if (stopProxy) {
synchronized (servers) {
for (HRegionInterface i: servers.values()) {
HbaseRPC.stopProxy(i);
}
}
}
}

View File

@ -145,7 +145,7 @@ public abstract class HBaseClusterTestCase extends HBaseTestCase {
protected void tearDown() throws Exception {
super.tearDown();
try {
HConnectionManager.deleteConnectionInfo(conf);
HConnectionManager.deleteConnectionInfo(conf, true);
if (this.cluster != null) {
try {
this.cluster.shutdown();

View File

@ -50,7 +50,7 @@ public class DisabledTestMetaUtils extends HBaseClusterTestCase {
utils.deleteColumn(editTable, Bytes.toBytes(oldColumn));
utils.shutdown();
// Delete again so we go get it all fresh.
HConnectionManager.deleteConnectionInfo();
HConnectionManager.deleteConnectionInfo(conf, false);
// Now assert columns were added and deleted.
this.cluster = new MiniHBaseCluster(this.conf, 1);
// Now assert columns were added and deleted.

View File

@ -134,7 +134,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.deleteConnectionInfo();
HConnectionManager.deleteConnectionInfo(conf, false);
LOG.info("Start a cluster against migrated FS");
// Up number of retries. Needed while cluster starts up. Its been set to 1
@ -159,7 +159,7 @@ public class TestMigrate extends HBaseTestCase {
"changes before opening a scanner");
waitOnStartCodeChange(retries);
// Delete again so we go get it all fresh.
HConnectionManager.deleteConnectionInfo();
HConnectionManager.deleteConnectionInfo(conf, false);
HTable t = new HTable(this.conf, TABLENAME);
int count = 0;
LOG.info("OPENING SCANNER");
@ -179,7 +179,7 @@ public class TestMigrate extends HBaseTestCase {
s.close();
}
} finally {
HConnectionManager.deleteConnectionInfo();
HConnectionManager.deleteConnectionInfo(conf, false);
cluster.shutdown();
}
}