diff --git a/CHANGES.txt b/CHANGES.txt index 04fa3d04548..5d2d6d48ecb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) diff --git a/src/java/org/apache/hadoop/hbase/HMerge.java b/src/java/org/apache/hadoop/hbase/HMerge.java index 2e0cc8bd1e1..f8036528110 100644 --- a/src/java/org/apache/hadoop/hbase/HMerge.java +++ b/src/java/org/apache/hadoop/hbase/HMerge.java @@ -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( diff --git a/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java index f98f23d2ecf..27ca0d6ad4c 100644 --- a/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java +++ b/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java @@ -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)); } diff --git a/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java b/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java index 0c2a7e58b67..b203291a95b 100644 --- a/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java +++ b/src/java/org/apache/hadoop/hbase/client/HConnectionManager.java @@ -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); + } } } } diff --git a/src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java b/src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java index 2e3f451f247..2faed049311 100644 --- a/src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java +++ b/src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java @@ -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(); diff --git a/src/test/org/apache/hadoop/hbase/util/DisabledTestMetaUtils.java b/src/test/org/apache/hadoop/hbase/util/DisabledTestMetaUtils.java index 2857745dd3b..7bf8efbe5f7 100644 --- a/src/test/org/apache/hadoop/hbase/util/DisabledTestMetaUtils.java +++ b/src/test/org/apache/hadoop/hbase/util/DisabledTestMetaUtils.java @@ -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. diff --git a/src/test/org/apache/hadoop/hbase/util/TestMigrate.java b/src/test/org/apache/hadoop/hbase/util/TestMigrate.java index a4de9d178d6..2d09c2946c2 100644 --- a/src/test/org/apache/hadoop/hbase/util/TestMigrate.java +++ b/src/test/org/apache/hadoop/hbase/util/TestMigrate.java @@ -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(); } }