archive_deleted_instances is not atomic for insert/delete

Bug #1727266 reported by Belmiro Moreira
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Surya Seetharaman

Bug Description

Description
===========
Archive deleted instances first moves deleted rows to the shadow
tables and then deletes the rows from the original tables.
However, because it does 2 different selects (to get the rows to insert
and to delete) we can have the case that a row is not inserted in the
shadow table but removed from the original.
This can happen when there are new deleted rows between the insert and
delete.
Shouldn't we delete explicitly only the IDs that were inserted?

See:
    insert = shadow_table.insert(inline=True).\
        from_select(columns,
                    sql.select([table],
                               deleted_column != deleted_column.default.arg).
                    order_by(column).limit(max_rows))
    query_delete = sql.select([column],
                          deleted_column != deleted_column.default.arg).\
                          order_by(column).limit(max_rows)

    delete_statement = DeleteFromSelect(table, query_delete, column)

(...)

            conn.execute(insert)
            result_delete = conn.execute(delete_statement)

Tags: db nova-manage
Changed in nova:
assignee: nobody → Belmiro Moreira (moreira-belmiro-email-lists)
description: updated
Revision history for this message
Takashi Natsume (natsume-takashi) wrote :

Set the status to In-progress because this report has an assignee.

tags: added: db
tags: added: nova-manage
Changed in nova:
status: New → In Progress
Changed in nova:
assignee: Belmiro Moreira (moreira-belmiro-email-lists) → Surya Seetharaman (tssurya)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/526065

melanie witt (melwitt)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/526065
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=6b9d84c926893fd5e9114767d15436c090074388
Submitter: Zuul
Branch: master

commit 6b9d84c926893fd5e9114767d15436c090074388
Author: Surya Seetharaman <email address hidden>
Date: Wed Dec 6 14:25:14 2017 +0100

    archive_deleted_instances is not atomic for insert/delete

    Archive deleted instances first moves deleted rows to the shadow
    tables and then deletes the rows from the original tables.
    However, because it does 2 different selects (to get the rows to
    insert and to delete) we can have the case that a row is not inserted
    in the shadow table but removed from the original. This can happen
    when there are new deleted rows between the insert and delete.

    This patch fixes this by explicitly deleting only those IDs that were
    inserted.

    Change-Id: I4f2e1632aac96afa7ce06908dc30c0716bcb87b2
    Closes-Bug: #1727266

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.0.0b3

This issue was fixed in the openstack/nova 17.0.0.0b3 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.