[openstack-dev] [nova] FKs in the DB

Alexis Lee lxsli at hpe.com
Mon Nov 23 11:10:47 UTC 2015


Matt Riedemann said on Fri, Nov 20, 2015 at 12:58:55PM -0600:
> On 11/20/2015 10:19 AM, Alexis Lee wrote:
> >Should we drive one way or the other, or just put up with mixed-mode?
> For the record, I hate the mixed mode.

+1

> >What should be the policy for new relations?
> I prefer consistency, so if we're adding new relationships I'd
> prefer to see that they have foreign keys.

This seems to align with what Mike's saying. I'll see about a patch to
add a FK to bw_usage_cache. I have a horrible feeling dansmith will be
smacking me on the nose soon but c'est la vie Nova.

> >Do the answers to these questions depend on having a sane and
> >comprehensive archive/purge system in place?
> 
> I'm not sure. The problems this is causing with archive/purge is
> that I thought to fix archive all we had to do was reverse sort the
> tables, which was working until it turned out we weren't soft
> deleting instance_actions. But now it also turns out that we aren't
> soft deleting bw_usage_cache *and* we don't have a FKey from that
> back to the instances table, so it's just completely orphaned and
> never archived or deleted, thus leaving that task up to the
> xenserver operator (since the xenserver driver is the only one that
> implements the virt driver API to populate this table).
> 
> So again, now we have to have special hack code paths in the
> archive/purge code to account for this mixed mode schema.

Are you using the schema to decide how to archive/purge? I thought you
just had a big list of tables?

Anyway it seems like having the FK is both more consistent and makes
your life easier, so let's add it.


Alexis (lxsli)
-- 
Nova developer, Hewlett-Packard Limited.
Registered Office: Cain Road, Bracknell, Berkshire RG12 1HN.
Registered Number: 00690597 England
VAT number: GB 314 1496 79



More information about the OpenStack-dev mailing list