You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Samarth Jain (JIRA)" <ji...@apache.org> on 2016/04/22 09:38:12 UTC
[jira] [Commented] (PHOENIX-2852) Dropping columns could trigger
upgrade code on server side
[ https://issues.apache.org/jira/browse/PHOENIX-2852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15253494#comment-15253494 ]
Samarth Jain commented on PHOENIX-2852:
---------------------------------------
I see similar code in MetadataEndpointImpl#dropIndexes().
{code}
// Look for columnToDelete in any indexes. If found as PK column, get lock and drop the
// index and then invalidate it
// Covered columns are deleted from the index by the client
PhoenixConnection connection = null;
try {
connection = table.getIndexes().isEmpty() ? null : QueryUtil.getConnection(
env.getConfiguration()).unwrap(PhoenixConnection.class);
} catch (ClassNotFoundException e) {
}
{code}
Probably worth adding a utility method to get a no-upgrade connection. It also would be prudent to look for other occurrences.
> Dropping columns could trigger upgrade code on server side
> ----------------------------------------------------------
>
> Key: PHOENIX-2852
> URL: https://issues.apache.org/jira/browse/PHOENIX-2852
> Project: Phoenix
> Issue Type: Bug
> Reporter: Samarth Jain
> Assignee: Thomas D'Silva
>
> In MetadataEndPointImpl.java, I noticed that we are obtaining a Phoenix connection by going through the Phoenix driver. This could be dangerous as it could end up triggering the upgrade code.
> {code}
> // check if the view where expression contains the column being dropped and prevent
> // it
> if (existingViewColumn != null && view.getViewStatement() != null) {
> ParseNode viewWhere =
> new SQLParser(view.getViewStatement()).parseQuery().getWhere();
> PhoenixConnection conn=null;
> try {
> conn = QueryUtil.getConnection(env.getConfiguration()).unwrap(
> PhoenixConnection.class);
> } catch (ClassNotFoundException e) {
> }
> {code}
> [~jamestaylor] has added a nice way of getting a phoenix connection without running the upgrade by doing something like this:
> {code}
> final Properties props = new Properties();
> props.setProperty(PhoenixRuntime.NO_UPGRADE_ATTRIB, Boolean.TRUE.toString());
> conn = DriverManager.getConnection(getJdbcUrl(env), props).unwrap(PhoenixConnection.class);
> {code}
> [~tdsilva] - would you mind taking a look? Thanks!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)