itayB commented on issue #24526:
URL: https://github.com/apache/airflow/issues/24526#issuecomment-1171307508
my migration failed as well, same setup, RDS MySql 8.0.20, upgrading from
2.2.5 --> 2.3.2, failed on
```
INFO [alembic.runtime.migration] Running upgrade 5e3ec427fdd3 ->
786e3737b18f, Add ``timetable_description`` column to DagModel for UI.
INFO [alembic.runtime.migration] Running upgrade 786e3737b18f ->
f9da662e7089, Add ``LogTemplate`` table to track changes to config values
``log_filename_template``
INFO [alembic.runtime.migration] Running upgrade f9da662e7089 ->
e655c0453f75, Add ``map_index`` column to TaskInstance to identify task-mapping,
and a ``task_map`` table to track mapping values from XCom.
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py",
line 1705, in _execute_context
self.dialect.do_execute(
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/default.py",
line 716, in do_execute
cursor.execute(statement, parameters)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/cursors.py", line
148, in execute
result = self._query(query)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/cursors.py", line
310, in _query
conn.query(q)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
775, in _read_query_result
result.read()
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
1156, in read
first_packet = self.connection._read_packet()
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
692, in _read_packet
packet_header = self._read_bytes(4)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
748, in _read_bytes
raise err.OperationalError(
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during
query')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/utils/db.py", line
1629, in create_global_lock
yield
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/utils/db.py", line
1449, in upgradedb
command.upgrade(config, revision=to_revision or 'heads')
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/command.py", line
322, in upgrade
script.run_env()
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/script/base.py", line
569, in run_env
util.load_python_file(self.dir, "env.py")
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/util/pyfiles.py",
line 94, in load_python_file
module = load_module_py(module_id, path)
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/util/pyfiles.py",
line 110, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in
_call_with_frames_removed
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/migrations/env.py",
line 107, in <module>
run_migrations_online()
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/migrations/env.py",
line 101, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/runtime/environment.py",
line 853, in run_migrations
self.get_context().run_migrations(**kw)
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/runtime/migration.py",
line 623, in run_migrations
step.migration_fn(**kw)
File
"/home/airflow/.local/lib/python3.9/site-packages/airflow/migrations/versions/0100_2_3_0_add_taskmap_and_map_id_on_taskinstance.py",
line 56, in upgrade
batch_op.create_primary_key("task_instance_pkey", ["dag_id", "task_id",
"run_id", "map_index"])
File "/usr/local/lib/python3.9/contextlib.py", line 126, in __exit__
next(self.gen)
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/operations/base.py",
line 376, in batch_alter_table
impl.flush()
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/operations/batch.py",
line 111, in flush
fn(*arg, **kw)
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/ddl/impl.py", line
335, in add_constraint
self._exec(schema.AddConstraint(const))
File
"/home/airflow/.local/lib/python3.9/site-packages/alembic/ddl/impl.py", line
195, in _exec
return conn.execute(construct, multiparams)
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py",
line 1200, in execute
return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line
77, in _execute_on_connection
return connection._execute_ddl(
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py",
line 1290, in _execute_ddl
ret = self._execute_context(
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py",
line 1748, in _execute_context
self._handle_dbapi_exception(
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py",
line 1929, in _handle_dbapi_exception
util.raise_(
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/util/compat.py",
line 211, in raise_
raise exception
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py",
line 1705, in _execute_context
self.dialect.do_execute(
File
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/default.py",
line 716, in do_execute
cursor.execute(statement, parameters)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/cursors.py", line
148, in execute
result = self._query(query)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/cursors.py", line
310, in _query
conn.query(q)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
775, in _read_query_result
result.read()
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
1156, in read
first_packet = self.connection._read_packet()
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
692, in _read_packet
packet_header = self._read_bytes(4)
File
"/home/airflow/.local/lib/python3.9/site-packages/pymysql/connections.py", line
748, in _read_bytes
raise err.OperationalError(
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost
connection to MySQL server during query')
[SQL: ALTER TABLE task_instance ADD CONSTRAINT task_instance_pkey PRIMARY
KEY (dag_id, task_id, run_id, map_index)]
(Background on this error at: http://sqlalche.me/e/14/e3q8)
```
and we are currently stuck, trying to recover this step manually :(
Any tip here? is there's a ref to the migration upgrade steps somewhere?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]