On Thu, Apr 19, 2012 at 07:32:15PM +0200, Bernhard M. Wiedemann wrote:
On 04/12/2012 02:35 PM, J. Daniel Schmidt wrote:
Dear Developers,
While testing our SUSE OpenStack packages we hit a nasty bug and
reported it as: https://bugs.launchpad.net/keystone/+bug/972502
We found out that the underlying cause was a lack of referential
integrity[1] using sqlite or mysql. When we tried to reproduce this
issue on postgresql the usage of foreign keys greatly helped to
find the cause.
In order to prevent further inconsistencies we created a patch that
added more foreign keys: https://review.openstack.org/6216
One reviewer commented:
i don't approve of adding foreign keys, and we should probably
remove the existing ones (in UserTenantMembership and in
Endpoint)
and on
https://review.openstack.org/#patch,sidebyside,6216,3,keystone/identity/backends/sql.py
we shouldn't be using foreign keys at all, they are a crutch that are not
available everywhere
This was a surprising answer to us as the usage of the foreign keys
revealed the inconsistency in the first place. So removing them
elsewhere does in no way improve the situation, it even does not
help for mysql and sqlite, as SQLAlchemy abstracts them away. We
also found similar bugs elsewhere:
* https://bugs.launchpad.net/keystone/+bug/959294 *
https://bugs.launchpad.net/keystone/+bug/973243 *
https://bugs.launchpad.net/keystone/+bug/974199
In our point of view foreign keys should be used in all possible
places. This would not harm any database that does not support them
but helps all of us to find data inconsistencies and related bugs,
which leads to faster development with fewer bugs.
What is your take on these things? How would you take care of data
consistency otherwise?
Thank you for your feedback, Berhard M. Wiedemann J. Daniel
Schmidt
[1]: http://en.wikipedia.org/wiki/Referential_integrity
Just saw another bug, that would have been caught earlier with foreign
keys:
https://bugs.launchpad.net/nova/+bug/754900
So was this issue discussed on the OpenStack Summit?
Yes, I raised this in the Standardizing database management across
projects[1] session and everybody attending that sessions agreed that
it's a good idea.
However, https://review.openstack.org/#/c/6216/ is still open ;(
Best
Christoph
[1]
http://folsomdesignsummit2012.sched.org/event/40adf6c240f7ed1fab82e19e8e55dc24
--
Christoph Thiel, Project Manager, SUSE Cloud Infrastructure
SUSE LINUX Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help : https://help.launchpad.net/ListHelp