HBASE-5525 Truncate and preserve region boundaries option

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1479778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-05-07 06:52:44 +00:00
parent c68cea5b45
commit 8a46690944
1 changed files with 1 additions and 1 deletions

View File

@ -349,7 +349,7 @@ module Hbase
# Truncates table while maintaing region boundaries (deletes all records by recreating the table) # Truncates table while maintaing region boundaries (deletes all records by recreating the table)
def truncate_preserve(table_name, conf = @conf) def truncate_preserve(table_name, conf = @conf)
h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name) h_table = org.apache.hadoop.hbase.client.HTable.new(conf, table_name)
splits = h_table.getRegionsInfo().keys().map{|i| Bytes.toString(i.getStartKey)}.delete_if{|k| k == ""}.to_java :String splits = h_table.getRegionLocations().keys().map{|i| Bytes.toString(i.getStartKey)}.delete_if{|k| k == ""}.to_java :String
splits = org.apache.hadoop.hbase.util.Bytes.toByteArrays(splits) splits = org.apache.hadoop.hbase.util.Bytes.toByteArrays(splits)
table_description = h_table.getTableDescriptor() table_description = h_table.getTableDescriptor()
yield 'Disabling table...' if block_given? yield 'Disabling table...' if block_given?