You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Ramkrishna S Vasudevan <ra...@huawei.com> on 2011/07/12 14:06:22 UTC

Problem in Caching the connection object in HBaseAdmin.getConnection()

Hi ,

 

I think there is  a bug in HBaseAdmin.getConnection(). 

 

The reason is 

In HConnectionManager the connection object is cached based on the
HConnectionKey. 

 

The equals method checks the value of the CONNECTION_PROPERTIES. 

 

Suppose if we do a restart/switch of the master and again try to do an
enable table operation then in the test code we will create a new HBaseAdmin
object. 

 

But the connection that the Admin creates to the Master is taken from the
cache though it is a new connection. 

 

Here none of the values in the CONNECTION_PROPERTIES is changed so we get
the same connection object, the one when the previous master was active and
hence though the master has been restarted we get the old active master
address and hence an exception is thrown. 

 

So in order to pass the test case we change the value of one of the
CONNECTION PROPERTIES so that the cached connection object is not returned. 

 

Correct me if am wrong?  

 

Am getting this problem when i try to run the test case of HBASE-4052 in
trunk.  This is one of the problems that I faced. Other one is that the
region server doesnt 

checkin after master switch has happened.

I overcame this by changing the value for one of the CONNECTION
PROPERTIES.(a workaround).

 

Regards

Ram

 

