Replace deprecated EngineFacade from oslo_db

Bug #1479723 reported by Peter Razumovsky
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
In Progress
High
Steve Baker

Bug Description

oslo_db EngineFacade is deprecated now. We should replace it with current https://github.com/openstack/oslo.db/blob/master/oslo_db/sqlalchemy/enginefacade.py in heat/db/sqlalchemy folder

For more information read http://specs.openstack.org/openstack/oslo-specs/specs/kilo/make-enginefacade-a-facade.html

Changed in heat:
assignee: nobody → Peter Razumovsky (prazumovsky)
Angus Salkeld (asalkeld)
Changed in heat:
status: New → Triaged
importance: Undecided → Low
Changed in heat:
milestone: none → next
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

I'm setting this to High because currently every single query is preceded by a SELECT 1 query, and this indicates that every query is happening in its own transaction.

Changed in heat:
importance: Low → High
assignee: Peter Razumovsky (prazumovsky) → Steve Baker (steve-stevebaker)
milestone: next → newton-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/331848

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/331849

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/331942

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master)

Reviewed: https://review.openstack.org/330798
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=4ed43674c16aba14590d86121c0fa507e66c2597
Submitter: Jenkins
Branch: master

commit 4ed43674c16aba14590d86121c0fa507e66c2597
Author: Steve Baker <email address hidden>
Date: Wed Jun 15 17:07:56 2016 +1200

    Be consistent about context first argument in db api

    By ensuring every db api function has the context as its first
    argument, this raises the possiblity of using oslo.db recommended
    session handling:
    http://docs.openstack.org/developer/oslo.db/usage.html#session-handling

    Change-Id: I3649bdbf254e2834e79984cc381a1db1ea9e78b8
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/330799
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=419c9ab994e89551ec3b945ab22b90e53fc14839
Submitter: Jenkins
Branch: master

commit 419c9ab994e89551ec3b945ab22b90e53fc14839
Author: Steve Baker <email address hidden>
Date: Wed Jun 15 17:40:35 2016 +1200

    del _session(), use context.session directly

    There should always be a context supplied, lets use its session
    directly so we can be sure that the session is the shared one from the
    context.

    Any remaining functions which call get_session() directly will be
    handled in their own changes as some require special behaviour.

    Change-Id: I3e52d2ff6bb1014f201715a1b1ba32c122c2391d
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/331848
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=a65bd2b19d3ca17f958231090c391101ff02253f
Submitter: Jenkins
Branch: master

commit a65bd2b19d3ca17f958231090c391101ff02253f
Author: Steve Baker <email address hidden>
Date: Fri Jun 17 12:40:19 2016 +1200

    Replace model_query with direct query call

    The following changes for bug #1479723 may need the flexibility to
    create reader queries with sessions other than the context session.
    Also this function is no longer saving any typing or doing anything
    useful.

    Change-Id: I0242febe97cf1da30fb094cf7a395db6c2f4665a
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/331849
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=9e007acc441d1eb18069cdb6c21102f49c315697
Submitter: Jenkins
Branch: master

commit 9e007acc441d1eb18069cdb6c21102f49c315697
Author: Steve Baker <email address hidden>
Date: Fri Jun 17 15:49:21 2016 +1200

    Add context to stack lock function arguments

    Context is added as the first argument to stack_lock_* db functions
    but is currently ignored for getting the session used for stack lock
    operations.

    This is required later for bug 1479723 but is added in its own change
    here to ease reviewing load.

    Change-Id: Ieb3e4e2ee67150777cbe1e961d0d1806cf1f7e46
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/331850
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=750d4e4df98d34aa477e28f191c6e1e4ff70af6f
Submitter: Jenkins
Branch: master

commit 750d4e4df98d34aa477e28f191c6e1e4ff70af6f
Author: Steve Baker <email address hidden>
Date: Mon Jun 20 11:20:06 2016 +1200

    Minor reorg of sqlalchemy encrypt test functions

    Move the encrypt and decrypt inner functions to the top of the method to
    make it obvious that they don't rely on method scoped variables
    (except hidden_params_dict). Pass encrypt_value as an argument to decrypt
    for its assertions.

    Change-Id: I8f1374a91da83d8d1b86c9d75c4492319051da06
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/331851
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=479cf14010bbc1937509f7eedb4dc56da551f0c0
Submitter: Jenkins
Branch: master

