From 5bb47254940bf88ce311c43819402eded565b958 Mon Sep 17 00:00:00 2001 From: Lars George Date: Thu, 3 Feb 2011 11:49:02 +0000 Subject: [PATCH] HBASE-3495 Shell is failing on subsequent split calls git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1066787 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../hadoop/hbase/client/HBaseAdmin.java | 49 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6eeabc601b5..56c88e45eca 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -39,6 +39,7 @@ Release 0.91.0 - Unreleased HBASE-3416 For intra-row scanning, the update readers notification resets the query matcher and can lead to incorrect behavior HBASE-3492 NPE while splitting table with empty column family store + HBASE-3495 Shell is failing on subsequent split calls IMPROVEMENTS diff --git a/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java index dc1417606b5..82993a7b301 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java +++ b/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java @@ -53,10 +53,10 @@ import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.ipc.RemoteException; /** - * Provides an interface to manage HBase database table metadata + general - * administrative functions. Use HBaseAdmin to create, drop, list, enable and - * disable tables. Use it also to add and drop table column families. - * + * Provides an interface to manage HBase database table metadata + general + * administrative functions. Use HBaseAdmin to create, drop, list, enable and + * disable tables. Use it also to add and drop table column families. + * *

See {@link HTable} to add, update, and delete data from an individual table. *

Currently HBaseAdmin instances are not expected to be long-lived. For * example, an HBaseAdmin instance will not ride over a Master restart. @@ -151,7 +151,7 @@ public class HBaseAdmin implements Abortable { /** * @param tableName Table to check. * @return True if table exists already. - * @throws IOException + * @throws IOException */ public boolean tableExists(final String tableName) throws IOException { @@ -168,7 +168,7 @@ public class HBaseAdmin implements Abortable { /** * @param tableName Table to check. * @return True if table exists already. - * @throws IOException + * @throws IOException */ public boolean tableExists(final byte [] tableName) throws IOException { @@ -451,7 +451,7 @@ public class HBaseAdmin implements Abortable { public void enableTable(final byte [] tableName) throws IOException { enableTableAsync(tableName); - + // Wait until all regions are enabled boolean enabled = false; for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) { @@ -818,7 +818,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table or region to flush * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void flush(final String tableNameOrRegionName) throws IOException, InterruptedException { @@ -831,7 +831,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table or region to flush * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void flush(final byte [] tableNameOrRegionName) throws IOException, InterruptedException { @@ -873,7 +873,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table or region to compact * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void compact(final String tableNameOrRegionName) throws IOException, InterruptedException { @@ -886,7 +886,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table or region to compact * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void compact(final byte [] tableNameOrRegionName) throws IOException, InterruptedException { @@ -899,7 +899,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table or region to major compact * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void majorCompact(final String tableNameOrRegionName) throws IOException, InterruptedException { @@ -912,7 +912,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table or region to major compact * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void majorCompact(final byte [] tableNameOrRegionName) throws IOException, InterruptedException { @@ -926,7 +926,7 @@ public class HBaseAdmin implements Abortable { * @param tableNameOrRegionName table or region to compact * @param major True if we are to do a major compaction. * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ private void compact(final byte [] tableNameOrRegionName, final boolean major) throws IOException, InterruptedException { @@ -974,8 +974,8 @@ public class HBaseAdmin implements Abortable { * host187.example.com,60020,1289493121758. * @throws UnknownRegionException Thrown if we can't find a region named * encodedRegionName - * @throws ZooKeeperConnectionException - * @throws MasterNotRunningException + * @throws ZooKeeperConnectionException + * @throws MasterNotRunningException */ public void move(final byte [] encodedRegionName, final byte [] destServerName) throws UnknownRegionException, MasterNotRunningException, ZooKeeperConnectionException { @@ -1039,7 +1039,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table or region to split * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void split(final String tableNameOrRegionName) throws IOException, InterruptedException { @@ -1052,7 +1052,7 @@ public class HBaseAdmin implements Abortable { * * @param tableNameOrRegionName table to region to split * @throws IOException if a remote or network exception occurs - * @throws InterruptedException + * @throws InterruptedException */ public void split(final byte [] tableNameOrRegionName) throws IOException, InterruptedException { @@ -1094,11 +1094,12 @@ public class HBaseAdmin implements Abortable { for (Pair pair: pairs) { // May not be a server for a particular row if (pair.getSecond() == null) continue; - if (splitPoint != null) { - // if a split point given, only split that particular region - HRegionInfo r = pair.getFirst(); - if (!r.containsRow(splitPoint)) continue; - } + HRegionInfo r = pair.getFirst(); + // check for parents + if (r.isSplitParent()) continue; + // if a split point given, only split that particular region + if (splitPoint != null && !r.containsRow(splitPoint)) continue; + // call out to region server to do split now split(pair.getSecond(), pair.getFirst(), splitPoint); } } @@ -1139,7 +1140,7 @@ public class HBaseAdmin implements Abortable { * @return True if tableNameOrRegionName is *possibly* a region * name else false if a verified tablename (we call {@link #tableExists(byte[])}; * else we throw an exception. - * @throws IOException + * @throws IOException */ private boolean isRegionName(final byte [] tableNameOrRegionName) throws IOException {