| Issue 3123: | Schema updates from 2.4.2 to 2.10-rc2 fails | |
| 2 people starred this issue and may be notified of changes. | Back to list |
Affected Version:
2.4.2 and possibly others
Upon attempting to upgrade our old 2.4.2 install to the latest rc I encountered a problem with schema updates.
Upgrading schema to 82 ...
Exception in thread "main" com.google.gwtorm.server.OrmException: Relation accounts does not have show_user_in_review
at com.google.gwtorm.jdbc.JdbcSchema.renameColumn(JdbcSchema.java:165)
at com.google.gerrit.server.schema.Schema_82.renameColumn(Schema_82.java:89)
at com.google.gerrit.server.schema.Schema_82.preUpdateSchema(Schema_82.java:57)
at com.google.gerrit.server.schema.SchemaVersion.updateSchema(SchemaVersion.java:121)
at com.google.gerrit.server.schema.SchemaVersion.upgradeFrom(SchemaVersion.java:87)
at com.google.gerrit.server.schema.SchemaVersion.check(SchemaVersion.java:79)
at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:64)
at com.google.gerrit.pgm.BaseInit$SiteRun.upgradeSchema(BaseInit.java:256)
at com.google.gerrit.pgm.BaseInit.run(BaseInit.java:114)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
at Main.main(Main.java:25)
Upgrading first to 2.9.4 however successful, which in turn allowed for 2.10-rc2 to install flawlessly.
Regression breaking schema updates?
Jan 25, 2015
#1
Thomas.J...@gmail.com
Jan 25, 2015
What database are you using?
Cc:
sasa.ziv...@sap.com
Labels: Blocking-2.10
Jan 25, 2015
(No comment was entered for this change.)
Status:
AwaitingInformation
Jan 25, 2015
Apologies. postgresql 9.1
Jan 26, 2015
Can also be reproduced on the H2. Investigating...
Status:
Accepted
Jan 26, 2015
Schema_82 renamed column to meet max 30 char. length limitation for some databases. Among other columns and indexes, the column `show_username_in_review_category` is renamed to `show_user_in_review`. However, in [1] the target column was dropped. The rename operation doesn't work now, because target column doesn't exist any more. [1] https://gerrit-review.googlesource.com/57350
Jan 26, 2015
In H2 this issue produces a bit different error [1] than the one reported by Thomas but the cause is probably the same. The upgrade starts failing with the 767b128038615bc3b58521e57890c05fc03a0824 which replaces: Schem_98: show_user_in_review > review_category_strategy When migrating from an old enough schema then there is also another column rename in place: Schema_82: show_username_in_review_category > show_user_in_review The problem occurs when migrating from the old state (show_username_in_review_category) to the 2.10-rc2 (review_category_strategy). For the gwtorm this looks like the following replacement: show_username_in_review_category > review_category_strategy and the intermediate state with the show_user_in_review column NEVER exists. Therefore any migration code which wants to update the show_user_in_review (like the Schema_82) is broken. I am not yet sure what the best bugfix in 2.10 should be. We need to modify the schema migration code to migrate directly from show_username_in_review_category to the review_category_strategy in order to make the migration from 2.4.2 to 2.10 working. However, this may then break the migration from 2.9 to 2.10. Maybe we just need to accept that migration from 2.4.2 to 2.10 is not possible and needs to be done in two steps and document that in the release notes. [1] Migrate user preference showUserInReview to reviewCategoryStrategy Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot upgrade schema at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:66) at com.google.gerrit.pgm.BaseInit$SiteRun.upgradeSchema(BaseInit.java:256) at com.google.gerrit.pgm.BaseInit.run(BaseInit.java:114) at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166) at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93) at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50) at Main.main(Main.java:25) Caused by: org.h2.jdbc.JdbcSQLException: Column "SHOW_USER_IN_REVIEW" not found; SQL statement: UPDATE accounts SET REVIEW_CATEGORY_STRATEGY='NAME' WHERE (SHOW_USER_IN_REVIEW='Y') [42122-174] at org.h2.message.DbException.getJdbcSQLException(DbException.java:332) at org.h2.message.DbException.get(DbException.java:172) at org.h2.message.DbException.get(DbException.java:149) at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:144) at org.h2.expression.Comparison.optimize(Comparison.java:177) at org.h2.command.dml.Update.prepare(Update.java:180) at org.h2.command.Parser.prepareCommand(Parser.java:231) at org.h2.engine.Session.prepareLocal(Session.java:437) at org.h2.engine.Session.prepareCommand(Session.java:380) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1138) at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:124) at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:113) at com.google.gerrit.server.schema.Schema_98.migrateData(Schema_98.java:37) at com.google.gerrit.server.schema.SchemaVersion.migrateData(SchemaVersion.java:143) at com.google.gerrit.server.schema.SchemaVersion.upgradeFrom(SchemaVersion.java:88) at com.google.gerrit.server.schema.SchemaVersion.check(SchemaVersion.java:79) at com.google.gerrit.server.schema.SchemaUpdater.update(SchemaUpdater.java:64)
Jan 27, 2015
(No comment was entered for this change.)
Labels:
FixedIn-2.10
Jan 27, 2015
https://gerrit-review.googlesource.com/#/c/63678/
Status:
Released
Cc: -sasa.ziv...@sap.com Labels: -Blocking-2.10 |
|
| ► Sign in to add a comment |