My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1553: Exception on SQL to drop unused objects when upgrading to 2.5-rc0
3 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by OdinG...@gmail.com, Sep 7, 2012
Affected Version: 2.5-rc0

I upgraded from 2.4-rc1 and on the last step of the process, the database cleanup threw an exception:

--cut--

Upgrading database schema from version 64 to 65 ...
Upgrading database schema from version 65 to 66 ...
Upgrading database schema from version 66 to 67 ...
Update ownerGroupId to ownerGroupUUID
Upgrading database schema from version 67 to 68 ...
Upgrading database schema from version 68 to 69 ...
Upgrading database schema from version 69 to 70 ...
Upgrading database schema from version 70 to 71 ...
Upgrading database schema from version 71 to 72 ...
Execute the following SQL to drop unused objects:

  DROP TABLE contributor_agreements;
  DROP TABLE account_agreements;
  DROP TABLE account_group_agreements;
  ALTER TABLE accounts DROP COLUMN display_patch_sets_in_reverse_order;
  ALTER TABLE accounts DROP COLUMN display_person_name_in_review_category;
  ALTER TABLE account_groups DROP COLUMN owner_group_id;
  ALTER TABLE account_groups DROP COLUMN external_name;
  ALTER TABLE account_groups DROP COLUMN email_only_authors;
  ALTER TABLE tracking_ids DROP COLUMN tracking_id;

Execute now [Y/n]? 
Exception in thread "main" com.google.gwtorm.server.OrmException: Cannot apply SQL
ALTER TABLE accounts DROP COLUMN display_patch_sets_in_reverse_order
	at com.google.gwtorm.jdbc.JdbcExecutor.execute(JdbcExecutor.java:44)
	at com.google.gerrit.pgm.Init$SiteRun.upgradeSchema(Init.java:228)
	at com.google.gerrit.pgm.Init.run(Init.java:79)
	at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:67)
	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:616)
	at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:168)
	at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:92)
	at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
	at Main.main(Main.java:25)
Caused by: org.h2.jdbc.JdbcSQLException: Column may be referenced by "PUBLIC.DISPLAY_PATCH_SETS_IN_REVERSE_ORDER_CHECK"; SQL statement:
ALTER TABLE accounts DROP COLUMN display_patch_sets_in_reverse_order [90083-147]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
	at org.h2.message.DbException.get(DbException.java:167)
	at org.h2.message.DbException.get(DbException.java:144)
	at org.h2.table.Table.checkColumnIsNotReferenced(Table.java:478)
	at org.h2.command.ddl.AlterTableAlterColumn.update(AlterTableAlterColumn.java:129)
	at org.h2.command.CommandContainer.update(CommandContainer.java:69)
	at org.h2.command.Command.executeUpdate(Command.java:201)
	at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:178)
	at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:153)
	at com.google.gwtorm.jdbc.JdbcExecutor.execute(JdbcExecutor.java:42)
	... 11 more

Oct 3, 2012
#1 s.x...@sta.samsung.com
have the same issue with 2.4.2 upgrade to 2.5.0-rc0

Feb 19, 2013
Project Member #2 jaysoff...@gmail.com
Ditto for upgrading from 2.4.2 to 2.5.2
Feb 19, 2013
Project Member #3 jaysoff...@gmail.com
Work-around. Answer "N" to the "Execute now" prompt. Start gerrit and run gsql. Then use this SQL:

  DROP TABLE contributor_agreements;
  DROP TABLE account_agreements;
  DROP TABLE account_group_agreements;
  ALTER TABLE accounts DROP CONSTRAINT display_patch_sets_in_reverse_order_check;
  ALTER TABLE accounts DROP COLUMN display_patch_sets_in_reverse_order;
  ALTER TABLE accounts DROP CONSTRAINT display_person_name_in_review_category_check;
  ALTER TABLE accounts DROP COLUMN display_person_name_in_review_category;
  ALTER TABLE account_groups DROP COLUMN owner_group_id;
  ALTER TABLE account_groups DROP COLUMN external_name;
  ALTER TABLE tracking_ids DROP COLUMN tracking_id;

(This just drops the constraints first.)

Sign in to add a comment

Powered by Google Project Hosting