hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chia-Ping Tsai (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HBASE-7278) Some bugs of HTableDesciptor
Date Fri, 28 Apr 2017 07:56:04 GMT

     [ https://issues.apache.org/jira/browse/HBASE-7278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Chia-Ping Tsai resolved HBASE-7278.
-----------------------------------
    Resolution: Duplicate

The setMetaFlags and isLegalTableName are fixed by HBASE-8408.

> Some bugs of HTableDesciptor
> ----------------------------
>
>                 Key: HBASE-7278
>                 URL: https://issues.apache.org/jira/browse/HBASE-7278
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Hiroshi Ikeda
>            Priority: Minor
>
> There are some bugs of the class HTableDescriptor.
> {code}
>   public HTableDescriptor(final byte [] name) {
>     super();
>     setMetaFlags(this.name);
>     this.name = this.isMetaRegion()? name: isLegalTableName(name);
>     this.nameAsString = Bytes.toString(this.name);
>   }
> {code}
> I think "setMetaFlags(this.name)" should be "setMetaFlags(name)".
> {code}
>   /**
>    * Check passed byte buffer, "tableName", is legal user-space table name.
>    * @return Returns passed <code>tableName</code> param
>    * @throws NullPointerException If passed <code>tableName</code> is null
>    * @throws IllegalArgumentException if passed a tableName
>    * that is made of other than 'word' characters or underscores: i.e.
>    * <code>[a-zA-Z_0-9].
>    */
>   public static byte [] isLegalTableName(final byte [] tableName) {
>     if (tableName == null || tableName.length <= 0) {
>       throw new IllegalArgumentException("Name is null or empty");
>     }
> {code}
> The implementation is against the contract of throwing NullPointerException.
> I'm not sure the contract is wrong or the implementation is wrong.
> Also the contract of throwing IllegalArgumentException is a little different from the
actual implementation, and in general we must actually call this method and catch IllegalArgumentException
in order to know whether the given name can be used as a table name.
> I feel HTableDescriptor allows itself to be in invalid states, and I cannot fix the class
well.
> I think we should start to remove implementing WritableComparable, but it might greatly
break the compatibility.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message