You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2012/07/21 19:07:04 UTC

svn commit: r1364127 [3/3] - in /hbase/trunk/hbase-server/src/main: jamon/org/apache/hadoop/hbase/tmpl/master/ java/org/apache/hadoop/hbase/ java/org/apache/hadoop/hbase/client/ java/org/apache/hadoop/hbase/master/ java/org/apache/hadoop/hbase/protobuf...

Modified: hbase/trunk/hbase-server/src/main/protobuf/MasterAdmin.proto
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/protobuf/MasterAdmin.proto?rev=1364127&r1=1364126&r2=1364127&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/protobuf/MasterAdmin.proto (original)
+++ hbase/trunk/hbase-server/src/main/protobuf/MasterAdmin.proto Sat Jul 21 17:07:03 2012
@@ -154,6 +154,28 @@ message SetBalancerRunningResponse {
   optional bool prevBalanceValue = 1;
 }
 
+message CatalogScanRequest {
+}
+
+message CatalogScanResponse {
+  optional int32 scanResult = 1;
+}
+
+message EnableCatalogJanitorRequest {
+  required bool enable = 1;
+}
+
+message EnableCatalogJanitorResponse {
+  optional bool prevValue = 1;
+}
+
+message IsCatalogJanitorEnabledRequest {
+}
+
+message IsCatalogJanitorEnabledResponse {
+  required bool value = 1;
+}
+
 service MasterAdminService {
   /** Adds a column to the specified table. */
   rpc addColumn(AddColumnRequest)
@@ -236,4 +258,19 @@ service MasterAdminService {
   rpc setBalancerRunning(SetBalancerRunningRequest)
     returns(SetBalancerRunningResponse);
 
+  /** Get a run of the catalog janitor */
+  rpc runCatalogScan(CatalogScanRequest)
+     returns(CatalogScanResponse);
+
+  /**
+   * Enable the catalog janitor on or off.
+   */
+  rpc enableCatalogJanitor(EnableCatalogJanitorRequest)
+     returns(EnableCatalogJanitorResponse);
+
+  /**
+   * Query whether the catalog janitor is enabled.
+   */
+  rpc isCatalogJanitorEnabled(IsCatalogJanitorEnabledRequest)
+     returns(IsCatalogJanitorEnabledResponse);
 }

Modified: hbase/trunk/hbase-server/src/main/ruby/hbase/admin.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/hbase/admin.rb?rev=1364127&r1=1364126&r2=1364127&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/hbase/admin.rb (original)
+++ hbase/trunk/hbase-server/src/main/ruby/hbase/admin.rb Sat Jul 21 17:07:03 2012
@@ -93,6 +93,27 @@ module Hbase
     end
 
     #----------------------------------------------------------------------------------------------
+    # Request a scan of the catalog table (for garbage collection)
+    # Returns an int signifying the number of entries cleaned
+    def catalogjanitor_run()
+      @admin.runCatalogScan()
+    end
+
+    #----------------------------------------------------------------------------------------------
+    # Enable/disable the catalog janitor
+    # Returns previous catalog janitor switch setting.
+    def catalogjanitor_switch(enableDisable)
+      @admin.enableCatalogJanitor(java.lang.Boolean::valueOf(enableDisable))
+    end
+
+    #----------------------------------------------------------------------------------------------
+    # Query on the catalog janitor state (enabled/disabled?)
+    # Returns catalog janitor state (true signifies enabled).
+    def catalogjanitor_enabled()
+      @admin.isCatalogJanitorEnabled()
+    end
+
+    #----------------------------------------------------------------------------------------------
     # Enables a table
     def enable(table_name)
       tableExists(table_name)

Modified: hbase/trunk/hbase-server/src/main/ruby/shell.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell.rb?rev=1364127&r1=1364126&r2=1364127&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell.rb (original)
+++ hbase/trunk/hbase-server/src/main/ruby/shell.rb Sat Jul 21 17:07:03 2012
@@ -287,6 +287,9 @@ Shell.load_command_group(
     unassign
     zk_dump
     hlog_roll
+    catalogjanitor_run
+    catalogjanitor_switch
+    catalogjanitor_enabled
   ]
 )
 

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_enabled.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_enabled.rb?rev=1364127&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_enabled.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_enabled.rb Sat Jul 21 17:07:03 2012
@@ -0,0 +1,40 @@
+#
+# 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 CatalogjanitorEnabled < Command
+      def help
+        return <<-EOF
+Query for the CatalogJanitor state (enabled/disabled?)
+Examples:
+
+  hbase> catalogjanitor_enabled
+EOF
+      end
+
+      def command()
+        format_simple_command do
+          formatter.row([
+            admin.catalogjanitor_enabled()? "true" : "false"
+          ])
+        end
+      end
+    end
+  end
+end

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_run.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_run.rb?rev=1364127&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_run.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_run.rb Sat Jul 21 17:07:03 2012
@@ -0,0 +1,37 @@
+#
+# 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 CatalogjanitorRun < Command
+      def help
+        return <<-EOF
+Catalog janitor command to run the (garbage collection) scan from command line.
+
+  hbase> catalogjanitor_run
+
+EOF
+      end
+      def command()
+        format_simple_command do
+          admin.catalogjanitor_run()
+        end
+      end
+    end
+  end
+end

Added: hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_switch.rb
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_switch.rb?rev=1364127&view=auto
==============================================================================
--- hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_switch.rb (added)
+++ hbase/trunk/hbase-server/src/main/ruby/shell/commands/catalogjanitor_switch.rb Sat Jul 21 17:07:03 2012
@@ -0,0 +1,41 @@
+#
+# 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 CatalogjanitorSwitch < Command
+      def help
+        return <<-EOF
+Enable/Disable CatalogJanitor. Returns previous CatalogJanitor state.
+Examples:
+
+  hbase> catalogjanitor_switch true
+  hbase> catalogjanitor_switch false
+EOF
+      end
+
+      def command(enableDisable)
+        format_simple_command do
+          formatter.row([
+            admin.catalogjanitor_switch(enableDisable)? "true" : "false"
+          ])
+        end
+      end
+    end
+  end
+end