-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Fix: Mysql 5.7 id utf8mb3 #14535
Fix: Mysql 5.7 id utf8mb3 #14535
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
|
migration scripts are created with alembic. |
22e8736
to
355a8fb
Compare
The docker image |
There is a schedule to those; the next release will happen next week, if I understand correctly. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
987884b
to
66f85dc
Compare
I'm working on the rebase to master. Sorry for false triggers. |
be3a385
to
ca910df
Compare
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.
Can you please rebase it and fix my comments? I think this should be fine with utf8mb4
@@ -110,7 +110,8 @@ def upgrade(): | |||
bop.drop_index('idx_xcom_dag_task_date') | |||
# mssql doesn't allow primary keys with nullable columns | |||
if conn.dialect.name != 'mssql': | |||
bop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key', 'execution_date']) | |||
#bop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key', 'execution_date']) | |||
bop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key']) |
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.
Why this
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.
My mysql throws when creating the PK longer than 700. I have no idea how to fix it properly.
But since it's not related to utf8mb3,I will revert this line.
@@ -38,6 +38,8 @@ | |||
depends_on = None | |||
|
|||
|
|||
print(COLLATION_ARGS) |
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.
I guess we shoudl remove it ?
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.
Yes, that's for debug. I will revert the line.
It looks like a bug. I reopened this PR. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
@@ -29,6 +29,8 @@ | |||
from sqlalchemy.engine.reflection import Inspector | |||
|
|||
# revision identifiers, used by Alembic. | |||
from airflow.models.base import COLLATION_ARGS |
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.
This line should go above the comment. In other files as well.
Should this have been closed? This does indeed seem to be an issue and the patch would likely help with MariaDB compatibility as well (#16907). |
@hbrls - do you still want to rebase and merge this one? We are also just about to merge the #17729 to automatically default to utf8mb3 for MySQL (and mariadb) and I think it would be worthwile to add the collation to ids. or if not @siddharthvp maybe you would like to take that over and lead to completion? |
7ef8f47
to
c16bece
Compare
@potiuk I've fixed the comment position. And rebased to latest main. |
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
Some static check failed. Highly recommend installing pre-commits: https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#pre-commit-hooks |
4bf517e
to
ccffe18
Compare
I think you still have static checks problem. Again, I hearltily recommend installing pre-commits and running them locally on your changes before pushing (if you install and use pre-commit it will happen automatically - you won't be able to commit until the tests pass. It saves a lot of time for iteration - for both you, and committers looking at your change) |
ccffe18
to
9fad619
Compare
I've done the pre-commit except |
Would you please rebase to latest |
9fad619
to
dc96815
Compare
Done. |
Awesome work, congrats on your first merged pull request! |
This may not be a ready PR. The code diff best expresses my ideas.
I'm initializing a mysql 5.7 db from empty using
hub.docker.com, apache/airflow:2.0.1-python3.8
. The migration scripts throw errors of(1071, 'Specified key was too long; max key length is 767 bytes')
.AIRFLOW__CORE__SQL_ENGINE_COLLATION_FOR_IDS: utf8mb3_general_ci
does not work. (ref #7570).After go through the issues and code, I had an assumption that
utf8mb3
config was not applied to all places that it should. I applied those migration scripts manually, then it works.I'm not confident about how the migration scripts work.
create table
scripts and skip themodify table
ones? How does this affect the old users wants to upgrade?Another question.I cannot fix the linebop.create_primary_key('pk_xcom', ['dag_id', 'task_id', 'key', 'execution_date'])
. My DBA always told me not to use too many columns for keys. Why in this casedag_id
andtask_id
is not enough?EDIT: Fixed in master.