You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Thomas D'Silva (JIRA)" <ji...@apache.org> on 2016/04/27 02:41:12 UTC

[jira] [Updated] (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:all-tabpanel ]

Thomas D'Silva updated PHOENIX-2852:
------------------------------------
    Attachment: PHOENIX-2852.patch

[~samarthjain] Can you please review. I added a method getConnectionOnServer that sets the NO_UPGRADE_ATTRIB automatically.

@James I also modified MetaDataRegionObserver to use the new getConnectionOnServer() and removed getJdbcUrl()

Thanks,
Thomas

> 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
>         Attachments: PHOENIX-2852.patch
>
>
> 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)