Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1310890

Summary: DB Purge of raw_template fails on constraint from resources.current_template_id
Product: Red Hat OpenStack Reporter: Zane Bitter <zbitter>
Component: openstack-heatAssignee: Zane Bitter <zbitter>
Status: CLOSED ERRATA QA Contact: Amit Ugol <augol>
Severity: high Docs Contact:
Priority: high    
Version: 8.0 (Liberty)CC: augol, cwolfe, jschluet, mburns, rhel-osp-director-maint, sbaker, shardy, ssainkar, yeylon, zbitter
Target Milestone: ga   
Target Release: 8.0 (Liberty)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-heat-5.0.1-2.el7ost Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1306444 Environment:
Last Closed: 2016-04-07 21:30:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1306444    
Bug Blocks:    

Description Zane Bitter 2016-02-22 22:24:28 UTC
+++ This bug was initially created as a clone of Bug #1306444 +++

Description of problem:

The "heat-manage purge_delete" cron job on the undercloud fails when attempting to purge the raw_template table.

Version-Release number of selected component (if applicable):
openstack-heat-common-2015.1.2-4.el7ost.noarch

How reproducible:
Not clear.

Steps to Reproduce:
1. Run /bin/heat-manage purge_deleted manually

Actual results:
A stack trace and the raw_template table is left un-purged.

Expected results:
A purged raw_template table.

2016-02-05 00:03:13.658 15950 ERROR oslo_db.sqlalchemy.exc_filters [-] DBAPIError exception wrapped from (_mysql_exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`heat`.`resource`, CONSTRAINT `current_template_fkey_ref` FOREIGN KEY (`current_template_id`) REFERENCES `raw_template` (`id`))') [SQL: u'DELETE FROM raw_template WHERE raw_template.id NOT IN (SELECT stack.raw_template_id \nFROM stack)']
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters Traceback (most recent call last):
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters     context)
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters   File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters     cursor.execute(statement, parameters)
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters   File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters     self.errorhandler(self, exc, value)
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters   File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters     raise errorclass, errorvalue
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`heat`.`resource`, CONSTRAINT `current_template_fkey_ref` FOREIGN KEY (`current_template_id`) REFERENCES `raw_template` (`id`))')
2016-02-05 00:03:13.658 15950 TRACE oslo_db.sqlalchemy.exc_filters 
ERROR: (_mysql_exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`heat`.`resource`, CONSTRAINT `current_template_fkey_ref` FOREIGN KEY (`current_template_id`) REFERENCES `raw_template` (`id`))') [SQL: u'DELETE FROM raw_template WHERE raw_template.id NOT IN (SELECT stack.raw_template_id \nFROM stack)']

Comment 3 errata-xmlrpc 2016-04-07 21:30:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-0603.html