hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Spiegelberg (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-4127) HBaseAdmin : Don't modify table's name away
Date Fri, 22 Jul 2011 21:00:58 GMT

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

Nicolas Spiegelberg commented on HBASE-4127:
--------------------------------------------

More clarification, the developer ran:
{code}
byte[] table = Bytes.toBytes("test_table");
HBaseConfiguration conf = openHBaseConfiguration(HBASE_TIER_NAME);
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor desc = new HTableDescriptor();
HColumnDescriptor col_desc = new HColumnDescriptor(Bytes.toBytes("test"));
desc.addFamily(col_desc);
admin.disableTable(table);
admin.modifyTable(table, desc);
admin.enableTable(table);
{code}

This is horrible, miserable sadness.  The problem is the line that does 'new HTableDescriptor()'
which will create an HTD with an empty tablename.  Instead, the below code is the hotness
that should be used:

{code}
byte[] table = Bytes.toBytes("test_table");
HBaseConfiguration conf = openHBaseConfiguration(HBA​SE_TIER_NAME);
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor desc = admin.getTableDescriptor(t​able);
desc.getFamily(Bytes.toByt​es("test")).setMaxVersions​(1);
admin.disableTable(table);
admin.disableTable(table);
admin.modifyTable(table, desc);
admin.enableTable(table);
{code}

Calling getTableDescriptor() will give us the original contents of the HTD so we can make
the 1 necessary alteration to the table (maxversions : 3 => 1)

> HBaseAdmin : Don't modify table's name away
> -------------------------------------------
>
>                 Key: HBASE-4127
>                 URL: https://issues.apache.org/jira/browse/HBASE-4127
>             Project: HBase
>          Issue Type: Bug
>          Components: client, master
>    Affects Versions: 0.92.0
>            Reporter: Nicolas Spiegelberg
>            Assignee: Nicolas Spiegelberg
>            Priority: Minor
>
> One of the developers was using the default constructor for HTableDescriptor, which is
sadly a bad constructor that should never be used. It made the tablename empty in META &
caused an ERROR cycle as region onlining kept failing. We should have never let this happen.
Don't do table modifications if the HTableDescriptor name doesn't match the table name passed
in.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message