Monday, 2022-06-20

stephenfinzzzeek: How on earth did you find that? Argh, that's so irritating! 😭😭😅09:26
*** dviroel_ is now known as dviroel12:05
opendevreviewStephen Finucane proposed openstack/keystone master: sql: Integrate alembic  https://review.opendev.org/c/openstack/keystone/+/82584412:30
opendevreviewStephen Finucane proposed openstack/keystone master: docs: Update docs to reflect migration to Alembic  https://review.opendev.org/c/openstack/keystone/+/82890512:30
opendevreviewStephen Finucane proposed openstack/keystone master: WIP: sql: Add support for auto-generation  https://review.opendev.org/c/openstack/keystone/+/82614712:30
opendevreviewStephen Finucane proposed openstack/keystone master: tests: Don't monkeypatch functions  https://review.opendev.org/c/openstack/keystone/+/84661212:30
zzzeekstephenfin: testr makes it hard to select for tests so i started by making a subdirectory "migrations" and putting test_* files in there along with the two alembic-oriented ones that kept having sporadic failures14:13
zzzeekstephenfin: that way I could run testr and get failures very fast within a few seconds.   then i set out to just bisect the rest of the files in the owning directory to see which one triggered it, and test_cmd looked like a prime candiate since it's running the commands, which I assumed included the migration commands14:14
zzzeekstephenfin: this went very quickly because your implementation works perfectly great14:14
zzzeekstephenfin: my fear was that something was subtly wrong with the integration, or it would be one of those cases where failure happens if test_X and test_Y are both present, but not one or the other14:15
zzzeekbut it was just that one dumb thing, so kudos that the implementation appears to work great14:15
stephenfinzzzeek++ Nicely done. I was certain it was a shared global issue and got fixated on that. Never even crossed my mind it could be something different. Thanks very much for the assistance there :)15:24
stephenfinzzzeek: Hopefully one final question (low priority): I see this bit of logic in the neutron code https://github.com/openstack/neutron/blob/master/neutron/db/migration/autogen.py#L102-L10915:29
zzzeekdivide and conquer is a tool I reach for quickly15:29
zzzeekstephenfin: so i immediately clicked on blame to say, no idea what that is, lets see who wrote it15:30
zzzeekbig mistake :)15:30
stephenfin7 years is a long time :)15:30
zzzeekstephenfin: im amazed i have absolutely zero recollection of writing code like this15:32
stephenfinJust to confirm, that's saying that only modify nullable alter statements should be allowed during the "expand" phase, right?15:33
zzzeekit appears so.  it looks like this code is classifying migration operations as expansive or contract automatically15:34
stephenfinthat's my thinkin15:34
stephenfin*g15:34
stephenfinIt's all black magic to me, though I'm slowly getting to grips with it thankfully15:34
stephenfinWould a doc/example code on this expand/contract design be useful in the alembic docs? I wasn't able to find anything on the idea other than this neutron code that you wrote :)15:35
stephenfinit's probably not important enough to be alembic core code or it would already be there15:35
zzzeekstephenfin: i would liekly read the blueprint that this code seems to come from15:36
zzzeeki probably wrote it15:36
zzzeekblueprint online-schema-migrations for neutron15:36
*** dviroel is now known as dviroel|lunch15:36
zzzeeki owuld read it too if you know how to find the link15:36
stephenfinAlready in my history from a few months back https://specs.openstack.org/openstack/neutron-specs/specs/liberty/online-schema-migrations.html15:37
stephenfinHowever, it mostly focuses on the "why" rather than the "how" (as a good spec should tbf)15:37
zzzeekstephenfin: the general thing this patch is doing is using an alembic hook called process_revision_directives, which is called only when one calls alembic revision --autogenerate16:21
zzzeekstephenfin: it apepars that it will receive autogenerated migrations and classify them into expand and contract and separate them accordingly16:21
zzzeekthere's not a recipe in the docs for this particular use case right now, I've ceratinly offered to other users they might want to try expand/contract16:23
stephenfinThat's what I've roughly figured out. That bit of logic I linked to earlier is still weird though. Why can't we determine whether a modification to the nullable value is an expand or contract thing?16:23
stephenfinSurely setting something to nullable=True makes the schema more permissive, which means it's an expand, and vice versa?16:24
stephenfinContext is that auto-generation is currently broken for keystone because there are a couple of discrepancies between the schemas and migrations that still need to be cleaned up. You can see me filtering them out in the 'include_object' and 'filter_metadata_diff' methods here16:26
stephenfinhttps://review.opendev.org/c/openstack/keystone/+/825844/8/keystone/tests/unit/common/sql/test_upgrades.py#10116:26
stephenfinsome of which are changes to nullable attributes which bork auto-generation. I can skip these but I'd like to know if it's needed first :)16:26
*** dviroel|lunch is now known as dviroel16:43
zzzeekstephenfin: if i have a nullable column and im setting it to not-null, yes i guess that is a contract and i think that's waht this code is doing already17:39
zzzeekstephenfin: modify_nullable = (False|True) means, "change the nullability"17:39
zzzeekstephenfin: modify_nullable=None means, "dont cahnge the nullability"17:39
zzzeekstephenfin: so that notimpl means, there's an alter column that has no change in nullability and it cant be detected if the alter column is an expand or a contract as a result17:40
mloza1https://docs.openstack.org/api-ref/identity/v3/?expanded=create-application-credential-detail#id113 - this allows me to create app cred in behalf of the user17:59
mloza1just wanted to confirm17:59
*** dviroel is now known as dviroel|afk20:05
*** dviroel|afk is now known as dviroel|out21:05

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!