----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/35211/#review87048 -----------------------------------------------------------
Ship it! Ship It! - Nate Cole On June 8, 2015, 10:34 a.m., Tom Beerbower wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/35211/ > ----------------------------------------------------------- > > (Updated June 8, 2015, 10:34 a.m.) > > > Review request for Ambari, Jonathan Hurley and Nate Cole. > > > Bugs: AMBARI-11788 > https://issues.apache.org/jira/browse/AMBARI-11788 > > > Repository: ambari > > > Description > ------- > > The field names given to the view entites are used as is for the attribute > names of the dynamic entities that we generate. If a reserved word is used, > it will cause an error when the backing table is created. > > We use eclipselink dynamic JPA to generate the tables. Unfortunately, that > code tests for a table's existence by issuing the create table statement and > catching any Exception. If any exception it thrown (including SQL syntax > error) it assumes that the table exists and just continues on without > propagating any error. > The exception that we see is when we try to read from or store to the data > store with one of those entities. Since the table doesn't exist, the query > fails. > > The fix here is to add a prefix to the names of the view entity memebers so > that we avoid keywords when we genrate the dynamic entity attributes. For > backwards compatibility, we add a flag so that any new instances will use the > altered names but existing view instances will continue to use the unaltered > names. > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java > dc3876c > > ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java > cd842fe > ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java > ae68096 > > ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java > 6b4cc76 > ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql fb69bb3 > ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 683506e > ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 6febff2 > ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql > 8682e0e > ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql cb18fc4 > > ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewInstanceEntityTest.java > 6110a66 > > ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java > d967694 > > ambari-server/src/test/java/org/apache/ambari/server/view/persistence/DataStoreImplTest.java > 2ec0442 > > Diff: https://reviews.apache.org/r/35211/diff/ > > > Testing > ------- > > Manual tested. > > New unit tests added. > > mvn clean test > > all pass ... > > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 50:48 min > [INFO] Finished at: 2015-06-08T08:27:39-04:00 > [INFO] Final Memory: 54M/1471M > [INFO] > ------------------------------------------------------------------------ > > > Thanks, > > Tom Beerbower > >
