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)
|
(Sishen Freecity via Stack)
|
||||||
HBASE-960 REST interface: more generic column family configure and also
|
HBASE-960 REST interface: more generic column family configure and also
|
||||||
get Rows using offset and limit (Sishen Freecity via Stack)
|
get Rows using offset and limit (Sishen Freecity via Stack)
|
||||||
|
HBASE-817 Hbase/Shell Truncate
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]
|
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)
|
@formatter.footer(now)
|
||||||
end
|
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
|
# Pass tablename and an array of Hashes
|
||||||
def create(tableName, args)
|
def create(tableName, args)
|
||||||
now = Time.now
|
now = Time.now
|
||||||
|
|
|
@ -190,6 +190,8 @@ HBASE SHELL COMMANDS:
|
||||||
hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
|
hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
|
||||||
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \\
|
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, \\
|
||||||
STARTROW => 'xyz'}
|
STARTROW => 'xyz'}
|
||||||
|
|
||||||
|
truncate Disables, drops and recreates the specified table.
|
||||||
|
|
||||||
version Output this HBase version
|
version Output this HBase version
|
||||||
|
|
||||||
|
@ -264,6 +266,10 @@ end
|
||||||
def exists(table)
|
def exists(table)
|
||||||
admin().exists(table)
|
admin().exists(table)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def truncate(table)
|
||||||
|
admin().truncate(table)
|
||||||
|
end
|
||||||
|
|
||||||
# CRUD
|
# CRUD
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue