HBASE-13111 truncate_preserve command is failing with undefined method error (Ashish Singhi)
This commit is contained in:
parent
3e17ed9c3e
commit
ac7faf3ef7
@ -34,7 +34,7 @@ module Hbase
|
|||||||
|
|
||||||
def initialize(admin, formatter)
|
def initialize(admin, formatter)
|
||||||
@admin = admin
|
@admin = admin
|
||||||
connection = @admin.getConnection()
|
@connection = @admin.getConnection()
|
||||||
@formatter = formatter
|
@formatter = formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -399,14 +399,14 @@ 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 = @conn.getTable(table_name)
|
h_table = @connection.getTable(TableName.valueOf(table_name))
|
||||||
locator = @conn.getRegionLocator(table_name)
|
locator = @connection.getRegionLocator(TableName.valueOf(table_name))
|
||||||
splits = locator.getAllRegionLocations().
|
splits = locator.getAllRegionLocations().
|
||||||
map{|i| Bytes.toString(i.getRegionInfo().getStartKey)}.
|
map{|i| Bytes.toString(i.getRegionInfo().getStartKey)}.
|
||||||
delete_if{|k| k == ""}.to_java :String
|
delete_if{|k| k == ""}.to_java :String
|
||||||
locator.close()
|
locator.close()
|
||||||
|
|
||||||
table_description = @admin.getTableDescriptor(table_name)
|
table_description = @admin.getTableDescriptor(TableName.valueOf(table_name))
|
||||||
yield 'Disabling table...' if block_given?
|
yield 'Disabling table...' if block_given?
|
||||||
disable(table_name)
|
disable(table_name)
|
||||||
|
|
||||||
@ -784,7 +784,7 @@ module Hbase
|
|||||||
# Enables/disables a region by name
|
# Enables/disables a region by name
|
||||||
def online(region_name, on_off)
|
def online(region_name, on_off)
|
||||||
# Open meta table
|
# Open meta table
|
||||||
meta = connection.getTable(org.apache.hadoop.hbase.TableName::META_TABLE_NAME)
|
meta = @connection.getTable(org.apache.hadoop.hbase.TableName::META_TABLE_NAME)
|
||||||
|
|
||||||
# Read region info
|
# Read region info
|
||||||
# FIXME: fail gracefully if can't find the region
|
# FIXME: fail gracefully if can't find the region
|
||||||
|
Loading…
x
Reference in New Issue
Block a user