You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "James Taylor (JIRA)" <ji...@apache.org> on 2017/01/05 00:14:58 UTC

[jira] [Resolved] (PHOENIX-3564) Initialize transaction manager client after opening HConnection

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

James Taylor resolved PHOENIX-3564.
-----------------------------------
    Resolution: Duplicate

Duplicate of PHOENIX-3563.

> Initialize transaction manager client after opening HConnection
> ---------------------------------------------------------------
>
>                 Key: PHOENIX-3564
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3564
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Thomas D'Silva
>
> We should call after the HConnection has successfully been opened here in ConnectionQueryServicesImpl:
> {code}
>     private void openConnection() throws SQLException {
>         try {
>             boolean transactionsEnabled = props.getBoolean(
>                     QueryServices.TRANSACTIONS_ENABLED,
>                     QueryServicesOptions.DEFAULT_TRANSACTIONS_ENABLED);
>             // only initialize the tx service client if needed
>             if (transactionsEnabled) {
>                 initTxServiceClient();
>             }
>             this.connection = HBaseFactoryProvider.getHConnectionFactory().createConnection(this.config);
>         } catch (IOException e) {
>             throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_ESTABLISH_CONNECTION)
>             .setRootCause(e).build().buildException();
>         }
>         if (this.connection.isClosed()) { // TODO: why the heck doesn't this throw above?
>             throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_ESTABLISH_CONNECTION).build().buildException();
>         }
>     }
> {code}
> This will prevent multiple instantiations of TephraZKClientService and prevent many Zookeeper connections from being opened if an HConnection cannot be established.
> We should also call TephraZKClientService.stop() in ConnectionQueryServicesImpl.close(). Although this doesn't appear to close the Zookeeper connection, it probably should (see TEPHRA-207).



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