Index: src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 1137256) +++ src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (working copy) @@ -755,21 +755,23 @@ * Close a region. For expert-admins Runs close on the regionserver. The * master will not be informed of the close. * @param regionname region name to close - * @param hostAndPort If supplied, we'll use this location rather than - * the one currently in .META. + * @param serverName The servername of the regionserver. If passed null we + * will use servername found in the .META. table. A server name + * is made of host, port and startcode. Here is an example: + * host187.example.com,60020,1289493121758 * @throws IOException if a remote or network exception occurs */ - public void closeRegion(final byte [] regionname, final String hostAndPort) + public void closeRegion(final byte [] regionname, final String serverName) throws IOException { CatalogTracker ct = getCatalogTracker(); try { - if (hostAndPort != null) { + if (serverName != null) { Pair pair = MetaReader.getRegion(ct, regionname); - if (pair == null || pair.getSecond() == null) { - LOG.info("No server in .META. for " + + if (pair == null || pair.getFirst() == null) { + LOG.info("No region in .META. for " + Bytes.toStringBinary(regionname) + "; pair=" + pair); } else { - closeRegion(pair.getSecond(), pair.getFirst()); + closeRegion(new ServerName(serverName), pair.getFirst()); } } else { Pair pair = MetaReader.getRegion(ct, regionname); Index: src/main/ruby/hbase/admin.rb =================================================================== --- src/main/ruby/hbase/admin.rb (revision 1137257) +++ src/main/ruby/hbase/admin.rb (working copy) @@ -189,7 +189,7 @@ #---------------------------------------------------------------------------------------------- # Closes a region def close_region(region_name, server = nil) - @admin.closeRegion(region_name, server ? [server].to_java : nil) + @admin.closeRegion(region_name, server) end #---------------------------------------------------------------------------------------------- Index: src/main/ruby/shell/commands/close_region.rb =================================================================== --- src/main/ruby/shell/commands/close_region.rb (revision 1137256) +++ src/main/ruby/shell/commands/close_region.rb (working copy) @@ -23,15 +23,17 @@ class CloseRegion < Command def help return <<-EOF -Close a single region. Optionally specify regionserver. Connects to the -regionserver and runs close on hosting regionserver. The close is done -without the master's involvement (It will not know of the close). Once -closed, region will stay closed. Use assign to reopen/reassign. Use -unassign or move to assign the region elsewhere on cluster. Use with -caution. For experts only. Examples: +Close a single region. Optionally specify regionserver 'servername' where +A server name is its host, port plus startcode. For example: +host187.example.com,60020,1289493121758 (find servername in master ui or +when you do detailed status in shell). Connects to the regionserver and +runs close on hosting regionserver. The close is done without the master's +involvement (It will not know of the close). Once closed, region will stay +closed. Use assign to reopen/reassign. Use unassign or move to assign the +region elsewhere on cluster. Use with caution. For experts only. Examples: hbase> close_region 'REGIONNAME' - hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT' + hbase> close_region 'REGIONNAME', 'SERVER_NAME' EOF end