[openstack-dev] [nova] changing old migrations is verboten
john at johngarbutt.com
Fri Nov 1 10:27:45 UTC 2013
On 31 October 2013 16:57, Johannes Erdfelt <johannes at erdfelt.com> wrote:
> On Thu, Oct 31, 2013, Sean Dague <sean at dague.net> wrote:
>> So there is a series of patches starting with -
>> https://review.openstack.org/#/c/53417/ that go back and radically
>> change existing migration files.
I initially agreed with the -2, but actually I like this change, but I
will get to that later.
>> This is really a no-no, unless there is a critical bug fix that
>> absolutely requires it. Changing past migrations should be
>> considered with the same level of weight as an N-2 backport, only
>> done when there is huge upside to the change.
>> I've -2ed the first 2 patches in the series, though that review
>> applies to all of them (I figured a mailing list thread was probably
>> more useful than -2ing everything in the series).
>> There needs to be really solid discussion about the trade offs here
>> before contemplating something as dangerous as this.
> The most important thing for DB migrations is that they remain
> functionality identical.
We really should never change what the migrations functionally do.
Admittedly we should ensure we don't change something "by accident",
so I agree with minimizing the changes in those files also.
> Historically we have allowed many changes to DB migrations that kept
> them functionally identical to how they were before.
> Looking through the commit history, here's a sampling of changes:
> - _ was no longer monkey patched, necessitating a new import added
> - fix bugs causing testing problems
> - change copyright headers
> - remove unused code (creating logger, imports, etc)
> - fix bugs causing the migrations to fail to function (on PostgreSQL,
> downgrade bugs, etc)
> - style changes (removing use of locals(), whitespace, etc)
> - make migrations faster
> - add comments to clarify code
> - improve compatibility with newer versions of SQLAlchemy
> The reviews you're referencing seem to fall into what we have
> historically allowed.
+1 The patch is really just refactoring.
I think we should move to the more descriptive field names, so we
remove the risk of cut and paste errors in string length, etc.
Now, if we don't go back and add those into the migrations, people
will just cut and paste examples from the old migrations, and
everything will start getting quite confusing. I would love to say
that wasn't true, be we know that's how it goes.
> That said, I do agree there needs to be a higher burden of proof that
> the change being made is functionally identical to before.
+1 and Rick said he has inspected the MySQL and PostgreSQL tables to
ensure he didn't change anything.
More information about the OpenStack-dev