Reviewed:  https://review.opendev.org/c/openstack/keystone/+/930589
Committed: 
https://opendev.org/openstack/keystone/commit/5125d9feed8dc8f9f0ad01f4c042594475f5fb84
Submitter: "Zuul (22348)"
Branch:    master

commit 5125d9feed8dc8f9f0ad01f4c042594475f5fb84
Author: Dmitriy Rabotyagov <dmitriy.rabotya...@cleura.com>
Date:   Thu Sep 26 16:36:06 2024 +0200

    Fix DB migrations after alembic integration
    
    With a change to swap sqlalchemy-migrate with alembic [1]
    a `db_sync --check` was broken.
    
    This is due to both `upgrades.get_db_version` and
    `upgrades.get_current_heads` are actually checking "current" state of
    the dabase by calling _get_current_heads[2][3], while obvious intention
    was to compare intended state with current state.
    
    With that we're introducing upgrade.get_head_revisions which will fetch
    revisions not from the database, but from the environment [4]
    
    As a result `db_sync --check` does compare desired state of the DB with
    actual state and exists with corresponsive status again.
    
    [1] 
https://opendev.org/openstack/keystone/commit/f174b4fa7c4fb010bbacc8c5a5f3625a8fcb41f3
    [2] 
https://opendev.org/openstack/keystone/src/branch/master/keystone/common/sql/upgrades.py#L147
    [3] 
https://opendev.org/openstack/keystone/src/branch/master/keystone/common/sql/upgrades.py#L191
    [4] 
https://alembic.sqlalchemy.org/en/latest/api/runtime.html#alembic.runtime.environment.EnvironmentContext.get_head_revisions
    
    Closes-Bug: #2080542
    Change-Id: I854d37e3b4a34a7880f157564466bde61a3f886a


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

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/2080542

Title:
  db_sync --check does not detect new db versions

Status in OpenStack Identity (keystone):
  Fix Released

Bug description:
  Steps to reproduce:

  1. Upgrade keystone from zed to bobcat
  2. Run keystone-manage db_sync --check

  Expected:

  Expand: 29e87d24a316 (head: 11c3b243b4cb)
  Contract: e25ffa003242 (head: c88cdce8f248)
  Return status 2

  Observed:

  Expand: 29e87d24a316 (head: 29e87d24a316)
  Contract: e25ffa003242 (head: e25ffa003242)
  Return status 0

  Running db_sync correctly migrates the database; however our scripts
  relied on --check and reported that it is not necessary.

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


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to