[ 
https://issues.apache.org/jira/browse/PHOENIX-7243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17821885#comment-17821885
 ] 

ASF GitHub Bot commented on PHOENIX-7243:
-----------------------------------------

palashc commented on code in PR #1838:
URL: https://github.com/apache/phoenix/pull/1838#discussion_r1506758361


##########
phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixTestDriver.java:
##########
@@ -92,7 +93,8 @@ public synchronized Connection connect(String url, Properties 
info) throws SQLEx
     public synchronized ConnectionQueryServices 
getConnectionQueryServices(String url, Properties infoIn) throws SQLException {
         checkClosed();
         final Properties info = PropertiesUtil.deepCopy(infoIn);
-        ConnectionInfo connInfo = ConnectionInfo.create(url, null, info);
+        boolean isServerConnection = 
Boolean.valueOf(info.getProperty(QueryUtil.IS_SERVER_CONNECTION));
+        ConnectionInfo connInfo = ConnectionInfo.create(url, null, info, 
isServerConnection);

Review Comment:
   Pushed the refactor, no changes in Drivers needed. 



##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/ConnectionInfo.java:
##########
@@ -114,6 +115,15 @@ public static ConnectionInfo create(String url, 
ReadOnlyProps props, Properties
         return create(url, conf, props, info);
     }
 
+    public static ConnectionInfo create(String url, ReadOnlyProps props,
+            Properties info, boolean isServerConnection)
+            throws SQLException {
+        Configuration conf = 
HBaseFactoryProvider.getConfigurationFactory().getConfiguration();
+        ConnectionInfo connInfo = create(url, conf, props, info);
+        connInfo.isServerConnection = isServerConnection;

Review Comment:
   Done. 





> Add isServerConnection property to ConnectionInfo class.
> --------------------------------------------------------
>
>                 Key: PHOENIX-7243
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7243
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Rushabh Shah
>            Assignee: Palash Chauhan
>            Priority: Major
>
> In PhoenixDriver, we have a cache of ConnectionQueryServices which is keyed 
> by ConnectionInfo object. Refer 
> [here|https://github.com/apache/phoenix/blob/master/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixDriver.java#L258-L270]
>  for more details.
> Lets say if we want to create a server  connection (with property 
> IS_SERVER_CONNECTION set to true) and we already have a _non server_ 
> connection present in the cache (with the same user, principal, keytab, 
> haGroup), it will return the non server connection.
> We need to add isServerConnection property to 
> [ConnectionInfo|https://github.com/apache/phoenix/blob/master/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/ConnectionInfo.java#L317-L334]
>  class to differentiate between server and non server connection.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to