You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/11/24 18:18:48 UTC

[GitHub] [airflow] potiuk opened a new pull request #12596: Switch to utf8mb3 for mysql

potiuk opened a new pull request #12596:
URL: https://github.com/apache/airflow/pull/12596


   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733168934


   For me it looks like hard statement on no utf8mb4 support at all.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733579519


   This change should address the migration @ashb and @kaxil  - I made it in the way that the previous migration actually creates a Text field not string in case of mysql and the fix after that changes it to Text again. That should be safest if someone actually run the previous migration in non-UTF8mb4 mysql. I am looking at the two errors in MySQL8 that I saw in the previous run


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Bring back MySQL 8 to test matrix

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733613110


   I believe this have a chance of passing @ashb and @kaxil . Happy if you take a look.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#discussion_r530284550



##########
File path: scripts/ci/libraries/_initialization.sh
##########
@@ -102,10 +102,10 @@ function initialization::initialize_base_variables() {
     export CURRENT_MYSQL_VERSIONS
 
     # Default Postgres versions
-    export POSTGRES_VERSION=${CURRENT_POSTGRES_VERSIONS[0]}
+    export POSTGRES_VERSION=${POSTGRES_VERSION:=${CURRENT_POSTGRES_VERSIONS[0]}}
 
     # Default MySQL versions
-    export MYSQL_VERSION=${CURRENT_MYSQL_VERSIONS[0]}
+    export MYSQL_VERSION=${MYSQL_VERSION:=${CURRENT_MYSQL_VERSIONS[0]}}

Review comment:
       Thanks. And I figured, just checking.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#discussion_r530304715



##########
File path: tests/operators/test_generic_transfer.py
##########
@@ -55,12 +55,12 @@ def tearDown(self):
     )
     def test_mysql_to_mysql(self, client):
         with MySqlContext(client):
