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 # Requests a table or region or column family compaction
def compact(table_or_region_name, *args) def compact(table_or_region_name, family)
if args.empty? if family == nil
@admin.compact(table_or_region_name) @admin.compact(table_or_region_name)
elsif args.length == 1 else
# We are compacting a column family within a region. # We are compacting a column family within a region.
column_family = args.first @admin.compact(table_or_region_name, family)
@admin.compact(table_or_region_name, column_family)
end end
end end
#---------------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------------
# Requests a table or region or column family major compaction # Requests a table or region or column family major compaction
def major_compact(table_or_region_name, *args) def major_compact(table_or_region_name, family)
if args.empty? if family == nil
@admin.majorCompact(table_or_region_name) @admin.majorCompact(table_or_region_name)
elsif args.length == 1 else
# We are major compacting a column family within a region or table. # We are major compacting a column family within a region or table.
column_family = args.first @admin.majorCompact(table_or_region_name, family)
@admin.majorCompact(table_or_region_name, column_family)
end end
end end

View File

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

View File

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