SamWheating opened a new pull request #15714:
URL: https://github.com/apache/airflow/pull/15714


   <!--
   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/
   -->
   
   There are two fixes included in this PR:
   
   ### 1) Enforce `READ COMMITTED` isolation when using MySQL
   
   Closes: https://github.com/apache/airflow/issues/15559
   
   In the investigation in the above issue, we found that MySQL's default 
isolation level ended up causing some really weird issues when running multiple 
schedulers.
   
   This ended up causing skipped tasks while backfilling and caused DAGs using 
`depends_on_past` to completely deadlock. 
   
   By enforcing `READ COMMITTED` when using MySQL we should be able to avoid 
these issues entirely. I don't expect that this will introduce any issues when 
using MySQL 5.x and/or a single scheduler, as `READ COMMITTED` is the default 
isolation level used by PostgreSQL. 
   
   ### 2) Changing how SQLite is detected
   
   While I was in here I noticed a few places where we check for SQLite as 
follows:
   ```
   if 'sqlite' in conf.get('core', 'sql_alchemy_conn')
   ```
   
   While it's an unlikely occurrence, this will falsely detect sqlite in the 
case that it appears anywhere else in the connection string (for example, a 
postgres connection with a database called `not-sqlite`).
   
   I think would more reliable here to use `.startswith('sqlite')` as a 
SQLAlchemy connection string always starts with the dialect. 
    
   
   ---
   **^ 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:
[email protected]


Reply via email to