-            sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES LIMIT 100;"
+            sql = "SELECT * FROM connection;"
             op = GenericTransfer(
                 task_id='test_m2m',
                 preoperator=[
                     "DROP TABLE IF EXISTS test_mysql_to_mysql",
-                    "CREATE TABLE IF NOT EXISTS test_mysql_to_mysql LIKE INFORMATION_SCHEMA.TABLES",

Review comment:
       Ah gotcha. Cool.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
ashb commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733699564


   Good to merge now right?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733666041


   I will slit out the the change and we can merge one after the other
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#discussion_r530277648



##########
File path: scripts/ci/libraries/_initialization.sh
##########
@@ -102,10 +102,10 @@ function initialization::initialize_base_variables() {
     export CURRENT_MYSQL_VERSIONS
 
     # Default Postgres versions
-    export POSTGRES_VERSION=${CURRENT_POSTGRES_VERSIONS[0]}
+    export POSTGRES_VERSION=${POSTGRES_VERSION:=${CURRENT_POSTGRES_VERSIONS[0]}}
 
     # Default MySQL versions
-    export MYSQL_VERSION=${CURRENT_MYSQL_VERSIONS[0]}
+    export MYSQL_VERSION=${MYSQL_VERSION:=${CURRENT_MYSQL_VERSIONS[0]}}

Review comment:
       Sure. I want to do it. I just want to test it now for mysql8 as well. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #12596: Bring back MySQL 8 to test matrix

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#discussion_r530268958



##########
File path: tests/operators/test_generic_transfer.py
##########
@@ -55,12 +55,12 @@ def tearDown(self):
     )
     def test_mysql_to_mysql(self, client):
         with MySqlContext(client):
-            sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES LIMIT 100;"
+            sql = "SELECT * FROM connection;"
             op = GenericTransfer(
                 task_id='test_m2m',
                 preoperator=[
                     "DROP TABLE IF EXISTS test_mysql_to_mysql",
-                    "CREATE TABLE IF NOT EXISTS test_mysql_to_mysql LIKE INFORMATION_SCHEMA.TABLES",

Review comment:
       Don't think you wanted this change




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733665874


   OK @ashb -> everything works for MySQL8 now. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733668746


   Split out now. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk merged pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #12596:
URL: https://github.com/apache/airflow/pull/12596


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733169801


   BTW. The time when I looked at the uf8mb3 vs. utf8mb4 was when someone tried to use this in the description: 🦅


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733163249


   Yeah . That's about it - and few really weird characters


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733152459


   Trying to see if it works for both mysql 5.7 and 5.8 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
ashb commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733159887


   Does this mean we can't store emoji in connection descriptions? ;)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733671339


   The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk edited a comment on pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733666041


   I will split out the the change and we can merge one after the other
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#discussion_r530276554



##########
File path: scripts/ci/libraries/_initialization.sh
##########
@@ -102,10 +102,10 @@ function initialization::initialize_base_variables() {
     export CURRENT_MYSQL_VERSIONS
 
     # Default Postgres versions
-    export POSTGRES_VERSION=${CURRENT_POSTGRES_VERSIONS[0]}
+    export POSTGRES_VERSION=${POSTGRES_VERSION:=${CURRENT_POSTGRES_VERSIONS[0]}}
 
     # Default MySQL versions
-    export MYSQL_VERSION=${CURRENT_MYSQL_VERSIONS[0]}
+    export MYSQL_VERSION=${MYSQL_VERSION:=${CURRENT_MYSQL_VERSIONS[0]}}

Review comment:
       Hey - would you mind leaving this change out so we can merge https://github.com/apache/airflow/pull/12591 as well?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk edited a comment on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733195408


   And it has another consequence - the migrations will have to be updated if we change the type of the colum - simply because for a short while during the migration the column will be added and fail. so we probably should somewhat adapt the old migrations to cope with it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12596: Fix Connection.description migration for MySQL8

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#discussion_r530287460



##########
File path: tests/operators/test_generic_transfer.py
##########
@@ -55,12 +55,12 @@ def tearDown(self):
     )
     def test_mysql_to_mysql(self, client):
         with MySqlContext(client):
-            sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES LIMIT 100;"
+            sql = "SELECT * FROM connection;"
             op = GenericTransfer(
                 task_id='test_m2m',
                 preoperator=[
                     "DROP TABLE IF EXISTS test_mysql_to_mysql",
-                    "CREATE TABLE IF NOT EXISTS test_mysql_to_mysql LIKE INFORMATION_SCHEMA.TABLES",

Review comment:
       I actually wanted. This test was failing on MYSQL 8 because you cannot do CREATE TABLE LIKE on INFORMATION_SCHEMA.TABLES - in MySQL8 you get an error when you try to do this
   
   ```
   self = <_mysql.connection closed at 55e386a803e8>
   query = b'CREATE TABLE IF NOT EXISTS test_mysql_to_mysql LIKE INFORMATION_SCHEMA.TABLES'
   
       def query(self, query):
           # Since _mysql releases GIL while querying, we need immutable buffer.
           if isinstance(query, bytearray):
               query = bytes(query)
           if self.waiter is not None:
               self.send_query(query)
               self.waiter(self.fileno())
               self.read_query_result()
           else:
   >           _mysql.connection.query(self, query)
   E           _mysql_exceptions.OperationalError: (1347, "'information_schema.TABLES' is not BASE TABLE")
   ```
   
   So rather than INFORMATION_SCHEMA.TABLES I picked connection as the source of the transfer (random pick really - I was working on the connection description problem, it's small enough table to be similar to information_schema.TABLES.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733550559


   Looking now. at the best way to fix the MySQL 8  problem


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk edited a comment on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733167723


   I really think we should disable support for utf8mb4 for MySQL (we can check it at runtime). 
   
   I tested this version locally with both MySQL5.7 and MYSQL8. 
   
   Both 5.7 and 8 have utf8mb3 set as default when you choose utf8: https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html. There is a note:
   
   > The utf8mb3 character set is deprecated and you should expect it to be removed in a future MySQL release. Please use utf8mb4 instead. Although utf8 is currently an alias for utf8mb3, at some point utf8 is expected to become a reference to utf8mb4. To avoid ambiguity about the meaning of utf8, consider specifying utf8mb4 explicitly for character set references instead of utf8.
   
   This is a bit of a joke when you match it with the offending client's behavior :facepalm: 
   
   I think we never really supported Utf8mb4 and while I tried to do it with separate collation for some too-long-indexes in 5.7  it was rather weird.
   
   WDYT?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733575256


   @kaxil @ashb -> the simplest way of fixing the migration is indeed simply changing the field to Text. I am adding a fix for that and fixing two failing errors on mysql8 I see.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
ashb commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733170672


   No idea, I haven't looked in to the details of mysql collations.
   
   Do you know if switching to TEXT instead has any other advantages? 
   
   Going against mysql's docs seems like a bad idea?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733167723


   I really think we should disable support for utf8mb4 for MySQL (we can check it at runtime). 
   
   I tested this version locally with both MySQL5.7 and MYSQL8. 
   
   Both 5.7 and 8 have utf8mb3 set as default when you choose utf8: https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html. There is a note:
   
   > The utf8mb3 character set is deprecated and you should expect it to be removed in a future MySQL release. Please use utf8mb4 instead. Although utf8 is currently an alias for utf8mb3, at some point utf8 is expected to become a reference to utf8mb4. To avoid ambiguity about the meaning of utf8, consider specifying utf8mb4 explicitly for character set references instead of utf8.
   
   This is a bit of a joke when you match it with the offending client's behavior :facepalm: 
   
   I think we never really supported Utf8mb4 and while I tried to do it with separate collation for some too-long-indexes in 5.7 and it was rather weird.
   
   WDYT?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733194486


   > No idea, I haven't looked in to the details of mysql collations.
   > 
   > Do you know if switching to TEXT instead has any other advantages?
   > 
   > Going against mysql's docs seems like a bad idea?
   
   It's not going against it- we will likely have other "too big index" problems if we do that - just guessing. And it's not only this one field is a problem - in the same connection table there are already quite a few big test fields which are TEXT if you look at that.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #12596: Switch to utf8mb3 for mysql

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #12596:
URL: https://github.com/apache/airflow/pull/12596#issuecomment-733195408


   And it has another consequence - the migrations will have to be updated if we change the type of the colum - simply because for a short while during the migration. so we probably should somewhat adapt the old migrations to cope with it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org