hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wellington Chevreuil (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-17461) HBase shell "major_compact" command should properly convert "table_or_region_name" parameter to java byte array properly before simply calling "HBaseAdmin.majorCompact" method
Date Fri, 13 Jan 2017 16:50:26 GMT

    [ https://issues.apache.org/jira/browse/HBASE-17461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15821977#comment-15821977

Wellington Chevreuil commented on HBASE-17461:

Just quickly tested that adding same conversions as follows, also fix the split command:

admin.split(table_or_region_name.to_s.to_java_bytes, split_point.to_s.to_java_bytes)

Here some tests:
1) Before applying the change on *split.rb*, had put a row with same value described on HBASE-8865,
then call split on that row key. The region name is created with different value:

hbase(main):001:0> put 'test', "\x00\x00\xC3", 'cf1:1', 'asassasaaasa'
0 row(s) in 0.4800 seconds

split 'test', "\x00\x00\xC3"
0 row(s) in 0.3520 seconds

scan "hbase:meta"
ROW                                                        COLUMN+CELL 
test,\x00\x00\xEF\xBF\xBD,1484325464993.f941c09118f007113 column=info:regioninfo, timestamp=1484325465598,
value={ENCODED => f941c09118f00711335bd70798a57a2a, NAME => 'test,\x00\x00\xEF\xBF\xBD,1484325464993.f941c09118f00711335bd
 35bd70798a57a2a.                                          70798a57a2a.', STARTKEY => '\x00\x00\xEF\xBF\xBD',
ENDKEY => '\xF8\xB9B2!$\x9C\x0A\xFEG\xC0\xE3\x8B\x1B\xFF\x15'}

After adding the change to *split.rb*:

hbase(main):005:0> create 'test-2', 'cf'
0 row(s) in 2.5540 seconds

=> Hbase::Table - test-2
hbase(main):006:0> put 'test-2', "\x00\x00\xC3", 'cf:1', 'ffff'
0 row(s) in 0.0240 seconds

hbase(main):001:0> split 'test-2', "\x00\x00\xC3"
0 row(s) in 0.7290 seconds

hbase(main):002:0> scan "hbase:meta"
ROW                                                        COLUMN+CELL
test-2,\x00\x00\xC3,1484325769960.aa2a2a9d4bf1df550e74a56 column=info:regioninfo, timestamp=1484325770674,
value={ENCODED => aa2a2a9d4bf1df550e74a56837410d1e, NAME => 'test-2,\x00\x00\xC3,1484325769960.aa2a2a9d4bf1df550e74a568374
 837410d1e.                                                10d1e.', STARTKEY => '\x00\x00\xC3',
ENDKEY => ''}  

> HBase shell "major_compact" command should properly convert "table_or_region_name" parameter
to java byte array properly before simply calling "HBaseAdmin.majorCompact" method
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>                 Key: HBASE-17461
>                 URL: https://issues.apache.org/jira/browse/HBASE-17461
>             Project: HBase
>          Issue Type: Bug
>          Components: shell
>            Reporter: Wellington Chevreuil
>            Assignee: Wellington Chevreuil
> On HBase shell, *major_compact* command simply passes the received *table_or_region_name*
parameter straight to java *HBaseAdmin.majorCompact* method.
> On some corner cases, HBase tables row keys may have special characters. Then, if a region
is split in such a way that row keys with special characters are now part of the region name,
calling *major_compact* on this regions will fail, if the special character ASCII code is
higher than 127. This happens because Java byte type is signed, while ruby byte type isn't,
causing the region name to be converted to a wrong string at Java side.
> For example, considering a region named as below:
> {noformat}
> test,\xF8\xB9B2!$\x9C\x0A\xFEG\xC0\xE3\x8B\x1B\xFF\x15,1481745228583.b4bc69356d89018bfad3ee106b717285.
> {noformat} 
> Calling major_compat on it fails as follows:
> {noformat}
> hbase(main):008:0* major_compact "test,\xF8\xB9B2!$\x9C\x0A\xFEG\xC0\xE3\x8B\x1B\xFF\x15,1484177359169.8128fa75ae0cd4eba38da2667ac8ec98."
> ERROR: Illegal character code:44, <,> at 4. User-space table qualifiers can only
contain 'alphanumeric characters': i.e. [a-zA-Z_0-9-.]: test,�B2!$�
> �G���1484177359169.8128fa75ae0cd4eba38da2667ac8ec98.
> {noformat}
> An easy solution is to convert *table_or_region_name* parameter properly, prior to calling
*HBaseAdmin.majorCompact* in the same way as it's already done on some other shell commands,
such as *get*:
> {noformat}
> admin.major_compact(table_or_region_name.to_s.to_java_bytes, family)
> {noformat}

This message was sent by Atlassian JIRA

View raw message