hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r708966 - in /hadoop/hbase/trunk: CHANGES.txt bin/HBase.rb bin/hirb.rb
Date Wed, 29 Oct 2008 18:01:35 GMT
Author: stack
Date: Wed Oct 29 11:01:35 2008
New Revision: 708966

URL: http://svn.apache.org/viewvc?rev=708966&view=rev
Log:
HBASE-817   Hbase/Shell Truncate

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/bin/HBase.rb
    hadoop/hbase/trunk/bin/hirb.rb

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=708966&r1=708965&r2=708966&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Oct 29 11:01:35 2008
@@ -81,6 +81,7 @@
                (Sishen Freecity via Stack)
    HBASE-960   REST interface: more generic column family configure and also
                get Rows using offset and limit (Sishen Freecity via Stack)
+   HBASE-817   Hbase/Shell Truncate
     
   NEW FEATURES
    HBASE-875   Use MurmurHash instead of JenkinsHash [in bloomfilters]

Modified: hadoop/hbase/trunk/bin/HBase.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/HBase.rb?rev=708966&r1=708965&r2=708966&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/HBase.rb (original)
+++ hadoop/hbase/trunk/bin/HBase.rb Wed Oct 29 11:01:35 2008
@@ -104,6 +104,21 @@
       @formatter.footer(now)
     end
 
+    def truncate(tableName)
+      now = Time.now
+      @formatter.header()
+      hTable = HTable.new(tableName)
+      tableDescription = hTable.getTableDescriptor()
+      puts 'Truncating ' + tableName + '; it may take a while'
+      puts 'Disabling table...'
+      disable(tableName)
+      puts 'Dropping table...'
+      drop(tableName)
+      puts 'Creating table...'
+      @admin.createTable(tableDescription)
+      @formatter.footer(now)
+    end
+
     # Pass tablename and an array of Hashes
     def create(tableName, args)
       now = Time.now 

Modified: hadoop/hbase/trunk/bin/hirb.rb
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/bin/hirb.rb?rev=708966&r1=708965&r2=708966&view=diff
==============================================================================
--- hadoop/hbase/trunk/bin/hirb.rb (original)
+++ hadoop/hbase/trunk/bin/hirb.rb Wed Oct 29 11:01:35 2008
@@ -190,6 +190,8 @@
            hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
            hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \\
              STARTROW => 'xyz'}
+
+ truncate  Disables, drops and recreates the specified table.
            
  version   Output this HBase version
 
@@ -264,6 +266,10 @@
 def exists(table)
   admin().exists(table)
 end
+
+def truncate(table)
+  admin().truncate(table)
+end
   
 # CRUD
   



Mime
View raw message