HBASE-18412 [Shell] Support unset of list of configuration for a table (Yun Zhao)
This commit is contained in:
parent
8606cda357
commit
b81fed7f88
|
@ -657,6 +657,23 @@ module Hbase
|
||||||
htd.remove(name)
|
htd.remove(name)
|
||||||
end
|
end
|
||||||
hasTableUpdate = true
|
hasTableUpdate = true
|
||||||
|
# Unset table configuration
|
||||||
|
elsif method == 'table_conf_unset'
|
||||||
|
raise(ArgumentError, 'NAME parameter missing for table_conf_unset method') unless name
|
||||||
|
if name.is_a?(Array)
|
||||||
|
name.each do |key|
|
||||||
|
if htd.getConfigurationValue(key).nil?
|
||||||
|
raise ArgumentError, "Could not find configuration: #{key}"
|
||||||
|
end
|
||||||
|
htd.removeConfiguration(key)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if htd.getConfigurationValue(name).nil?
|
||||||
|
raise ArgumentError, "Could not find configuration: #{name}"
|
||||||
|
end
|
||||||
|
htd.removeConfiguration(name)
|
||||||
|
end
|
||||||
|
hasTableUpdate = true
|
||||||
# Unknown method
|
# Unknown method
|
||||||
else
|
else
|
||||||
raise ArgumentError, "Unknown method: #{method}"
|
raise ArgumentError, "Unknown method: #{method}"
|
||||||
|
|
|
@ -71,6 +71,10 @@ You can also set configuration settings specific to this table or column family:
|
||||||
hbase> alter 't1', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}
|
hbase> alter 't1', CONFIGURATION => {'hbase.hregion.scan.loadColumnFamiliesOnDemand' => 'true'}
|
||||||
hbase> alter 't1', {NAME => 'f2', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => '10'}}
|
hbase> alter 't1', {NAME => 'f2', CONFIGURATION => {'hbase.hstore.blockingStoreFiles' => '10'}}
|
||||||
|
|
||||||
|
You can also unset configuration settings specific to this table:
|
||||||
|
|
||||||
|
hbase> alter 't1', METHOD => 'table_conf_unset', NAME => 'hbase.hregion.majorcompaction'
|
||||||
|
|
||||||
You can also remove a table-scope attribute:
|
You can also remove a table-scope attribute:
|
||||||
|
|
||||||
hbase> alter 't1', METHOD => 'table_att_unset', NAME => 'MAX_FILESIZE'
|
hbase> alter 't1', METHOD => 'table_att_unset', NAME => 'MAX_FILESIZE'
|
||||||
|
|
|
@ -480,6 +480,36 @@ module Hbase
|
||||||
assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
|
assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
define_test "alter should be able to remove a table configuration" do
|
||||||
|
drop_test_table(@test_name)
|
||||||
|
create_test_table(@test_name)
|
||||||
|
|
||||||
|
key = "TestConf"
|
||||||
|
command(:alter, @test_name, CONFIGURATION => {key => 1})
|
||||||
|
|
||||||
|
# eval() is used to convert a string to regex
|
||||||
|
assert_match(eval("/" + key + "/"), admin.describe(@test_name))
|
||||||
|
|
||||||
|
command(:alter, @test_name, 'METHOD' => 'table_conf_unset', 'NAME' => key)
|
||||||
|
assert_no_match(eval("/" + key + "/"), admin.describe(@test_name))
|
||||||
|
end
|
||||||
|
|
||||||
|
define_test "alter should be able to remove a list of table configuration" do
|
||||||
|
drop_test_table(@test_name)
|
||||||
|
|
||||||
|
key_1 = "TestConf1"
|
||||||
|
key_2 = "TestConf2"
|
||||||
|
command(:create, @test_name, { NAME => 'i'}, CONFIGURATION => { key_1 => 1, key_2 => 2 })
|
||||||
|
|
||||||
|
# eval() is used to convert a string to regex
|
||||||
|
assert_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
|
||||||
|
assert_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
|
||||||
|
|
||||||
|
command(:alter, @test_name, 'METHOD' => 'table_conf_unset', 'NAME' => [ key_1, key_2 ])
|
||||||
|
assert_no_match(eval("/" + key_1 + "/"), admin.describe(@test_name))
|
||||||
|
assert_no_match(eval("/" + key_2 + "/"), admin.describe(@test_name))
|
||||||
|
end
|
||||||
|
|
||||||
define_test "get_table should get a real table" do
|
define_test "get_table should get a real table" do
|
||||||
drop_test_table(@test_name)
|
drop_test_table(@test_name)
|
||||||
create_test_table(@test_name)
|
create_test_table(@test_name)
|
||||||
|
|
Loading…
Reference in New Issue