Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-3461

Stash upgrade task does not check for database schema validity

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Low
    • None
    • 2.3.0
    • Database Support

    Description

      Currently Stash does not check for the database schema against the build number to ensure it's in a consistent state with the one expected for that version.
      In case of a failed upgrade attempt, the db schema can contian extra/new tables that should not be present in a particular version or should only be added after an upgrade. The upgrade fails as the tables already exist (not using a new database schema for the restore). This can leave the database in an inconsistent state.
      For example, this error was reported when upgrading from Stash 2.0.3 to 2.3:

      2013-04-02 17:32:43,419 ERROR [localhost-startStop-1]  liquibase Change Set liquibase/r2_2/m01.xml::STASHDEV-2892-1::tbright failed.  Error: Error executing SQL CREATE TABLE `stash`.`sta_configured_hook_status` (`id` INT NOT NULL, `repo_id` INT NULL, `hookkey` VARCHAR(255) NOT NULL, `enabled` TINYINT(1) NOT NULL, CONSTRAINT `PK_STA_CONFIGURED_HOOK_STATUS` PRIMARY KEY (`id`), CONSTRAINT `fk_repository_hook_status` FOREIGN KEY (`repo_id`) REFERENCES stash.repository(id) ON DELETE CASCADE): Table 'sta_configured_hook_status' already exists
      liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE `stash`.`sta_configured_hook_status` (`id` INT NOT NULL, `repo_id` INT NULL, `hookkey` VARCHAR(255) NOT NULL, `enabled` TINYINT(1) NOT NULL, CONSTRAINT `PK_STA_CONFIGURED_HOOK_STATUS` PRIMARY KEY (`id`), CONSTRAINT `fk_repository_hook_status` FOREIGN KEY (`repo_id`) REFERENCES stash.repository(id) ON DELETE CASCADE): Table 'sta_configured_hook_status' already exists
      

      Manually deleting the 'sta_configured_hook_status' and 'sta_repo_settings' tables helped resolve the issue.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ganand Gurleen Anand [Atlassian]
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: