hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1040243 - in /hbase/trunk: ./ src/main/java/org/apache/hadoop/hbase/client/ src/main/java/org/apache/hadoop/hbase/ipc/ src/main/java/org/apache/hadoop/hbase/master/ src/main/ruby/ src/main/ruby/hbase/ src/main/ruby/shell/commands/
Date Mon, 29 Nov 2010 19:41:03 GMT
Author: stack
Date: Mon Nov 29 19:41:02 2010
New Revision: 1040243

URL: http://svn.apache.org/viewvc?rev=1040243&view=rev
Log:
HBASE-3267 close_region shell command breaks region

Added:
    hbase/trunk/src/main/ruby/shell/commands/assign.rb
    hbase/trunk/src/main/ruby/shell/commands/balance_switch.rb
    hbase/trunk/src/main/ruby/shell/commands/balancer.rb
    hbase/trunk/src/main/ruby/shell/commands/move.rb
    hbase/trunk/src/main/ruby/shell/commands/unassign.rb
Removed:
    hbase/trunk/src/main/ruby/shell/commands/disable_region.rb
    hbase/trunk/src/main/ruby/shell/commands/enable_region.rb
    hbase/trunk/src/main/ruby/shell/commands/zk.rb
Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HMasterInterface.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
    hbase/trunk/src/main/ruby/hbase/admin.rb
    hbase/trunk/src/main/ruby/shell.rb
    hbase/trunk/src/main/ruby/shell/commands/close_region.rb

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Mon Nov 29 19:41:02 2010
@@ -714,6 +714,7 @@ Release 0.90.0 - Unreleased
    HBASE-3275  [rest] No gzip/deflate content encoding support
    HBASE-3261  NPE out of HRS.run at startup when clock is out of sync
    HBASE-3277  HBase Shell zk_dump command broken
+   HBASE-3267  close_region shell command breaks region
 
 
   IMPROVEMENTS

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Mon Nov 29 19:41:02
2010
@@ -751,7 +751,8 @@ public class HBaseAdmin implements Abort
   }
 
   /**
-   * Close a region. For expert-admins.
+   * 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 <code>.META.</code>
@@ -763,7 +764,8 @@ public class HBaseAdmin implements Abort
   }
 
   /**
-   * Close a region.  For expert-admins.
+   * 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 <code>.META.</code>
@@ -801,7 +803,8 @@ public class HBaseAdmin implements Abort
   private void closeRegion(final HServerAddress hsa, final HRegionInfo hri)
   throws IOException {
     HRegionInterface rs = this.connection.getHRegionConnection(hsa);
-    rs.closeRegion(hri);
+    // Close the region without updating zk state.
+    rs.closeRegion(hri, false);
   }
 
   /**
@@ -956,8 +959,14 @@ public class HBaseAdmin implements Abort
 
   /**
    * Move the region <code>r</code> to <code>dest</code>.
-   * @param encodedRegionName The encoded region name.
-   * @param destServerName The servername of the destination regionserver
+   * @param encodedRegionName The encoded region name; i.e. the hash that makes
+   * up the region name suffix: e.g. if regionname is
+   * <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
+   * then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
+   * @param destServerName The servername of the destination regionserver.  If
+   * passed the empty byte array we'll assign to a random server.  A server name
+   * is made of host, port and startcode.  Here is an example:
+   * <code> host187.example.com,60020,1289493121758</code>.
    * @throws UnknownRegionException Thrown if we can't find a region named
    * <code>encodedRegionName</code>
    * @throws ZooKeeperConnectionException 
@@ -969,6 +978,36 @@ public class HBaseAdmin implements Abort
   }
 
   /**
+   * @param regionName Region name to assign.
+   * @param force True to force assign.
+   * @throws MasterNotRunningException
+   * @throws ZooKeeperConnectionException
+   * @throws IOException
+   */
+  public void assign(final byte [] regionName, final boolean force)
+  throws MasterNotRunningException, ZooKeeperConnectionException, IOException {
+    getMaster().assign(regionName, force);
+  }
+
+  /**
+   * Unassign a region from current hosting regionserver.  Region will then be
+   * assigned to a regionserver chosen at random.  Region could be reassigned
+   * back to the same server.  Use {@link #move(byte[], byte[])} if you want
+   * to control the region movement.
+   * @param regionName Region to unassign. Will clear any existing RegionPlan
+   * if one found.
+   * @param force If true, force unassign (Will remove region from
+   * regions-in-transition too if present).
+   * @throws MasterNotRunningException
+   * @throws ZooKeeperConnectionException
+   * @throws IOException
+   */
+  public void unassign(final byte [] regionName, final boolean force)
+  throws MasterNotRunningException, ZooKeeperConnectionException, IOException {
+    getMaster().unassign(regionName, force);
+  }
+
+  /**
    * Turn the load balancer on or off.
    * @param b If true, enable balancer. If false, disable balancer.
    * @return Previous balancer value

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HMasterInterface.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HMasterInterface.java?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HMasterInterface.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HMasterInterface.java Mon Nov 29
19:41:02 2010
@@ -135,8 +135,14 @@ public interface HMasterInterface extend
 
   /**
    * Move the region <code>r</code> to <code>dest</code>.
-   * @param encodedRegionName The encoded region name.
-   * @param destServerName The servername of the destination regionserver
+   * @param encodedRegionName The encoded region name; i.e. the hash that makes
+   * up the region name suffix: e.g. if regionname is
+   * <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
+   * then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
+   * @param destServerName The servername of the destination regionserver.  If
+   * passed the empty byte array we'll assign to a random server.  A server name
+   * is made of host, port and startcode.  Here is an example:
+   * <code> host187.example.com,60020,1289493121758</code>.
    * @throws UnknownRegionException Thrown if we can't find a region named
    * <code>encodedRegionName</code>
    */
