HBASE-4913 Addendum: better shell parsing

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1408424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
gchanan 2012-11-12 19:51:04 +00:00
parent b91df27d20
commit a65a66be3d
3 changed files with 12 additions and 14 deletions

View File

@ -51,25 +51,23 @@ module Hbase
#----------------------------------------------------------------------------------------------
# Requests a table or region or column family compaction
def compact(table_or_region_name, *args)
if args.empty?
def compact(table_or_region_name, family)
if family == nil
@admin.compact(table_or_region_name)
elsif args.length == 1
else
# We are compacting a column family within a region.
column_family = args.first
@admin.compact(table_or_region_name, column_family)
@admin.compact(table_or_region_name, family)
end
end
#----------------------------------------------------------------------------------------------
# Requests a table or region or column family major compaction
def major_compact(table_or_region_name, *args)
if args.empty?
def major_compact(table_or_region_name, family)
if family == nil
@admin.majorCompact(table_or_region_name)
elsif args.length == 1
else
# We are major compacting a column family within a region or table.
column_family = args.first
@admin.majorCompact(table_or_region_name, column_family)
@admin.majorCompact(table_or_region_name, family)
end
end

View File

@ -37,9 +37,9 @@ module Shell
EOF
end
def command(table_or_region_name, *args)
def command(table_or_region_name, family = nil)
format_simple_command do
admin.compact(table_or_region_name, *args)
admin.compact(table_or_region_name, family)
end
end
end

View File

@ -38,9 +38,9 @@ module Shell
EOF
end
def command(table_or_region_name, *args)
def command(table_or_region_name, family = nil)
format_simple_command do
admin.major_compact(table_or_region_name, *args)
admin.major_compact(table_or_region_name, family)
end
end
end