← Back to team overview

yahoo-eng-team team mailing list archive

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

 

Public bug reported:

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 deleted 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)

** Affects: nova
     Importance: Undecided
     Assignee: Belmiro Moreira (moreira-belmiro-email-lists)
         Status: New

** Changed in: nova
     Assignee: (unassigned) => Belmiro Moreira (moreira-belmiro-email-lists)

-- 
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):
  New

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 deleted 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


Follow ups