From 619d58f9b5aa6f2d24e5ab8166cddec16a4c1b4b Mon Sep 17 00:00:00 2001 From: stack Date: Tue, 10 Mar 2015 14:15:33 -0700 Subject: [PATCH] HBASE-13114 [UNITTEST] TestEnableTableHandler.testDeleteForSureClearsAllTableRowsFromMeta --- .../hbase/master/handler/DeleteTableHandler.java | 3 +++ .../hbase/master/handler/TestEnableTableHandler.java | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java index 93dcc84b48b..e5ea91f7d09 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/DeleteTableHandler.java @@ -154,6 +154,9 @@ public class DeleteTableHandler extends TableEventHandler { if (!deletes.isEmpty()) { LOG.warn("Deleting some vestigal " + deletes.size() + " rows of " + this.tableName + " from " + TableName.META_TABLE_NAME); + if (LOG.isDebugEnabled()) { + for (Delete d: deletes) LOG.debug("Purging " + d); + } metaTable.delete(deletes); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java index 39b347d8265..5266975eb90 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java @@ -119,21 +119,20 @@ public class TestEnableTableHandler { public void testDeleteForSureClearsAllTableRowsFromMeta() throws IOException, InterruptedException { final TableName tableName = TableName.valueOf("testDeleteForSureClearsAllTableRowsFromMeta"); - final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); - final HMaster m = cluster.getMaster(); final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); final HTableDescriptor desc = new HTableDescriptor(tableName); desc.addFamily(new HColumnDescriptor(FAMILYNAME)); admin.createTable(desc, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE); // Now I have a nice table, mangle it by removing the HConstants.REGIONINFO_QUALIFIER_STR // content from a few of the rows. - Scan metaScannerForMyTable = MetaTableAccessor.getScanForTableName(tableName); try (Table metaTable = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME)) { - try (ResultScanner scanner = metaTable.getScanner(metaScannerForMyTable)) { + try (ResultScanner scanner = + metaTable.getScanner(MetaTableAccessor.getScanForTableName(tableName))) { for (Result result : scanner) { // Just delete one row. Delete d = new Delete(result.getRow()); d.addColumn(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER); + LOG.info("Mangled: " + d); metaTable.delete(d); break; } @@ -143,8 +142,10 @@ public class TestEnableTableHandler { // Presume this synchronous all is. admin.deleteTable(tableName); int rowCount = 0; - try (ResultScanner scanner = metaTable.getScanner(metaScannerForMyTable)) { + try (ResultScanner scanner = + metaTable.getScanner(MetaTableAccessor.getScanForTableName(tableName))) { for (Result result : scanner) { + LOG.info("Found when none expected: " + result); rowCount++; } }