Skip to content

Commit 4ff63f6

Browse files
xicmsunhelly
authored andcommitted
Hbase 26275 update error message when executing deleteall with ROWPREFIXFILTER in meta table (#4205)
Signed-off-by: Xiaolin Ha <[email protected]>
1 parent e008cb8 commit 4ff63f6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

hbase-shell/src/main/ruby/hbase/table.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,11 @@ def _deleteall_internal(row, column = nil,
244244
# delete operation doesn't need read permission. Retaining the read check for
245245
# meta table as a part of HBASE-5837.
246246
if is_meta_table?
247-
raise ArgumentError, 'Row Not Found' if _get_internal(row).nil?
247+
if row.is_a?(Hash) and row.key?('ROWPREFIXFILTER')
248+
raise ArgumentError, 'deleteall with ROWPREFIXFILTER in hbase:meta is not allowed.'
249+
else
250+
raise ArgumentError, 'Row Not Found' if _get_internal(row).nil?
251+
end
248252
end
249253
if row.is_a?(Hash)
250254
_deleterows_internal(row, column, timestamp, args, all_version)

hbase-shell/src/test/ruby/hbase/table_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ def teardown
194194
assert_nil(res2)
195195
end
196196

197+
define_test "deleteall with row prefix in hbase:meta should not be allowed." do
198+
assert_raise(ArgumentError) do
199+
@meta_table = table('hbase:meta')
200+
@meta_table.deleteall({ROWPREFIXFILTER => "test_meta"})
201+
end
202+
end
203+
197204
define_test "append should work with value" do
198205
@test_table.append("123", 'x:cnt2', '123')
199206
assert_equal("123123", @test_table._append_internal("123", 'x:cnt2', '123'))

0 commit comments

Comments
 (0)