****************************************************************************
***********
This e-mail and attachments contain confidential information from HUAWEI,
which is intended only for the person or entity whose address is listed
above. Any use of the information contained herein in any way (including,
but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!

 


Re: Problem in Caching the connection object in HBaseAdmin.getConnection()

Posted by Stack <st...@duboce.net>.
That sounds like a bug Ramakrishna.
St.Ack

On Tue, Jul 12, 2011 at 5:06 AM, Ramkrishna S Vasudevan
<ra...@huawei.com> wrote:
> Hi ,
>
>
>
> I think there is  a bug in HBaseAdmin.getConnection().
>
>
>
> The reason is
>
> In HConnectionManager the connection object is cached based on the
> HConnectionKey.
>
>
>
> The equals method checks the value of the CONNECTION_PROPERTIES.
>
>
>
> Suppose if we do a restart/switch of the master and again try to do an
> enable table operation then in the test code we will create a new HBaseAdmin
> object.
>
>
>
> But the connection that the Admin creates to the Master is taken from the
> cache though it is a new connection.
>
>
>
> Here none of the values in the CONNECTION_PROPERTIES is changed so we get
> the same connection object, the one when the previous master was active and
> hence though the master has been restarted we get the old active master
> address and hence an exception is thrown.
>
>
>
> So in order to pass the test case we change the value of one of the
> CONNECTION PROPERTIES so that the cached connection object is not returned.
>
>
>
> Correct me if am wrong?
>
>
>
> Am getting this problem when i try to run the test case of HBASE-4052 in
> trunk.  This is one of the problems that I faced. Other one is that the
> region server doesnt
>
> checkin after master switch has happened.
>
> I overcame this by changing the value for one of the CONNECTION
> PROPERTIES.(a workaround).
>
>
>
> Regards
>
> Ram
>
>
>
> ****************************************************************************
> ***********
> This e-mail and attachments contain confidential information from HUAWEI,
> which is intended only for the person or entity whose address is listed
> above. Any use of the information contained herein in any way (including,
> but not limited to, total or partial disclosure, reproduction, or
> dissemination) by persons other than the intended recipient's) is
> prohibited. If you receive this e-mail in error, please notify the sender by
> phone or email immediately and delete it!
>
>
>
>

Re: Problem in Caching the connection object in HBaseAdmin.getConnection()

Posted by Ted Yu <yu...@gmail.com>.
https://issues.apache.org/jira/browse/HBASE-4087 has been logged.

On Tue, Jul 12, 2011 at 8:16 AM, Ted Yu <yu...@gmail.com> wrote:

> I think we can perform connection validation in HCM.getConnection()
> Periodically HCM.getConnection() verifies that the connection is valid
> before handing it out.
>
>
> On Tue, Jul 12, 2011 at 5:06 AM, Ramkrishna S Vasudevan <
> ramakrishnas@huawei.com> wrote:
>
>> Hi ,
>>
>>
>>
>> I think there is  a bug in HBaseAdmin.getConnection().
>>
>>
>>
>> The reason is
>>
>> In HConnectionManager the connection object is cached based on the
>> HConnectionKey.
>>
>>
>>
>> The equals method checks the value of the CONNECTION_PROPERTIES.
>>
>>
>>
>> Suppose if we do a restart/switch of the master and again try to do an
>> enable table operation then in the test code we will create a new
>> HBaseAdmin
>> object.
>>
>>
>>
>> But the connection that the Admin creates to the Master is taken from the
>> cache though it is a new connection.
>>
>>
>>
>> Here none of the values in the CONNECTION_PROPERTIES is changed so we get
>> the same connection object, the one when the previous master was active
>> and
>> hence though the master has been restarted we get the old active master
>> address and hence an exception is thrown.
>>
>>
>>
>> So in order to pass the test case we change the value of one of the
>> CONNECTION PROPERTIES so that the cached connection object is not
>> returned.
>>
>>
>>
>> Correct me if am wrong?
>>
>>
>>
>> Am getting this problem when i try to run the test case of HBASE-4052 in
>> trunk.  This is one of the problems that I faced. Other one is that the
>> region server doesnt
>>
>> checkin after master switch has happened.
>>
>> I overcame this by changing the value for one of the CONNECTION
>> PROPERTIES.(a workaround).
>>
>>
>>
>> Regards
>>
>> Ram
>>
>>
>>
>>
>> ****************************************************************************
>> ***********
>> This e-mail and attachments contain confidential information from HUAWEI,
>> which is intended only for the person or entity whose address is listed
>> above. Any use of the information contained herein in any way (including,
>> but not limited to, total or partial disclosure, reproduction, or
>> dissemination) by persons other than the intended recipient's) is
>> prohibited. If you receive this e-mail in error, please notify the sender
>> by
>> phone or email immediately and delete it!
>>
>>
>>
>>
>

Re: Problem in Caching the connection object in HBaseAdmin.getConnection()

Posted by Ted Yu <yu...@gmail.com>.
I think we can perform connection validation in HCM.getConnection()
Periodically HCM.getConnection() verifies that the connection is valid
before handing it out.

On Tue, Jul 12, 2011 at 5:06 AM, Ramkrishna S Vasudevan <
ramakrishnas@huawei.com> wrote:

> Hi ,
>
>
>
> I think there is  a bug in HBaseAdmin.getConnection().
>
>
>
> The reason is
>
> In HConnectionManager the connection object is cached based on the
> HConnectionKey.
>
>
>
> The equals method checks the value of the CONNECTION_PROPERTIES.
>
>
>
> Suppose if we do a restart/switch of the master and again try to do an
> enable table operation then in the test code we will create a new
> HBaseAdmin
> object.
>
>
>
> But the connection that the Admin creates to the Master is taken from the
> cache though it is a new connection.
>
>
>
> Here none of the values in the CONNECTION_PROPERTIES is changed so we get
> the same connection object, the one when the previous master was active and
> hence though the master has been restarted we get the old active master
> address and hence an exception is thrown.
>
>
>
> So in order to pass the test case we change the value of one of the
> CONNECTION PROPERTIES so that the cached connection object is not returned.
>
>
>
> Correct me if am wrong?
>
>
>
> Am getting this problem when i try to run the test case of HBASE-4052 in
> trunk.  This is one of the problems that I faced. Other one is that the
> region server doesnt
>
> checkin after master switch has happened.
>
> I overcame this by changing the value for one of the CONNECTION
> PROPERTIES.(a workaround).
>
>
>
> Regards
>
> Ram
>
>
>
>
> ****************************************************************************
> ***********
> This e-mail and attachments contain confidential information from HUAWEI,
> which is intended only for the person or entity whose address is listed
> above. Any use of the information contained herein in any way (including,
> but not limited to, total or partial disclosure, reproduction, or
> dissemination) by persons other than the intended recipient's) is
> prohibited. If you receive this e-mail in error, please notify the sender
> by
> phone or email immediately and delete it!
>
>
>
>