Hbase 26275 update error message when executing deleteall with ROWPREFIXFILTER in meta table (#4205)

Signed-off-by: Xiaolin Ha <haxiaolin@apache.org>
This commit is contained in:
xicm 2022-03-16 20:02:38 +08:00 committed by GitHub
parent c7773adeed
commit b9c59438a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -244,8 +244,12 @@ EOF
# delete operation doesn't need read permission. Retaining the read check for # delete operation doesn't need read permission. Retaining the read check for
# meta table as a part of HBASE-5837. # meta table as a part of HBASE-5837.
if is_meta_table? if is_meta_table?
if row.is_a?(Hash) and row.key?('ROWPREFIXFILTER')
raise ArgumentError, 'deleteall with ROWPREFIXFILTER in hbase:meta is not allowed.'
else
raise ArgumentError, 'Row Not Found' if _get_internal(row).nil? raise ArgumentError, 'Row Not Found' if _get_internal(row).nil?
end end
end
if row.is_a?(Hash) if row.is_a?(Hash)
_deleterows_internal(row, column, timestamp, args, all_version) _deleterows_internal(row, column, timestamp, args, all_version)
else else

View File

@ -194,6 +194,13 @@ module Hbase
assert_nil(res2) assert_nil(res2)
end end
define_test "deleteall with row prefix in hbase:meta should not be allowed." do
assert_raise(ArgumentError) do
@meta_table = table('hbase:meta')
@meta_table.deleteall({ROWPREFIXFILTER => "test_meta"})
end
end
define_test "append should work with value" do define_test "append should work with value" do
@test_table.append("123", 'x:cnt2', '123') @test_table.append("123", 'x:cnt2', '123')
assert_equal("123123", @test_table._append_internal("123", 'x:cnt2', '123')) assert_equal("123123", @test_table._append_internal("123", 'x:cnt2', '123'))