← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1745360] Re: DB Upgrade: Validation missing to check if E/M already executed

 

Reviewed:  https://review.openstack.org/540736
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=5a5762b71c978312d2b00c1cbc6b382fe35ee30e
Submitter: Zuul
Branch:    master

commit 5a5762b71c978312d2b00c1cbc6b382fe35ee30e
Author: shilpa.devharakar <shilpa.devharakar@xxxxxxxxxxx>
Date:   Fri Feb 9 11:58:07 2018 +0530

    Add validation to check if E-M-C is already in sync
    
    If you run expand and migrate commands for the second time,
    it should return a user friendly message instead of attempting
    to upgrade db again.
    
    Added a check to confirm if expand and migrate are already in
    sync and return a user friendly message.
    
    Closes-Bug: #1745360
    Change-Id: Iaf2e8ae2004db03f9b7498a2c498360fec096066


** Changed in: glance
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1745360

Title:
  DB Upgrade: Validation missing to check if E/M already executed

Status in Glance:
  Fix Released

Bug description:
  Description
  ===========
  There is no any validation present to check if Database is already expanded/migrated or contracted.
  There has to be validation check so that system should not undergo in re-running expand/migrate or contract scripts if already executed.
  Re-running same scripts causes Internal Errors so we should restrict reprocessing expand/migrate or contract scripts.

  Steps to reproduce
  ==================
  Let’s say if expand is run, and column is already altered, re-altering the same will throw Internal Error.
  If you try to run 'glance-manage db_sync expand' command while upgrading from ocata to pike then it fails with below error:
   INFO [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_expand01, add visibility to images
   DBError: (pymysql.err.InternalError) (1060, u"Duplicate column name 'visibility'") [SQL: u"ALTER TABLE images ADD COLUMN visibility ENUM('private','public','shared','community')"]
  Here ocata_expand01 is already processed, and system trying to re run the same and results into issue.

  Expected result
  ===============
  If expand/migrate is already executed, appropriate message should be delivered to operator.

  Actual result
  =============
  On blank DB verified with queens empty scripts, below are the results:

  EXPAND >> If we run glance-manage db expand, expand will execute with below message
   Upgraded database to: queens_expand01, current revision(s): queens_expand01
  If we again run glance-manage db expand, expand will again exeute with below message
   Upgraded database to: queens_expand01, current revision(s): queens_expand01

  MIGRATE >> Then we proceed with migrate, glance-manage db migrate, it will execute with below message
   Migrated 0 rows		....Since no pending migrations.
  If we again run glance-manage db migrate, migrate will again exeute with below message
   Migrated 0 rows		....Since no pending migrations.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1745360/+subscriptions


References