> On Dec. 12, 2016, 9:37 p.m., Jonathan Hurley wrote: > > ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java, > > line 1555 > > <https://reviews.apache.org/r/54674/diff/1/?file=1582171#file1582171line1555> > > > > Because this is changing data, should the data manipulation be wrapped > > in an `executeInTransaction(Runnable)` ? > > Dmytro Grinenko wrote: > moreover, i'm not sure that @Transactional annotation will have any > effect on DDL changes via dbAccessor or any other way to make schema changes > in scope of database transaction. (not all database engines support this) > > Dmytro Grinenko wrote: > P.S. i mean revert of schema alteration, as MySQL for exmple done > explicit commit on alter commands > > Attila Doroszlai wrote: > `@Transactional` on these 2 methods was ignored by Guice until they were > changed from `private` to default visibility recently (AMBARI-18966). The > cause of the NPE is that the persistence service, which creates > `EntityManagerFactory`, is only > [started](https://github.com/apache/ambari/blob/branch-2.5/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java#L426) > after [performing DDL > upgrade](https://github.com/apache/ambari/blob/branch-2.5/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java#L424). > > As Dmytro mentioned, not all databases support transactional DDL: > > * [PostgreSQL: > OK](https://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis) > * [MySQL: > NO](http://dev.mysql.com/doc/refman/5.7/en/cannot-roll-back.html) > * [Oracle: > NO](https://docs.oracle.com/cd/B14117_01/server.101/b10759/statements_1001.htm)
ReviewBoard ate my link for PostgreSQL: https://wiki.postgresql.org/wiki/Transactional_DDL_in_PostgreSQL:_A_Competitive_Analysis - Attila ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/54674/#review158900 ----------------------------------------------------------- On Dec. 12, 2016, 9:01 p.m., Attila Doroszlai wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/54674/ > ----------------------------------------------------------- > > (Updated Dec. 12, 2016, 9:01 p.m.) > > > Review request for Ambari, Jonathan Hurley, Sebastian Toader, and Sid Wagle. > > > Bugs: AMBARI-19170 > https://issues.apache.org/jira/browse/AMBARI-19170 > > > Repository: ambari > > > Description > ------- > > Removed @Transactional > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java > 063c29539e135433b7b9ce37fa5c32d0de2234f8 > > Diff: https://reviews.apache.org/r/54674/diff/ > > > Testing > ------- > > Installed 2.2.2.0-460, upgraded to 2.5.0.0-453. > > ``` > [root@c6401 ~]# ambari-server upgrade > Using python /usr/bin/python > Upgrading ambari-server > INFO: Upgrade Ambari Server > INFO: Updating Ambari Server properties in ambari.properties ... > INFO: Updating Ambari Server properties in ambari-env.sh ... > WARNING: Original file ambari-env.sh kept > INFO: Fixing database objects owner > Ambari Server configured for Embedded Postgres. Confirm you have made a > backup of the Ambari Server database [y/n] (y)? y > INFO: Upgrading database schema > INFO: Return code from schema upgrade command, retcode = 0 > INFO: Schema upgrade completed > Adjusting ambari-server permissions and ownership... > Ambari Server 'upgrade' completed successfully. > ``` > > > Thanks, > > Attila Doroszlai > >