-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-5771] Straighten out alembic migrations #6442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
PTAL @dstandish |
|
Sorry @Fokko nitpicking: can you ensure the reason for the change is in the commit message? And is an empty upgrade really the way to fix this? It looks... Dirty. Was AIP-24 already in a release? |
cd439a1 to
7e5018b
Compare
|
@bolkedebruin Thanks. As we say in Dutch: feedback is een cadeautje. I've updated @kaxil's migration to add the other head as well, which also solved the issue. I've updated commit and the description. |
Codecov Report
@@ Coverage Diff @@
## master #6442 +/- ##
==========================================
- Coverage 83.85% 83.67% -0.18%
==========================================
Files 627 627
Lines 36537 36537
==========================================
- Hits 30639 30574 -65
- Misses 5898 5963 +65
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha I didnt even know that is possible :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But can't we adjust the head of AIP-24 btw? That would not make the double reference required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we change the head of AIP-24, then we detach another head.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alembic migrations are a DAG as well :-)
|
I would leave the result out of the commit message (the 'before' 'after' stuff, I dont consider that required) |
|
AIP-24 is not part of 1.10.6 so updating head should be fine :) |
Remove branchpoints to make it lineair again.
7e5018b to
a3fda6b
Compare
|
Updated the earlier unreleased migrations to get everything linear again. So we don't have to merge again from any branchpoints. |
|
I'm not quite sure when we might actually want to have multiple heads? If there is never a case Airflow would want this then is it worth adding a unit test (like we have to ensure model and migrations are in sync) to ensure there is just one head? |
|
We never want to have multiple heads. But sometimes it happens when someone works on a (long running) feature, and from a single revision, two migrations are being branched. For simplicity, you never want to have multiple heads I'd say. @dstandish suggested adding the following unit test: https://blog.jerrycodes.com/multiple-heads-in-alembic-migrations/. This one will detect when we have multiple heads, and fail. |
|
Yes we should have that unit test and this is going to be a common thing as we would all be now working on big 2.0 features |
|
Dutch idiom: I don't want to mow the grass in front of @dstandish 's feet. As in, I would like to give him the opportunity to add the test himself :-) |
|
Haha, I like the idiom |
|
Haha ok I'll add 😊 |
feluelle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I am also for having tests there to check for multiple heads.
P.S. Great blog post btw.
potiuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I am happy to cherry-pick it to 1.10.* for 1.10.7 possibly :)
|
Thanks @potiuk and @feluelle for the review. I think we should CP this one and #6449 onto the 1.10.x branch. If you feel like doing it @potiuk, feel free, but it might be tricky since the hashes are different over there. It might be better to just resolve it over there based on the output of |
|
Yeah. I will cherry-pick (or redo ;) ) both PRs. I am now working on cherry-picking kind-related changes after 1.10.6 is released so I will add those two. |
|
Doesn't rewriting the lineage in this way create a problem for anyone who has already deployed a released version which contains the multiple heads, such as 1.10.5? Multiple heads leads to multiple rows in the |
|
Further - just tried doing an upgrade to 1.10.6 followed by an upgrade to master: Result is I think this demonstrates the issue. |
|
@mattinbits Yes, you are right. This PR needs to sync up with what we have in v1-10-test branch too. Can you please test if you can upgrade from 1.10.6 to 1.10.7 successfully? |
|
I don't find 1.10.7, does it have a tag? |
Whoops, I mean https://github.com/apache/airflow/tree/v1-10-test branch |
|
I get So it looks good |
Thanks, I will check and fix this on master, thanks @mattinbits . |
Due to parallel work, we have split heads in the alembic migrations.
Before:
After:
This reverts the work of #6362 and just makes the migrations linear instead of having branches.
Make sure you have checked all steps below.
Jira
Description
Tests
Commits
Documentation