hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carter (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-11068) Update code to use Admin factory method instead of constructor
Date Fri, 01 Aug 2014 19:49:39 GMT

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

Carter commented on HBASE-11068:
--------------------------------

Okay, I'm taking another swing at this one, but only with the unit tests in hbase-server.
 This latest patch essentially started as a one-line change in HBaseTestingUtility, changing
this:

{code}
public synchronized HBaseAdmin getHBaseAdmin() throws IOException {
{code}

to this:

{code}
public synchronized Admin getHBaseAdmin() throws IOException {
{code}

The other hundreds of modifications are essentially fixing the whatever broke as a result
(which was a lot).

The net effect is that key client tests in hbase-server now use the interface.

There were 2 or 3 places where I had to create a new connection, due to a peculiarity of the
existing test, but as [~enis] reminded me above, I was sure to close them in a finally {}.


> Update code to use Admin factory method instead of constructor
> --------------------------------------------------------------
>
>                 Key: HBASE-11068
>                 URL: https://issues.apache.org/jira/browse/HBASE-11068
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 0.99.0
>            Reporter: Carter
>            Assignee: Carter
>             Fix For: 0.99.0
>
>         Attachments: HBASE_11068-branch-1-v2.patch, HBASE_11068.patch
>
>
> Where feasible, the code should be updated to use the HConnection factory method for
the admin interface.  For instance, the following:
> {code:java}
>     HBaseAdmin admin = new HBaseAdmin(conf);
> {code}
> would be changed to:
> {code:java}
>     Admin admin = HConnectionManager.createConnection(conf).getAdmin();
> {code}
> This would also require updates to admin calls that refer to a tablename as byte[] or
String.
> {code:java}
>     admin.enableTable("mytable");
> {code}
> would change to:
> {code:java}
>     admin.enableTable(TableName.valueOf("mytable"));
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message