IntegrityError occurs in archiving tables after a resized VM instance was deleted

Bug #1584702 reported by Takashi NATSUME on 2016-05-23
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Medium
Takashi NATSUME
Nominated for Mitaka by Takashi NATSUME

Bug Description

After a resized VM instance was deleted, IntegrityError occurs when archiving tables (nova-manage db archive_deleted_rows).

[How to reproduce]
stack@devstack-master:~/nova$ openstack server list
+--------------------------------------+---------+--------+--------------------------------+
| ID | Name | Status | Networks |
+--------------------------------------+---------+--------+--------------------------------+
| 3a77cd99-3ee0-45af-a301-1016907efaba | server1 | ACTIVE | public=10.0.2.195, 2001:db8::3 |
+--------------------------------------+---------+--------+--------------------------------+
stack@devstack-master:~/nova$ openstack server resize --flavor m1.small server1
stack@devstack-master:~/nova$ openstack server resize --confirm server1
stack@devstack-master:~/nova$ openstack server delete server1

mysql> select instance_uuid, migration_type, status, deleted from migrations;
+--------------------------------------+----------------+-----------+---------+
| instance_uuid | migration_type | status | deleted |
+--------------------------------------+----------------+-----------+---------+
| 3a77cd99-3ee0-45af-a301-1016907efaba | resize | confirmed | 0 |
+--------------------------------------+----------------+-----------+---------+
1 row in set (0.00 sec)

mysql> select uuid, deleted from instances;
+--------------------------------------+---------+
| uuid | deleted |
+--------------------------------------+---------+
| 3a77cd99-3ee0-45af-a301-1016907efaba | 1 |
+--------------------------------------+---------+
1 row in set (0.00 sec)

stack@devstack-master:~/nova$ nova-manage db archive_deleted_rows 1000
2016-05-23 19:23:08.434 WARNING nova.db.sqlalchemy.api [-] IntegrityError detected when archiving table instances: (pymysql.err.IntegrityError) (1451, u'Cannot delete or update a parent row: a foreign key constraint fails (`nova`.`migrations`, CONSTRAINT `fk_migrations_instance_uuid` FOREIGN KEY (`instance_uuid`) REFERENCES `instances` (`uuid`))') [SQL: u'DELETE FROM instances WHERE instances.id in (SELECT T1.id FROM (SELECT instances.id \nFROM instances \nWHERE instances.deleted != %(deleted_1)s ORDER BY instances.id \n LIMIT %(param_1)s) as T1)'] [parameters: {u'param_1': 971, u'deleted_1': 0}]

mysql> select instance_uuid, migration_type, status, deleted from migrations;
+--------------------------------------+----------------+-----------+---------+
| instance_uuid | migration_type | status | deleted |
+--------------------------------------+----------------+-----------+---------+
| 3a77cd99-3ee0-45af-a301-1016907efaba | resize | confirmed | 0 |
+--------------------------------------+----------------+-----------+---------+
1 row in set (0.00 sec)

mysql> select uuid, deleted from instances;
+--------------------------------------+---------+
| uuid | deleted |
+--------------------------------------+---------+
| 3a77cd99-3ee0-45af-a301-1016907efaba | 1 |
+--------------------------------------+---------+
1 row in set (0.00 sec)

[Environment]
OS: Ubuntu 14.04 LTS(64bit)
nova: master (commit 2505c5d8b1d9c075e20275ee903657640cc97c92)

Changed in nova:
assignee: nobody → Takashi NATSUME (natsume-takashi)
Changed in nova:
status: New → Confirmed

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

Changed in nova:
status: Confirmed → In Progress
melanie witt (melwitt) on 2016-09-13
Changed in nova:
importance: Undecided → Medium
tags: added: nova-manage
melanie witt (melwitt) on 2016-09-13
tags: added: newton-rc-potential
melanie witt (melwitt) wrote :

Apparently, this isn't a regression.

tags: removed: newton-rc-potential
Matt Riedemann (mriedem) on 2016-09-14
tags: added: newton-backport-potential

Reviewed: https://review.openstack.org/323684
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1dfd79495e565eda3997b0a272c594a8d2c422d4
Submitter: Jenkins
Branch: master

commit 1dfd79495e565eda3997b0a272c594a8d2c422d4
Author: Takashi NATSUME <email address hidden>
Date: Thu Sep 15 09:21:10 2016 +0900

    Fix an error in archiving 'migrations' table

    Add soft deleting 'migrations' table when the VM instance is deleted.
    And add soft deleting 'migrations' table when archiving deleted rows
    for the case to upgrade.

    Change-Id: Ica35ce2628dfcf412eb097c2c61fdde8828e9d90
    Closes-Bug: #1584702

Changed in nova:
status: In Progress → Fix Released

This issue was fixed in the openstack/nova 14.0.0.0rc1 release candidate.

This issue was fixed in the openstack/nova 14.0.0.0rc1 release candidate.

Change abandoned by Lee Yarwood (<email address hidden>) on branch: stable/mitaka
Review: https://review.openstack.org/384796
Reason: Hello Takashi,

stable/mitaka has now entered phase II support [1][2], only accepting critical bugfixes and security patches. As this review does not meet these criteria it is being abandoned at this time.

However please reopen this review if you feel it is still suitable for stable/mitaka and the nova-stable-maint team will revisit this decision.

[1] http://docs.openstack.org/project-team-guide/stable-branches.html#support-phases
[2] https://releases.openstack.org/#release-series

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers