From commits-return-12275-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Sat Jan 27 09:02:09 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 8DC0E18076D for ; Sat, 27 Jan 2018 09:02:09 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7DC37160C2F; Sat, 27 Jan 2018 08:02:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 77A0B160C30 for ; Sat, 27 Jan 2018 09:02:08 +0100 (CET) Received: (qmail 29045 invoked by uid 500); 27 Jan 2018 08:02:07 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 29036 invoked by uid 99); 27 Jan 2018 08:02:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Jan 2018 08:02:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id E658B1A0072 for ; Sat, 27 Jan 2018 08:02:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -101.51 X-Spam-Level: X-Spam-Status: No, score=-101.51 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 3rchMl89N707 for ; Sat, 27 Jan 2018 08:02:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 361605FB97 for ; Sat, 27 Jan 2018 08:02:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id ED2D2E0142 for ; Sat, 27 Jan 2018 08:02:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4A452240F6 for ; Sat, 27 Jan 2018 08:02:00 +0000 (UTC) Date: Sat, 27 Jan 2018 08:02:00 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AIRFLOW-1895) Broken add_time_zone migration for mysql MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AIRFLOW-1895?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 342016#comment-16342016 ]=20 ASF subversion and git services commented on AIRFLOW-1895: ---------------------------------------------------------- Commit a1d5551777739a166da8c770262f90ed47802857 in incubator-airflow's bran= ch refs/heads/master from [~bolke] [ https://git-wip-us.apache.org/repos/asf?p=3Dincubator-airflow.git;h=3Da1d= 5551 ] [AIRFLOW-1895] Fix primary key integrity for mysql sla_miss and task_instances cannot have NULL execution_dates. The timezone migration scripts forgot to set this properly. In addition to make sure MySQL does not set "ON UPDATE CURRENT_TIMESTAMP" or MariaDB "DEFAULT 0000-00-00 00:00:00" we now check if explicit_defaults_for_timestamp is turned on and otherwise fail an database upgrade. Closes #2969, #2857 Closes #2979 from bolkedebruin/AIRFLOW-1895 > Broken add_time_zone migration for mysql > ---------------------------------------- > > Key: AIRFLOW-1895 > URL: https://issues.apache.org/jira/browse/AIRFLOW-1895 > Project: Apache Airflow > Issue Type: Bug > Reporter: Edgar Rodriguez > Assignee: Edgar Rodriguez > Priority: Major > Fix For: 1.10.0 > > > A clean install fails when initializing the airflow DB and running the mi= grations with the following error: > {code} > (airflow) =E2=9E=9C airflow airflow initdb > [2017-12-07 16:59:26,638] {configuration.py:209} WARNING - section/key [c= elery/celery_ssl_active] not found in config > [2017-12-07 16:59:26,639] {default_celery.py:45} WARNING - Celery Executo= r will run without SSL > [2017-12-07 16:59:26,639] {default_celery.py:66} WARNING - You have confi= gured a result_backend of redis://localhost:6379/0, it is highly recommende= d to use an alternative result_backend (i.e. a database). > [2017-12-07 16:59:26,641] {__init__.py:45} INFO - Using executor CeleryEx= ecutor > [2017-12-07 16:59:26,839] {db.py:300} INFO - Creating tables > /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/= lib/python2.7/site-packages/SQLAlchemy-1.2.0b1-py2.7-macosx-10.12-x86_64.eg= g/sqlalchemy/dialects/mysql/base.py:1713: Warning: (1287L, "'@@tx_isolation= ' is deprecated and will be removed in a future release. Please use '@@tran= saction_isolation' instead") > INFO [alembic.runtime.migration] Context impl MySQLImpl. > INFO [alembic.runtime.migration] Will assume non-transactional DDL. > INFO [alembic.runtime.migration] Running upgrade -> e3a246e0dc1, curren= t schema > INFO [alembic.runtime.migration] Running upgrade e3a246e0dc1 -> 1507a728= 9a2f, create is_encrypted > INFO [alembic.runtime.migration] Running upgrade 1507a7289a2f -> 13eb55f= 81627, maintain history for compatibility with earlier migrations > INFO [alembic.runtime.migration] Running upgrade 13eb55f81627 -> 338e90f= 54d61, More logging into task_isntance > INFO [alembic.runtime.migration] Running upgrade 338e90f54d61 -> 52d7144= 95f0, job_id indices > INFO [alembic.runtime.migration] Running upgrade 52d714495f0 -> 50289888= 7f84, Adding extra to Log > INFO [alembic.runtime.migration] Running upgrade 502898887f84 -> 1b38cef= 5b76e, add dagrun > INFO [alembic.runtime.migration] Running upgrade 1b38cef5b76e -> 2e541a1= dcfed, task_duration > INFO [alembic.runtime.migration] Running upgrade 2e541a1dcfed -> 40e6731= 9e3a9, dagrun_config > INFO [alembic.runtime.migration] Running upgrade 40e67319e3a9 -> 561833c= 1c74b, add password column to user > INFO [alembic.runtime.migration] Running upgrade 561833c1c74b -> 4446e08= 588, dagrun start end > INFO [alembic.runtime.migration] Running upgrade 4446e08588 -> bbc73705a= 13e, Add notification_sent column to sla_miss > INFO [alembic.runtime.migration] Running upgrade bbc73705a13e -> bba5a7c= fc896, Add a column to track the encryption state of the 'Extra' field in c= onnection > INFO [alembic.runtime.migration] Running upgrade bba5a7cfc896 -> 1968acf= c09e3, add is_encrypted column to variable table > INFO [alembic.runtime.migration] Running upgrade 1968acfc09e3 -> 2e82aab= 8ef20, rename user table > INFO [alembic.runtime.migration] Running upgrade 2e82aab8ef20 -> 211e584= da130, add TI state index > INFO [alembic.runtime.migration] Running upgrade 211e584da130 -> 64de9cd= df6c9, add task fails journal table > INFO [alembic.runtime.migration] Running upgrade 64de9cddf6c9 -> f2ca10b= 85618, add dag_stats table > INFO [alembic.runtime.migration] Running upgrade f2ca10b85618 -> 4addfa1= 236f1, Add fractional seconds to mysql tables > INFO [alembic.runtime.migration] Running upgrade 4addfa1236f1 -> 8504051= e801b, xcom dag task indices > INFO [alembic.runtime.migration] Running upgrade 8504051e801b -> 5e7d177= 57c7a, add pid field to TaskInstance > INFO [alembic.runtime.migration] Running upgrade 5e7d17757c7a -> 127d2bf= 2dfa7, Add dag_id/state index on dag_run table > INFO [alembic.runtime.migration] Running upgrade 127d2bf2dfa7 -> cc1e656= 23dc7, add max tries column to task instance > [2017-12-07 16:59:28,485] {models.py:194} INFO - Filling up the DagBag fr= om /Users/edgar_rodriguez/airflow/dags > /Users/edgar_rodriguez/airflow/incubator-airflow/airflow/utils/helpers.py= :351: DeprecationWarning: Importing BashOperator directly from has been deprecated. Please import from '.[operator_module]' instead. Support for= direct imports will be dropped entirely in Airflow 2.0. > DeprecationWarning) > INFO [alembic.runtime.migration] Running upgrade cc1e65623dc7 -> bdaa763= e6c56, Make xcom value column a large binary > INFO [alembic.runtime.migration] Running upgrade bdaa763e6c56 -> 947454b= f1dff, add ti job_id index > INFO [alembic.runtime.migration] Running upgrade 947454bf1dff -> d2ae310= 99d61, Increase text size for MySQL (not relevant for other DBs' text types= ) > INFO [alembic.runtime.migration] Running upgrade d2ae31099d61 -> 0e2a74e= 0fc9f, Add time zone awareness > Traceback (most recent call last): > File "/Users/edgar_rodriguez/airflow/bin/airflow", line 6, in > exec(compile(open(__file__).read(), __file__, 'exec')) > File "/Users/edgar_rodriguez/airflow/incubator-airflow/airflow/bin/airf= low", line 27, in > args.func(args) > File "/Users/edgar_rodriguez/airflow/incubator-airflow/airflow/bin/cli.= py", line 885, in initdb > db_utils.initdb() > File "/Users/edgar_rodriguez/airflow/incubator-airflow/airflow/utils/db= .py", line 87, in initdb > upgradedb() > File "/Users/edgar_rodriguez/airflow/incubator-airflow/airflow/utils/db= .py", line 308, in upgradedb > command.upgrade(config, 'heads') > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/command.py", line 174, in upgrade > script.run_env() > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/script/base.py", line 416, in run_env > util.load_python_file(self.dir, 'env.py') > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/util/pyfiles.py", line 93, in load_python_file > module =3D load_module_py(module_id, path) > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/util/compat.py", line 79, in load_module_py > mod =3D imp.load_source(module_id, path, fp) > File "/Users/edgar_rodriguez/airflow/incubator-airflow/airflow/migratio= ns/env.py", line 86, in > run_migrations_online() > File "/Users/edgar_rodriguez/airflow/incubator-airflow/airflow/migratio= ns/env.py", line 81, in run_migrations_online > context.run_migrations() > File "", line 8, in run_migrations > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/runtime/environment.py", line 807, in run_migrations > self.get_context().run_migrations(**kw) > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/runtime/migration.py", line 321, in run_migrations > step.migration_fn(**kw) > File "/Users/edgar_rodriguez/airflow/incubator-airflow/airflow/migratio= ns/versions/0e2a74e0fc9f_add_time_zone_awareness.py", line 61, in upgrade > op.alter_column(table_name=3D'sla_miss', column_name=3D'execution_dat= e', type_=3Dmysql.TIMESTAMP(fsp=3D6)) > File "", line 8, in alter_column > File "", line 3, in alter_column > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/operations/ops.py", line 1420, in alter_column > return operations.invoke(alt) > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/operations/base.py", line 318, in invoke > return fn(self, operation) > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/operations/toimpl.py", line 53, in alter_column > **operation.kw > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/ddl/mysql.py", line 67, in alter_column > else existing_autoincrement > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/alembi= c/ddl/impl.py", line 118, in _exec > return conn.execute(construct, *multiparams, **params) > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/engine/base.py", l= ine 945, in execute > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/sql/ddl.py", line = 68, in _execute_on_connection > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/engine/base.py", l= ine 1002, in _execute_ddl > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/engine/base.py", l= ine 1189, in _execute_context > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/engine/base.py", l= ine 1402, in _handle_dbapi_exception > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/util/compat.py", l= ine 203, in raise_from_cause > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/engine/base.py", l= ine 1182, in _execute_context > File "build/bdist.macosx-10.12-x86_64/egg/sqlalchemy/engine/default.py"= , line 504, in do_execute > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/MySQLd= b/cursors.py", line 250, in execute > self.errorhandler(self, exc, value) > File "/Users/edgar_rodriguez/airflow/lib/python2.7/site-packages/MySQLd= b/connections.py", line 50, in defaulterrorhandler > raise errorvalue > sqlalchemy.exc.DataError: (_mysql_exceptions.DataError) (1171, 'All parts= of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE i= nstead') [SQL: u'ALTER TABLE sla_miss MODIFY execution_date TIMESTAMP(6) NU= LL'] > {code} > Specifically the migration {{Running upgrade d2ae31099d61 -> 0e2a74e0fc9f= , Add time zone awareness}} fails by not setting {{nullable=3DFalse}} in th= e migration upgrade for mysql: > {code} > op.alter_column(table_name=3D'sla_miss', column_name=3D'execution_date',= =20 > type_=3Dmysql.TIMESTAMP(fsp=3D6)) > ... > op.alter_column(table_name=3D'task_instance', column_name=3D'execution_da= te',=20 > type_=3Dmysql.TIMESTAMP(fsp=3D6)) > {code} > **Resolution** > Add {{nullable=3DFalse}} to these migration entries. -- This message was sent by Atlassian JIRA (v7.6.3#76005)