HBASE-817 Hbase/Shell Truncate

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@708966 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-10-29 18:01:35 +00:00
parent 70c1cc9e86
commit 3b803714c5
3 changed files with 22 additions and 0 deletions

View File

@ -81,6 +81,7 @@ Release 0.19.0 - Unreleased
(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]

View File

@ -104,6 +104,21 @@ module HBase
@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

View File

@ -191,6 +191,8 @@ HBASE SHELL COMMANDS:
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \\
STARTROW => 'xyz'}
truncate Disables, drops and recreates the specified table.
version Output this HBase version
GENERAL NOTES:
@ -265,6 +267,10 @@ def exists(table)
admin().exists(table)
end
def truncate(table)
admin().truncate(table)
end
# CRUD
def get(table, row, args = {})