Daan,

If you execute the line "DROP VIEW IF EXISTS `cloud`.`event_view`;" manually, 
does it drop the view? Also can you check if your management server was started 
twice (unlikely)? I can't think of anything else.

In the future we should use "CREATE OR REPLACE VIEW" syntax instead of 
dropping/recreating the view

-Alena.

From: Daan Hoogland <daan.hoogl...@gmail.com<mailto:daan.hoogl...@gmail.com>>
Reply-To: "dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>" 
<dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>>
Date: Monday, November 11, 2013 5:09 AM
To: dev <dev@cloudstack.apache.org<mailto:dev@cloudstack.apache.org>>
Subject: upgrade question

H,

I started doing some upgrade testing and got an exception during startup:

INFO  [cloud.upgrade.DatabaseUpgradeChecker] (Timer-2:) Database
upgrade must be performed from 4.1.1 to 4.2.1-SNAPSHOT
ERROR [utils.db.ScriptRunner] (Timer-2:) Error executing: CREATE VIEW
`cloud`.`event_view` AS     select         event.id,
event.uuid,         event.type,         event.state,
event.description,         event.created,         event.level,
event.parameters,         event.start_id,         eve.uuid start_uuid,
        event.user_id,         event.archived,         user.username
user_name,         account.id account_id,         account.uuid
account_uuid,         account.account_name account_name,
account.type account_type,         domain.id domain_id,
domain.uuid domain_uuid,         domain.name domain_name,
domain.path domain_path,         projects.id project_id,
projects.uuid project_uuid,         projects.name project_name
from         `cloud`.`event`             inner join
`cloud`.`account` ON event.account_id = account.id             inner
join         `cloud`.`domain` ON event.domain_id = domain.id
  inner join         `cloud`.`user` ON event.user_id = user.id
    left join         `cloud`.`projects` ON
projects.project_account_id = event.account_id             left join
      `cloud`.`event` eve ON event.start_id = eve.id
ERROR [utils.db.ScriptRunner] (Timer-2:)
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
'event_view' already exists
ERROR [cloud.upgrade.DatabaseUpgradeChecker] (Timer-2:) Unable to
execute upgrade script:
C:\Users\dhoogland\cloudstack\cloudstack\client\target\utilities\scripts\db\db\schema-410to420.sql
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
'event_view' already exists
    at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:193)
    at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)

etcetera.

I checked the upgrade script which says,


DROP VIEW IF EXISTS `cloud`.`event_view`;
CREATE VIEW `cloud`.`event_view` AS
    select
        event.id,
...

So in theory it should delete the table and not complain about it
already existing. Am I missing something or did I hit a bug? (auto
commit issue maybe?)

regards,
Daan

Reply via email to