Skip to content

Conversation

@kaxil
Copy link
Member

@kaxil kaxil commented Nov 18, 2024

follow-up of #43905

Changes:

  • Changed XCom.value column to JSON for all dbs.
  • Archived pickled XCom data to _xcom_archive and removed it from the xcom table.
  • Removed encoded string in XCom serialization and deserialization logic.
  • Updated logic for XComObjectStorageBackend to make it compatible for AF 2 & 3
image

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@kaxil kaxil added the airflow3.0:breaking Candidates for Airflow 3.0 that contain breaking changes label Nov 18, 2024
@kaxil kaxil mentioned this pull request Nov 18, 2024
Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the migration, but it seems "safe" enough (modulo the comment about hex() call on mysql path, and I can't think of a better approach either)

@kaxil kaxil requested a review from ashb November 19, 2024 14:50
- Changed `XCom.value` column to JSON for all dbs.
- Archived pickled XCom data to `_xcom_archive` and removed it from the `xcom` table.
- Removed encoded string in XCom serialization and deserialization logic.
@kaxil kaxil merged commit 86c4c6f into apache:main Nov 19, 2024
@kaxil kaxil deleted the xcom-migration branch November 19, 2024 15:56
@kaxil
Copy link
Member Author

kaxil commented Nov 19, 2024

Static failure is unrelated

@jscheffl
Copy link
Contributor

Thanks for the PR - I LIKE it! Sorry entering too late for review :-(

kaxil added a commit to astronomer/airflow that referenced this pull request Nov 22, 2024
This tables was created to not cause data loss (in apache#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table.

- Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`.
- Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`.
- Add support in `airflow db drop-archived` to drop `_xcom_archive`.
kaxil added a commit that referenced this pull request Nov 22, 2024
This tables was created to not cause data loss (in #44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table.

- Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`.
- Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`.
- Add support in `airflow db drop-archived` to drop `_xcom_archive`.
kaxil pushed a commit that referenced this pull request Dec 3, 2024
In [PR](#44166) we added migration for removing pickled data from `xcom` table. During my testing I noticed with `SQLite`  [insert](https://github.com/apache/airflow/blob/main/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py#L88) statement is not working in case of upgrade. Changing condition to `hex(substr(value, 1, 1)) = '80'` works. Tested [here](#44533 (comment)).

related: #44166
got686-yandex pushed a commit to got686-yandex/airflow that referenced this pull request Jan 30, 2025
This tables was created to not cause data loss (in apache#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table.

- Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`.
- Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`.
- Add support in `airflow db drop-archived` to drop `_xcom_archive`.
got686-yandex pushed a commit to got686-yandex/airflow that referenced this pull request Jan 30, 2025
In [PR](apache#44166) we added migration for removing pickled data from `xcom` table. During my testing I noticed with `SQLite`  [insert](https://github.com/apache/airflow/blob/main/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py#L88) statement is not working in case of upgrade. Changing condition to `hex(substr(value, 1, 1)) = '80'` works. Tested [here](apache#44533 (comment)).

related: apache#44166
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request May 27, 2025
This tables was created to not cause data loss (in apache/airflow#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table.

- Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`.
- Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`.
- Add support in `airflow db drop-archived` to drop `_xcom_archive`.

GitOrigin-RevId: d6364992b8a48c907ac119fb21900e47d4adaf3c
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request May 27, 2025
In [PR](apache/airflow#44166) we added migration for removing pickled data from `xcom` table. During my testing I noticed with `SQLite`  [insert](https://github.com/apache/airflow/blob/main/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py#L88) statement is not working in case of upgrade. Changing condition to `hex(substr(value, 1, 1)) = '80'` works. Tested [here](apache/airflow#44533 (comment)).

related: apache/airflow#44166
GitOrigin-RevId: 40821bfd5c54f3a39b3ff6e8352a4e3a20323e24
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 23, 2025
This tables was created to not cause data loss (in apache/airflow#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table.

- Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`.
- Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`.
- Add support in `airflow db drop-archived` to drop `_xcom_archive`.

GitOrigin-RevId: d6364992b8a48c907ac119fb21900e47d4adaf3c
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Sep 23, 2025
In [PR](apache/airflow#44166) we added migration for removing pickled data from `xcom` table. During my testing I noticed with `SQLite`  [insert](https://github.com/apache/airflow/blob/main/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py#L88) statement is not working in case of upgrade. Changing condition to `hex(substr(value, 1, 1)) = '80'` works. Tested [here](apache/airflow#44533 (comment)).

related: apache/airflow#44166
GitOrigin-RevId: 40821bfd5c54f3a39b3ff6e8352a4e3a20323e24
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Oct 21, 2025
This tables was created to not cause data loss (in apache/airflow#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table.

- Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`.
- Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`.
- Add support in `airflow db drop-archived` to drop `_xcom_archive`.

GitOrigin-RevId: d6364992b8a48c907ac119fb21900e47d4adaf3c
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this pull request Oct 21, 2025
In [PR](apache/airflow#44166) we added migration for removing pickled data from `xcom` table. During my testing I noticed with `SQLite`  [insert](https://github.com/apache/airflow/blob/main/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py#L88) statement is not working in case of upgrade. Changing condition to `hex(substr(value, 1, 1)) = '80'` works. Tested [here](apache/airflow#44533 (comment)).

related: apache/airflow#44166
GitOrigin-RevId: 40821bfd5c54f3a39b3ff6e8352a4e3a20323e24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

airflow3.0:breaking Candidates for Airflow 3.0 that contain breaking changes area:db-migrations PRs with DB migration kind:documentation

Development

Successfully merging this pull request may close these issues.

3 participants