@@ -144,6 +150,30 @@ public interface HMasterInterface extend
   throws UnknownRegionException;
 
   /**
+   * Assign a region to a server chosen at random.
+   * @param regionName Region to assign.  Will use existing RegionPlan if one
+   * found.
+   * @param force If true, will force the assignment.
+   * @throws IOException
+   */
+  public void assign(final byte [] regionName, final boolean force)
+  throws IOException;
+
+  /**
+   * Unassign a region from current hosting regionserver.  Region will then be
+   * assigned to a regionserver chosen at random.  Region could be reassigned
+   * back to the same server.  Use {@link #move(byte[], byte[])} if you want
+   * to control the region movement.
+   * @param regionName Region to unassign. Will clear any existing RegionPlan
+   * if one found.
+   * @param force If true, force unassign (Will remove region from
+   * regions-in-transition too if present).
+   * @throws IOException
+   */
+  public void unassign(final byte [] regionName, final boolean force)
+  throws IOException;
+
+  /**
    * Run the balancer.  Will run the balancer and if regions to move, it will
    * go ahead and do the reassignments.  Can NOT run for various reasons.  Check
    * logs.

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java Mon Nov
29 19:41:02 2010
@@ -1360,9 +1360,7 @@ public class AssignmentManager extends Z
     synchronized (this.regions) {
       this.regions.remove(hri);
     }
-    synchronized (this.regionPlans) {
-      this.regionPlans.remove(hri.getEncodedName());
-    }
+    clearRegionPlan(hri.getEncodedName());
     synchronized (this.servers) {
       for (List<HRegionInfo> regions : this.servers.values()) {
         for (int i=0;i<regions.size();i++) {
@@ -1376,6 +1374,15 @@ public class AssignmentManager extends Z
   }
 
   /**
+   * @param encodedRegionName Region whose plan we are to clear.
+   */
+  void clearRegionPlan(final String encodedRegionName) {
+    synchronized (this.regionPlans) {
+      this.regionPlans.remove(encodedRegionName);
+    }
+  }
+
+  /**
    * Wait on region to clear regions-in-transition.
    * @param hri Region to wait on.
    * @throws IOException

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Mon Nov 29 19:41:02
2010
@@ -703,10 +703,19 @@ implements HMasterInterface, HMasterRegi
       this.assignmentManager.getAssignment(encodedRegionName);
     if (p == null)
       throw new UnknownRegionException(Bytes.toString(encodedRegionName));
-    HServerInfo dest =
-      this.serverManager.getServerInfo(new String(destServerName));
-    RegionPlan rp = new RegionPlan(p.getFirst(), p.getSecond(), dest);
-    this.assignmentManager.balance(rp);
+    HRegionInfo hri = p.getFirst();
+    HServerInfo dest = null;
+    if (destServerName == null || destServerName.length == 0) {
+      LOG.info("Passed destination servername is null/empty so " +
+        "choosing a server at random");
+      this.assignmentManager.clearRegionPlan(hri.getEncodedName());
+      // Unassign will reassign it elsewhere choosing random server.
+      this.assignmentManager.unassign(hri);
+    } else {
+      dest = this.serverManager.getServerInfo(new String(destServerName));
+      RegionPlan rp = new RegionPlan(p.getFirst(), p.getSecond(), dest);
+      this.assignmentManager.balance(rp);
+    }
   }
 
   public void createTable(HTableDescriptor desc, byte [][] splitKeys)
@@ -979,10 +988,30 @@ implements HMasterInterface, HMasterRegi
     return isInitialized;
   }
 
+  @Override
+  public void assign(final byte [] regionName, final boolean force)
+  throws IOException {
+    Pair<HRegionInfo, HServerAddress> pair =
+      MetaReader.getRegion(this.catalogTracker, regionName);
+    if (pair == null) throw new UnknownRegionException(Bytes.toString(regionName));
+    assignRegion(pair.getFirst());
+  }
+
   public void assignRegion(HRegionInfo hri) {
     assignmentManager.assign(hri, true);
   }
 
+  @Override
+  public void unassign(final byte [] regionName, final boolean force)
+  throws IOException {
+    Pair<HRegionInfo, HServerAddress> pair =
+      MetaReader.getRegion(this.catalogTracker, regionName);
+    if (pair == null) throw new UnknownRegionException(Bytes.toString(regionName));
+    HRegionInfo hri = pair.getFirst();
+    if (force) this.assignmentManager.clearRegionFromTransition(hri);
+    this.assignmentManager.unassign(hri, force);
+  }
+
   /**
    * Utility for constructing an instance of the passed HMaster class.
    * @param masterClass

Modified: hbase/trunk/src/main/ruby/hbase/admin.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/hbase/admin.rb?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/hbase/admin.rb (original)
+++ hbase/trunk/src/main/ruby/hbase/admin.rb Mon Nov 29 19:41:02 2010
@@ -25,6 +25,7 @@ java_import org.apache.zookeeper.ZooKeep
 java_import org.apache.hadoop.hbase.HColumnDescriptor
 java_import org.apache.hadoop.hbase.HTableDescriptor
 java_import org.apache.hadoop.hbase.HRegionInfo
+java_import org.apache.hadoop.hbase.util.Bytes
 java_import org.apache.zookeeper.ZooKeeper
 
 # Wrapper for org.apache.hadoop.hbase.client.HBaseAdmin
@@ -73,6 +74,20 @@ module Hbase
     end
 
     #----------------------------------------------------------------------------------------------
+    # Requests a cluster balance
+    # Returns true if balancer ran
+    def balancer()
+      @admin.balancer()
+    end
+
+    #----------------------------------------------------------------------------------------------
+    # Enable/disable balancer
+    # Returns previous balancer switch setting.
+    def balance_switch(enableDisable)
+      @admin.balanceSwitch(java.lang.Boolean::valueOf(enableDisable))
+    end
+
+    #----------------------------------------------------------------------------------------------
     # Enables a table
     def enable(table_name)
       return if enabled?(table_name)
@@ -150,15 +165,21 @@ module Hbase
     end
 
     #----------------------------------------------------------------------------------------------
-    # Enables a region
-    def enable_region(region_name)
-      online(region_name, false)
+    # Assign a region
+    def assign(region_name, force)
+      @admin.assign(Bytes::toBytes(region_name), java.lang.Boolean::valueOf(force))
     end
 
     #----------------------------------------------------------------------------------------------
-    # Disables a region
-    def disable_region(region_name)
-      online(region_name, true)
+    # Unassign a region
+    def unassign(region_name, force)
+      @admin.unassign(Bytes::toBytes(region_name), java.lang.Boolean::valueOf(force))
+    end
+
+    #----------------------------------------------------------------------------------------------
+    # Move a region
+    def move(encoded_region_name, server = nil)
+      @admin.move(encoded_region_name, server ? [server].to_java: nil)
     end
 
     #----------------------------------------------------------------------------------------------
@@ -364,12 +385,5 @@ module Hbase
       put.add(HConstants::CATALOG_FAMILY, HConstants::REGIONINFO_QUALIFIER, Writables.getBytes(hri))
       meta.put(put)
     end
-    #----------------------------------------------------------------------------------------------
-    # Invoke a ZooKeeper maintenance command
-    def zk(args)
-      line = args.join(' ')
-      line = 'help' if line.empty?
-      @zk_main.executeLine(line)
-    end
   end
 end

Modified: hbase/trunk/src/main/ruby/shell.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell.rb?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/shell.rb (original)
+++ hbase/trunk/src/main/ruby/shell.rb Mon Nov 29 19:41:02 2010
@@ -248,14 +248,16 @@ Shell.load_command_group(
   :full_name => 'HBASE SURGERY TOOLS',
   :comment => "WARNING: Above commands are for 'experts'-only as misuse can damage an
install",
   :commands => %w[
+    assign
+    balancer
+    balance_switch
     close_region
     compact
-    disable_region
-    enable_region
     flush
     major_compact
+    move
     split
-    zk
+    unassign
     zk_dump
   ]
 )

Added: hbase/trunk/src/main/ruby/shell/commands/assign.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/assign.rb?rev=1040243&view=auto
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/assign.rb (added)
+++ hbase/trunk/src/main/ruby/shell/commands/assign.rb Mon Nov 29 19:41:02 2010
@@ -0,0 +1,39 @@
+#
+# Copyright 2010 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module Shell
+  module Commands
+    class Assign < Command
+      def help
+        return <<-EOF
+Assign a region.  Add 'true' to force assign of a region. Use with caution.
+If region already assigned, this command will just go ahead and reassign
+the region anyways. For experts only.
+EOF
+      end
+
+      def command(region_name, force = 'false')
+        format_simple_command do
+          admin.assign(region_name, force)
+        end
+      end
+    end
+  end
+end

Added: hbase/trunk/src/main/ruby/shell/commands/balance_switch.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/balance_switch.rb?rev=1040243&view=auto
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/balance_switch.rb (added)
+++ hbase/trunk/src/main/ruby/shell/commands/balance_switch.rb Mon Nov 29 19:41:02 2010
@@ -0,0 +1,39 @@
+#
+# Copyright 2010 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module Shell
+  module Commands
+    class BalanceSwitch < Command
+      def help
+        return <<-EOF
+Enable/Disable balancer. Returns previous balancer state.
+EOF
+      end
+
+      def command(enableDisable)
+        format_simple_command do
+          formatter.row([
+            admin.balance_switch(enableDisable)? "true" : "false"
+          ])
+        end
+      end
+    end
+  end
+end

Added: hbase/trunk/src/main/ruby/shell/commands/balancer.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/balancer.rb?rev=1040243&view=auto
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/balancer.rb (added)
+++ hbase/trunk/src/main/ruby/shell/commands/balancer.rb Mon Nov 29 19:41:02 2010
@@ -0,0 +1,40 @@
+#
+# Copyright 2010 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module Shell
+  module Commands
+    class Balancer < Command
+      def help
+        return <<-EOF
+Trigger the cluster balancer. Returns true if balancer ran.  Otherwise
+false (Will not run if regions in transition).
+EOF
+      end
+
+      def command()
+        format_simple_command do
+          formatter.row([
+            admin.balancer()? "true": "false"
+          ])
+        end
+      end
+    end
+  end
+end

Modified: hbase/trunk/src/main/ruby/shell/commands/close_region.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/close_region.rb?rev=1040243&r1=1040242&r2=1040243&view=diff
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/close_region.rb (original)
+++ hbase/trunk/src/main/ruby/shell/commands/close_region.rb Mon Nov 29 19:41:02 2010
@@ -23,8 +23,12 @@ module Shell
     class CloseRegion < Command
       def help
         return <<-EOF
-Close a single region. Optionally specify regionserver.
-Examples:
+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:
 
   hbase> close_region 'REGIONNAME'
   hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT'

Added: hbase/trunk/src/main/ruby/shell/commands/move.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/move.rb?rev=1040243&view=auto
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/move.rb (added)
+++ hbase/trunk/src/main/ruby/shell/commands/move.rb Mon Nov 29 19:41:02 2010
@@ -0,0 +1,48 @@
+#
+# Copyright 2010 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module Shell
+  module Commands
+    class Move < Command
+      def help
+        return <<-EOF
+Move a region.  Optionally specify target regionserver else we choose one
+at random.  NOTE: You pass the encoded region name, not the region name so
+this command is a little different to the others.  The encoded region name
+is the hash suffix on region names: e.g. if the region name were
+TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396. then
+the encoded region name portion is 527db22f95c8a9e0116f0cc13c680396
+A server name is its host, port plus startcode. For example:
+host187.example.com,60020,1289493121758
+Examples:
+
+  hbase> move 'ENCODED_REGIONNAME'
+  hbase> move 'ENCODED_REGIONNAME', 'SERVER_NAME'
+EOF
+      end
+
+      def command(encoded_region_name, server_name = nil)
+        format_simple_command do
+          admin.move(encoded_region_name, server_name)
+        end
+      end
+    end
+  end
+end

Added: hbase/trunk/src/main/ruby/shell/commands/unassign.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/ruby/shell/commands/unassign.rb?rev=1040243&view=auto
==============================================================================
--- hbase/trunk/src/main/ruby/shell/commands/unassign.rb (added)
+++ hbase/trunk/src/main/ruby/shell/commands/unassign.rb Mon Nov 29 19:41:02 2010
@@ -0,0 +1,43 @@
+#
+# Copyright 2010 The Apache Software Foundation
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+module Shell
+  module Commands
+    class Unassign < Command
+      def help
+        return <<-EOF
+Unassign a region. Unassign will close region in current location and then
+reopen it again.  Pass 'true' to force the unassignment ('force' will clear
+all in-memory state in master before the reassign).  Use with caution.  For
+expert use only.  Examples:
+
+  hbase> unassign 'REGIONNAME'
+  hbase> unassign 'REGIONNAME', true
+EOF
+      end
+
+      def command(region_name, force = 'false')
+        format_simple_command do
+          admin.unassign(region_name, force)
+        end
+      end
+    end
+  end
+end



Mime
View raw message