You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Lars Hofhansl (JIRA)" <ji...@apache.org> on 2012/08/29 20:22:09 UTC

[jira] [Resolved] (HBASE-3962) HConnectionManager.getConnection(HBaseConfiguration) returns new connection in default HTable constructor

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

Lars Hofhansl resolved HBASE-3962.
----------------------------------

    Resolution: Fixed

Since we have this solved in 0.92+ I am closing this.
Please reopen if you disagree.
                
> HConnectionManager.getConnection(HBaseConfiguration) returns new connection in default HTable constructor
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-3962
>                 URL: https://issues.apache.org/jira/browse/HBASE-3962
>             Project: HBase
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 0.90.1
>            Reporter: Philippe
>
> The HBase instance are currently indexed by Configuration, which since HBASE-1976 does not have any other equivalence that the object equivalence.
> So, everytime a new configuration is passed to the method a new connection is created.
> If we create many HTable connections with the same configuration, there is no problem:
> HBaseConfiguration config = HBaseConfiguration.create();
> HTable table 1 = new HTable(config, "table1"); // init connection
> HTable table 2 = new HTable(config, "table2"); // re-use connection
> HTable table 3 = new HTable(config, "table3"); // re-use connection
> However, if we call the default constructor, or re-call HBaseConfiguration.create();, we will pass a new instance of the configuration to the constructor. This will cause many connections to be created:
> HTable table 1 = new HTable("table1"); // init connection
> HTable table 2 = new HTable("table2"); // init new connection
> HTable table 3 = new HTable("table3"); // init new connection
> I know connection should be pooled, but sometimes we have to create a new connection, and without having access to a previously instanced configuration object.
> Since zookeeper has a max client connection (default was 30, now is 10), after creating 30 instances of HTable, we can no longer access to the database.
> In addition to this, the HBASE_INSTANCES map does not close the connection when removing the eldest entry. So if we have a larger maxConnection value than the hard-coded MAX_CACHED_HBASE_INSTANCES variable, connections will remain but won't be closed. MAX_CACHED_HBASE_INSTANCES should actually be set from the hbase.zookeeper.property.maxClientCnxns parameter (value + 1).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira