This is an automated email from the ASF dual-hosted git repository.

ashb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new bf3d4022db3 Remove slow-on-MySQL and now needless CHECK CONSTRAINT 
(#74409)
bf3d4022db3 is described below

commit bf3d4022db38ef5b5ca4cf0bd175b31be0f3fea9
Author: Ash Berlin-Taylor <[email protected]>
AuthorDate: Thu Oct 8 10:49:54 2026 +0100

    Remove slow-on-MySQL and now needless CHECK CONSTRAINT (#74409)
    
    When migration 0136 was written and merged, xcom was still being written to,
    but now that 0142 has landed this table is read-only.
    
    So it makes no sense to spend any time writing this migration.
    
    (It turns out that adding a CHECK constraint on mysql _copies the entire
    table_. Large values and all.)
---
 .../versions/0136_3_4_0_fold_task_map_into_xcom_mapped_length.py        | 2 --
 airflow-core/src/airflow/models/xcom.py                                 | 2 --
 2 files changed, 4 deletions(-)

diff --git 
a/airflow-core/src/airflow/migrations/versions/0136_3_4_0_fold_task_map_into_xcom_mapped_length.py
 
b/airflow-core/src/airflow/migrations/versions/0136_3_4_0_fold_task_map_into_xcom_mapped_length.py
index 86e1e7ccf4a..60e3bea956a 100644
--- 
a/airflow-core/src/airflow/migrations/versions/0136_3_4_0_fold_task_map_into_xcom_mapped_length.py
+++ 
b/airflow-core/src/airflow/migrations/versions/0136_3_4_0_fold_task_map_into_xcom_mapped_length.py
@@ -118,7 +118,6 @@ def upgrade():
     with disable_sqlite_fkeys(op):
         with op.batch_alter_table("xcom", schema=None) as batch_op:
             batch_op.add_column(sa.Column("mapped_length", sa.Integer(), 
nullable=True))
-            batch_op.create_check_constraint("mapped_length_not_negative", 
"mapped_length >= 0")
 
         op.execute(build_backfill_statement())
         op.drop_table("task_map")
@@ -154,5 +153,4 @@ def downgrade():
         op.execute(build_restore_statement())
 
         with op.batch_alter_table("xcom", schema=None) as batch_op:
-            batch_op.drop_constraint("mapped_length_not_negative", 
type_="check")
             batch_op.drop_column("mapped_length")
diff --git a/airflow-core/src/airflow/models/xcom.py 
b/airflow-core/src/airflow/models/xcom.py
index e64789cb8ce..2a3ba95ed53 100644
--- a/airflow-core/src/airflow/models/xcom.py
+++ b/airflow-core/src/airflow/models/xcom.py
@@ -46,7 +46,6 @@ from sqlalchemy import (
 )
 from sqlalchemy.dialects import postgresql
 from sqlalchemy.orm import Mapped, aliased, foreign, mapped_column, 
relationship
-from sqlalchemy.schema import conv
 from sqlalchemy.sql.visitors import cloned_traverse
 
 from airflow._shared.timezones import timezone
@@ -99,7 +98,6 @@ class XComModelV1(TaskInstanceDependencies):
         # separately, and enforce uniqueness with DagRun.id instead.
         Index("idx_xcom_key", key),
         Index("idx_xcom_task_instance", dag_id, task_id, run_id, map_index),
-        CheckConstraint(mapped_length >= 0, 
name=conv("ck_xcom_mapped_length_not_negative")),
         PrimaryKeyConstraint("dag_run_id", "task_id", "map_index", "key", 
name="xcom_pkey"),
         ForeignKeyConstraint(
             [dag_id, task_id, run_id, map_index],

Reply via email to