From cbbe6952a2827595fbdc1dc20d444634777edcbd Mon Sep 17 00:00:00 2001 From: Balazs Meszaros Date: Tue, 31 Jan 2017 10:54:57 -0800 Subject: [PATCH] HBASE-3462 Fix table.jsp in regards to splitting a region/table with an optional splitkey Now compact/split requires row keys instead of region names (as UI suggests). --- .../src/main/resources/hbase-webapps/master/table.jsp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp index 6e23f00..493784c 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -175,7 +175,7 @@ if ( fqtn != null ) { try (Admin admin = master.getConnection().getAdmin()) { if (action.equals("split")) { if (key != null && key.length() > 0) { - admin.splitRegion(Bytes.toBytes(key)); + admin.split(TableName.valueOf(fqtn), Bytes.toBytes(key)); } else { admin.split(TableName.valueOf(fqtn)); } @@ -183,7 +183,14 @@ if ( fqtn != null ) { %> Split request accepted. <% } else if (action.equals("compact")) { if (key != null && key.length() > 0) { - admin.compactRegion(Bytes.toBytes(key)); + List regions = admin.getTableRegions(TableName.valueOf(fqtn)); + byte[] row = Bytes.toBytes(key); + + for (HRegionInfo region : regions) { + if (region.containsRow(row)) { + admin.compactRegion(region.getRegionName()); + } + } } else { admin.compact(TableName.valueOf(fqtn)); } @@ -718,7 +725,7 @@ Actions:   - Region Key (optional): + Row Key (optional): This action will force a compaction of all regions of the table, or, if a key is supplied, only the region containing the given key. @@ -732,7 +739,7 @@ Actions:   - Region Key (optional): + Row Key (optional): This action will force a split of all eligible regions of the table, or, if a key is supplied, only the region containing the given key. An eligible region is one that does not contain any references to -- 2.10.1 (Apple Git-78)