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

Bug #1745360 reported by Shilpa Devharakar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Shilpa Devharakar

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.

summary: - DB Upgrade: Validation missing to check if E/M/C already executed.
+ DB Upgrade: Validation missing to check if E/M/C already executed
summary: - DB Upgrade: Validation missing to check if E/M/C already executed
+ DB Upgrade: Validation missing to check if E/M already executed
description: updated
description: updated
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :
Changed in glance:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Shilpa Devharakar (shilpasd)
milestone: none → queens-rc3
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

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 <email address hidden>
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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/546076

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/queens)

Reviewed: https://review.openstack.org/546076
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=ff75e08f497d663ce0fb412219ffaeca07b6d7c7
Submitter: Zuul
Branch: stable/queens

commit ff75e08f497d663ce0fb412219ffaeca07b6d7c7
Author: shilpa.devharakar <email address hidden>
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
    (cherry picked from commit 5a5762b71c978312d2b00c1cbc6b382fe35ee30e)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 16.0.0.0rc3

This issue was fixed in the openstack/glance 16.0.0.0rc3 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 17.0.0.0b1

This issue was fixed in the openstack/glance 17.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.