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

Samarth Jain commented on PHOENIX-1726:
---------------------------------------

Thanks Nick! Looks like this problem is not only during the first connection 
initialization but also in several other places where we are using 
HBaseAdmin(Configuration) constructor for getting hold of the admin instance.
{code}
public HBaseAdmin(Configuration c)
  throws MasterNotRunningException, ZooKeeperConnectionException, IOException {
    // Will not leak connections, as the new implementation of the constructor
    // does not throw exceptions anymore.
    this(HConnectionManager.getConnection(new Configuration(c)));
    this.cleanupConnectionOnClose = true;
  }
{code}

The HBaseAdmin constructor with Configuration as argument always ends up 
cloning a new configuration instance. As a result, 
HConnectionManager.getConnection(config) code, which uses a map of 
config->hconnection to cache hconnections, always ends up creating a new 
HConnection since the Configuration class doesn't have the equals() method 
overriden (probably because the check is too expensive?). 
Not sure if this is a bug or was designed this way.

An easier alternative/workaround for phoenix would be to use the public 
HBaseAdmin(HConnection connection) constructor. Will upload a patch.

> Phoenix connection initialization makes multiple hbase connections
> ------------------------------------------------------------------
>
>                 Key: PHOENIX-1726
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1726
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Nick Dimiduk
>            Assignee: Samarth Jain
>            Priority: Minor
>              Labels: verify
>             Fix For: 4.8.0
>
>
> Working on other things, I enabled logging of my Phoenix app. I noticed that 
> on startup, I see 3 rounds of HBase connections happening. My app itself only 
> creates a single PhoenixConnection. You see the same thing when sqlline.py 
> connects.
> {noformat}
> 15/03/12 11:06:03 INFO impl.MetricsSystemImpl: phoenix metrics system started
> 15/03/12 11:06:04 INFO query.ConnectionQueryServicesImpl: Found quorum: 
> localhost:2181
> 15/03/12 11:06:04 INFO client.HConnectionManager$HConnectionImplementation: 
> Closing master protocol: MasterService
> 15/03/12 11:06:04 INFO client.HConnectionManager$HConnectionImplementation: 
> Closing zookeeper sessionid=0x14c0f28a8300007
> 15/03/12 11:06:04 INFO query.ConnectionQueryServicesImpl: Found quorum: 
> localhost:2181
> 15/03/12 11:06:04 INFO client.HConnectionManager$HConnectionImplementation: 
> Closing master protocol: MasterService
> 15/03/12 11:06:04 INFO client.HConnectionManager$HConnectionImplementation: 
> Closing zookeeper sessionid=0x14c0f28a8300009
> 15/03/12 11:06:05 INFO query.ConnectionQueryServicesImpl: Found quorum: 
> localhost:2181
> 15/03/12 11:06:10 INFO client.HConnectionManager$HConnectionImplementation: 
> Closing master protocol: MasterService
> 15/03/12 11:06:10 INFO client.HConnectionManager$HConnectionImplementation: 
> Closing zookeeper sessionid=0x14c0f28a830000b
> 15/03/12 11:06:16 INFO util.log: Logging initialized @14027ms
> {noformat}
> Parking here for further investigation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to