commit 479cf14010bbc1937509f7eedb4dc56da551f0c0
Author: Steve Baker <email address hidden>
Date: Tue Jun 21 16:53:17 2016 +1200

    sqlalchemy tests don't assume same session

    These tests currently rely on existing objects magically updating with
    new values after an action which results in an update query. This
    change refetches objects in preperation for the fix to bug #1479723.
    This is closer in behaviour to how we actually use the db objects in
    other parts of the codebase.

    Change-Id: I303b3b20bd2b82cfeeac771cbb906ae2e6266b17
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/331852
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=26b0dd2a3e712cbc7d5826c8ece73e5732f8746f
Submitter: Jenkins
Branch: master

commit 26b0dd2a3e712cbc7d5826c8ece73e5732f8746f
Author: Steve Baker <email address hidden>
Date: Tue Jun 21 11:00:22 2016 +1200

    Do not populate unused stack and watch rule objects

    These fields are lazy loaded, so cause extra unnecessary database
    access.

    The watch rules are needed when formatting every watch data metric for
    the cloudwatch API, so an id->name map of all rules is built to avoid
    repeated lazy loading of every rule.

    Change-Id: I36dd43172ccd402f08a45b254ae47e208b7b8c08
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/331942
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=b8a529ac976b8bc8143df3fc2898cb06d00ff00a
Submitter: Jenkins
Branch: master

commit b8a529ac976b8bc8143df3fc2898cb06d00ff00a
Author: Steve Baker <email address hidden>
Date: Tue Jun 21 11:37:26 2016 +1200

    Only call session.refresh from within db_api functions

    This change removes the refresh method from the parent db object, and
    adds a refresh boolean argument to db_api.resource_get function (which is
    the only known use of refresh). Constraining refresh calls to be
    inside db_api methods helps with bug #1479723 where the refresh can
    happen under a context manager session.

    Change-Id: I6fc5c03e8572eee90f89455e0925d503514040b3
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/323614
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=3ab0ede98c6dc0c0327977be994c139113fc0489
Submitter: Jenkins
Branch: master

commit 3ab0ede98c6dc0c0327977be994c139113fc0489
Author: Steve Baker <email address hidden>
Date: Fri May 27 17:07:03 2016 +1200

    Always eager load the raw_template for a stack

    The vast majority of stack fetches are immediately followed by a
    raw_template fetch, so this change always eagerly fetches the
    raw_template for every stack fetch.

    During stack versioned object creation the stack's raw_template object
    is used to construct the versioned raw template object.

    Change-Id: I1a6fb8fb7d069b50dd5d623c989acd5582818ae1
    Related-Bug: #1479723
    Related-Bug: #1523748

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/363899

Thomas Herve (therve)
Changed in heat:
milestone: newton-3 → next
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master)

Reviewed: https://review.openstack.org/363899
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=14616c16bea93b3f40ddc5eae8149e88f7144fcf
Submitter: Jenkins
Branch: master

commit 14616c16bea93b3f40ddc5eae8149e88f7144fcf
Author: Steve Baker <email address hidden>
Date: Tue Aug 30 11:30:41 2016 +1200

    raw_template_files_get always use context session

    It is now always called with an admin context so it won't be None

    Change-Id: Ic8924b01b36933b1ce162484092bf3677f7ce13b
    Related-Bug: #1479723

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/330800
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=e6da5b5546ae7e7df1a8946c33d57fec64252a35
Submitter: Jenkins
Branch: master

commit e6da5b5546ae7e7df1a8946c33d57fec64252a35
Author: Steve Baker <email address hidden>
Date: Wed Aug 31 18:05:44 2016 +1200

    Use enginefacade instead of db_session

    This change takes a gradual approach to fixing bug #1479723 by
    creating an enginefacade transaction_context, but mostly still using
    the legacy facade for getting the default session.

    Where a separate independent transaction is needed,
    db_context.writer.independent.using is used instead of get_session.

    The next change will decorate the db api functions with reader and
    writer so queries in a function are performed in a single transaction.

    Change-Id: If92788641d84b7314ed7ad1f8cb0e141fa1a8681
    Partial-Bug: #1479723

Rico Lin (rico-lin)
Changed in heat:
milestone: next → pike-1
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-1 → pike-2
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-2 → pike-3
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-3 → pike-rc1
Rabi Mishra (rabi)
Changed in heat:
milestone: pike-rc1 → next
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.