James Taylor created PHOENIX-3564:
-------------------------------------

             Summary: 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)

Reply via email to