Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # dev - Heads up, HTablePool will be deprecated in 0.94, 0.95/0.96, and removed in 0.98


Copy link to this message
-
Re: Heads up, HTablePool will be deprecated in 0.94, 0.95/0.96, and removed in 0.98
lars hofhansl 2013-08-05, 02:56
Let's do a little quiz:

HTable t1 = new HTable(conf);
t1.close();

// 1. Will the next line create a new HConnection behind the scenes (along with re-creating all the caches)?
// (If so, it will be expensive, if not, when is the first HConnection actually released?)
HTable t2 = new HTable(conf);

// 2. how about this one?
HTable t2 = new HTable(new Configuration(conf));

// 3. or now?
conf.setInt(HConstants.HBASE_CLIENT_PAUSE, 2000);
HTable t3 = new HTable(conf);

// 4. and now?
conf.setInt(HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY, 1024000);
HTable t4 = new HTable(conf);

// 5. how many connections are opened now?
t4.close();

This stuff is convoluted and needlessly complicated. And this is not because the code is bad, but because the abstraction is simply inadequate.
A client wants to connect to a cluster and then do some action on that cluster (via HTable as a convenience).
If the cluster connection is implicit it leads to all of the above considerations.

(#1: Yes, #2: no, #3: yes, #4: no, #5: I don't really know, id'd have run it to see)

-- Lars

________________________________
 From: Ted Yu <[EMAIL PROTECTED]>
To: lars hofhansl <[EMAIL PROTECTED]>
Cc: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Sent: Sunday, August 4, 2013 7:39 PM
Subject: Re: Heads up, HTablePool will be deprecated in 0.94, 0.95/0.96, and removed in 0.98
 
In the Connections "managing" HTables case, don't we need to figure out when an HConnection should be released ?
On Sun, Aug 4, 2013 at 7:23 PM, lars hofhansl <[EMAIL PROTECTED]> wrote:

Just look at HConnectionKey part, and hoops we go through to detect whether HConnections are the same or not, when to cache them, when/how to release them.
>In fact almost all HConnectionManager does is managing HConnections on behalf of HTable, when it should be other way around.
>
>Typically, when things get hard to explain (check out the comments in HConnectionManager) there is either an abstraction missing, or the abstraction is not right.
>The reverse (Connections "managing" HTables) has none of this.
>
>
>-- Lars
>
>
>_______________________________
>From: Ted Yu <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]; lars hofhansl <[EMAIL PROTECTED]>
>Sent: Sunday, August 4, 2013 4:27 PM
>
>Subject: Re: Heads up, HTablePool will be deprecated in 0.94, 0.95/0.96, and removed in 0.98
>
>
>
>bq. no funny business with unique Configurations
>
>Mind telling us what is funny about this part ?
>
>
>On Sat, Aug 3, 2013 at 10:41 PM, lars hofhansl <[EMAIL PROTECTED]> wrote:
>
>Correct. The HConnection is naturally shared between the HTables.
>>There is no longer any need to worry about this (no funny business with unique Configurations, in fact most of the code in HConnectionManager can be removed in trunk).
>>
>>It is also correct that the code now has to hold on the created HConnection, rather asking HConnectionManager for it.
>>
>>-- Lars
>>
>>
>>
>>________________________________
>> From: Nick Dimiduk <[EMAIL PROTECTED]>
>>To: [EMAIL PROTECTED]
>>Sent: Saturday, August 3, 2013 8:56 PM
>>
>>Subject: Re: Heads up, HTablePool will be deprecated in 0.94, 0.95/0.96, and removed in 0.98
>>
>>
>>On Sat, Aug 3, 2013 at 8:52 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
>>
>>> Does this mean that user code wouldn't be able to depend
>>> on HConnectionManager for connection sharing ?
>>>
>>
>>My read of the above is that the HConnection instance is shared across
>>consumers, is the shared connection. Am I reading that correctly?
>>
>>On Sat, Aug 3, 2013 at 7:20 AM, Ted Yu <[EMAIL PROTECTED]> wrote:
>>>
>>> > Ah, I find the JIRA - HBASE-9117.
>>> >
>>> > Cheers
>>> >
>>> >
>>> > On Fri, Aug 2, 2013 at 10:54 PM, lars hofhansl <[EMAIL PROTECTED]> wrote:
>>> >
>>> >> Yeah, I filed a separate ticket for the API removal in trunk.
>>> >>
>>> >>
>>> >>
>>> >> ________________________________
>>> >>  From: Ted Yu <[EMAIL PROTECTED]>
>>> >> To: [EMAIL PROTECTED]; lars hofhansl <[EMAIL PROTECTED]>
>>> >> Sent: Friday, August 2, 2013 10:31 PM