-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate pickled data & change XCom value type to JSON #44166
Merged
Merged
+222
−20
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kaxil
added
the
airflow3.0:breaking
Candidates for Airflow 3.0 that contain breaking changes
label
Nov 18, 2024
boring-cyborg
bot
added
area:db-migrations
PRs with DB migration
kind:documentation
labels
Nov 18, 2024
kaxil
force-pushed
the
xcom-migration
branch
from
November 18, 2024 23:57
605e0ec
to
d26cbc1
Compare
Merged
kaxil
force-pushed
the
xcom-migration
branch
from
November 19, 2024 12:40
d26cbc1
to
fe0eb2e
Compare
kaxil
requested review from
bolkedebruin,
ryanahamilton,
bbovenzi,
pierrejeambrun and
jscheffl
as code owners
November 19, 2024 12:40
ashb
reviewed
Nov 19, 2024
There was a problem hiding this 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)
airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py
Outdated
Show resolved
Hide resolved
airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py
Outdated
Show resolved
Hide resolved
kaxil
force-pushed
the
xcom-migration
branch
from
November 19, 2024 14:47
fe0eb2e
to
e38956e
Compare
ashb
approved these changes
Nov 19, 2024
- 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
force-pushed
the
xcom-migration
branch
from
November 19, 2024 15:27
e38956e
to
a358146
Compare
Static failure is unrelated |
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
LefterisXefteris
pushed a commit
to LefterisXefteris/airflow
that referenced
this pull request
Jan 5, 2025
follow-up of apache#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
LefterisXefteris
pushed a commit
to LefterisXefteris/airflow
that referenced
this pull request
Jan 5, 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`.
LefterisXefteris
pushed a commit
to LefterisXefteris/airflow
that referenced
this pull request
Jan 5, 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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
follow-up of #43905
Changes:
XCom.value
column to JSON for all dbs._xcom_archive
and removed it from thexcom
table.XComObjectStorageBackend
to make it compatible for AF 2 & 3^ 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.