← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1727266] Re: archive_deleted_instances is not atomic for insert/delete

 

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 <suryaseetharaman.9@xxxxxxxxx>
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

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

Title:
  archive_deleted_instances is not atomic for insert/delete

Status in OpenStack Compute (nova):
  Fix Released

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)

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


References