New transaction checks error when stamping #417
Comments
Michael Bayer (@zzzeek) wrote: Ugh, it is probably a regression. That method is tested so not sure why it wasn't raising. I can't look at it until tomorrow :( |
Michael Bayer (@zzzeek) wrote: oh ok, you have another transaction that's not normally part of env.py. I guess the check I added should test beforehand that there's not a transaction :). |
Michael Bayer (@zzzeek) wrote: https://gerrit.sqlalchemy.org/324 . It would be super helpful if you could confirm this works on your end. I'll try to release tomorrow. |
Julien Danjou wrote: I've tested the patch Mike:
The patch is a go. I repeat, the patch is a go. jd over. :) |
Dave McDaniel wrote: The patch seems to fix this error for me as well. |
Michael Bayer (@zzzeek) wrote: Don't raise on open transaction if we already started in one An adjustment to the bug fix for Change-Id: I3c1fa614495b61532999a84b2af3773e4d33c30b → cfb9d34 |
Changes by Michael Bayer (@zzzeek):
|
Migrated issue, originally created by Julien Danjou
Hi Mike,
So a recent commit included in 0.9.0:
https://bitbucket.org/zzzeek/alembic/commits/3f070ea17fa9f5618a299637421d73be6e98d2e5
broke our migration script this way:
alembic.util.exc.CommandError: Migration "stamp_revision -> 1e1a63d3d186" has left an uncommitted transaction opened; transactional_ddl is False so Alembic is not committing transactions
Full log:
http://logs.openstack.org/10/438810/12/check/gate-gnocchi-tox-py27-mysql-ubuntu-xenial/4f5b49d/console.html#_2017-02-28_18_30_27_537440
The code is stamping with "head" (that's 1e1a63d3d186). To do so it uses this migration code in env.py:
https://github.com/openstack/gnocchi/blob/master/gnocchi/indexer/alembic/env.py#L59-L80
and the problem is that since the migrations are run in a global transaction, that does not work anymore. Removing the transaction here makes the migration unsafe for an online migration AFAICT.
So… I understand why the check is there but I'm not sure whetever we need to fix our code or if the check is too aggressive or in the wrong place, or if it's a corner case. Hint appreciated. :)
The text was updated successfully, but these errors were encountered: