phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samarth Jain (JIRA)" <>
Subject [jira] [Commented] (PHOENIX-1172) Prevent lock contention in ConnectionQueryServicesImpl. Fix exception handling.
Date Fri, 15 Aug 2014 07:21:19 GMT


Samarth Jain commented on PHOENIX-1172:

bq: Wouldn't this be simpler if you set initializationException in the catch of the SQLException
and again in a new catch Throwable?

The intent of the original exception handling was to chain sql exceptions (thrown during init
and metaConnection.close()). Not sure if handling SQLException and Throwable separately can/should
avoid the chaining and the associated if-else blocks.

bq: Why do we need the locking you added? Seems like the only race condition is between connect
and close. Why not just have close synchronize on latestMetaDataLock and remove the checkClosed()

Are you talking about the change I did in
If yes, then locking on metadatalock instead of "this" in close() won't work because we check
whether or not the query services is closed in the init() method inside a synchronized(this).
So we can't use two different locks.  The latestMetaData member is set to null only after
closed is set to true. By checking on closed in connect() it helps to break out earlier then
checking on metadata. Otherwise we would need to synchronize on this in connect() method too
which would be a little extreme. 

> Prevent lock contention in ConnectionQueryServicesImpl. Fix exception handling. 
> --------------------------------------------------------------------------------
>                 Key: PHOENIX-1172
>                 URL:
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0, 3.1, 4.1
>            Reporter: Samarth Jain
>            Assignee: Samarth Jain
>             Fix For: 5.0.0, 3.1, 4.1
>         Attachments: PHOENIX-1172.patch

This message was sent by Atlassian JIRA

View raw message