Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1202194 - [RFE][keystone]: Prefer to check the constraints in the manager level
Summary: [RFE][keystone]: Prefer to check the constraints in the manager level
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: RFEs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 8.0 (Liberty)
Assignee: RHOS Maint
QA Contact:
URL: https://blueprints.launchpad.net/keys...
Whiteboard: upstream_milestone_none upstream_defi...
Depends On:
TreeView+ depends on / blocked
Reported: 2015-03-16 04:03 UTC by RHOS Integration
Modified: 2016-02-08 17:25 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Last Closed:
Target Upstream Version:

Attachments (Terms of Use)

Description RHOS Integration 2015-03-16 04:03:03 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/keystone/+spec/ondelete-cascade.


ForeignKey is used widely in the SQL backend, when  ForeignKey is normally coupled with ondelete parameter, typical values include CASCADE, DELETE and RESTRICT. 

If no value is given for this parameter, "RESTRICT" is default value which means the parent entry can not be deleted before the child entry is removed, or else the error "ERROR 1451" will be thrown when trying to remove the  parent entry first. In order to make the deletion on the parent entry successfully, we have done something in the driver layer, typically, remove the child at first and then remove the parent. It shows "RESTRICT" is useless in this case, so we can migrate the FK definition from "RESTRICT" to "CASCADE", this will help to reducing database round trips.

For those entities which not allow to remove the parent when it has children, it make sense to define the FK with "RESTRICT" parameters, so the behavior will be  consistent between Keystone manager and DB itself.

As to those enties which remove the parent without removing the children at first, this will prone to exceptions if no "CASCADE" is used.  

Specification URL (additional information):


Note You need to log in before you can comment on or make changes to this bug.