Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hbase-shell/src/main/ruby/hbase/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _deleteall_internal(row, column = nil,
args = {}, all_version = true)
# delete operation doesn't need read permission. Retaining the read check for
# meta table as a part of HBASE-5837.
if is_meta_table?
if is_meta_table? and !(row.is_a?(Hash) and row.key?('ROWPREFIXFILTER'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's dangerous to delete rows in meta table by 'ROWPREFIXFILTER', right? If the rowPrefix matches some rows unexpected, the meta data will be deleted unexpected. I think maybe this is why the origin design seperated meta table here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have this concen too. Let me fix the error message?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, you can try to make the descriptions more clearly.

raise ArgumentError, 'Row Not Found' if _get_internal(row).nil?
end
if row.is_a?(Hash)
Expand Down
11 changes: 11 additions & 0 deletions hbase-shell/src/test/ruby/hbase/table_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ def teardown
assert_nil(res2)
end

define_test "deleteall should work with row prefix in hbase:meta" do
@meta_table = table('hbase:meta')
@meta_table.put("test_meta_1", "table:state", "\x08\x01")
@meta_table.put("test_meta_2", "table:state", "\x08\x01")
@meta_table.deleteall({ROWPREFIXFILTER => "test_meta"})
res1 = @test_table._get_internal('test_meta_1')
assert_nil(res1)
res2 = @test_table._get_internal('test_meta_2')
assert_nil(res2)
end

define_test "append should work with value" do
@test_table.append("123", 'x:cnt2', '123')
assert_equal("123123", @test_table._append_internal("123", 'x:cnt2', '123'))
Expand Down