Samarth Jain created PHOENIX-2852:
-------------------------------------

             Summary: 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)

Reply via email to