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:
parent
70c1cc9e86
commit
3b803714c5
|
@ -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]
|
||||
|
|
15
bin/HBase.rb
15
bin/HBase.rb
|
@ -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
|
||||
|
|
|
@ -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 = {})
|
||||
|
|
Loading…
Reference in New Issue