Github user yaise commented on a diff in the pull request:
https://github.com/apache/incubator-phoenix/pull/15#discussion_r10463718
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java ---
@@ -119,7 +116,36 @@ private static Properties newPropsWithSCN(long scn,
Properties props) {
props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
Long.toString(scn));
return props;
}
-
+
+ /**
+ * Strips out tenant specific information from the passed in
properties before creating a connection.
+ *
+ * @return a new Phoenix Connection.
+ * @throws SQLException
+ */
+ public static PhoenixConnection
newTenantLessConnection(ConnectionQueryServices services, String url,
Properties props, PMetaData metaData) throws SQLException {
+ if( props != null &&
props.getProperty(PhoenixRuntime.TENANT_ID_ATTRIB) != null ) {
+ //java.util.properties has a copy constructor but that doesn't
do a deep copy.
+ // Instead it holds the props passed into the copy constructor
as a reference(defaults) which is pretty much immutable.
+ // The tenantId might either be in a given property map or the
property map it wraps.
+ if(props.containsKey(PhoenixRuntime.TENANT_ID_ATTRIB)) {
--- End diff --
I actually don't need another if/else block inside. The else block will
work in both cases. just trying to avoid creating another copy if I don't have
to, since PhoenixConnection's constructor creates a wrapper anyways.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---