phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno Dumon (JIRA)" <>
Subject [jira] [Created] (PHOENIX-856) Allow phoenix driver reuse after being closed
Date Sat, 15 Mar 2014 08:58:42 GMT
Bruno Dumon created PHOENIX-856:

             Summary: Allow phoenix driver reuse after being closed
                 Key: PHOENIX-856
             Project: Phoenix
          Issue Type: Improvement
            Reporter: Bruno Dumon
         Attachments: allow-driver-restart.patch.txt

Attached patch will allow to close the phoenix driver and re-use it later on.


I ran into this because I have a testcase where I start an HBaseTestingUtility, do some tests,
stop it, and start it again to run the same tests with some different configs. This happens
in one testcase because I want to compare the results of the two runs.

Since the 'cluster' is stopped between the two runs, I need to stop the Phoenix driver as
well using PhoenixDriver.INSTANCE.close() (If I don't do this, it works as well but takes
tons of time, I think because HBase needs to figure out it needs to create a new ZK connection).
Previously this worked fine, but was recently broke likely because "services.getExecutor().shutdownNow()"
was added.

*Proposed changes*

The proposed patch sets services to null after the services are closed, so that they will
be reopened the next time the driver is used.

Now, this change might lead to unexpected behavior: you call close(), and if after that some
other thread still does something with Phoenix, the effect of the close call would be cancelled.

Besides this, if you currently try to use the driver after it is closed, it gives a rather
confusing message:

java.sql.SQLException: ERROR 2006 (INT08): Incompatible jars detected between client and server.
Ensure that phoenix.jar is put on the classpath of HBase in every region server: Task org.apache.phoenix.job.JobManager$JobFutureTask@2c46358e
rejected from org.apache.phoenix.job.JobManager$1@35661457[Terminated, pool size = 0, active
threads = 0, queued tasks = 0, completed tasks = 43]
	at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(
	at java.util.concurrent.ThreadPoolExecutor.reject(
	at java.util.concurrent.ThreadPoolExecutor.execute(
	at java.util.concurrent.AbstractExecutorService.submit(
	at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.processExecs(
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.checkClientServerCompatibility(
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(
	at org.apache.phoenix.schema.MetaDataClient.createTableInternal(

 * I introduced a closed flag so that we can check if the driver is closed and throw an exception
if it is used after closing
 * I introduced a softClose() method for the case where you want to close current resources
but want to allow continued use of the driver.

This message was sent by Atlassian JIRA

View raw message