Skip to content

Conversation

@justinpakzad
Copy link
Contributor

The _sync_to_local_dir_if_changed method in the S3Hook, which checks if the local file differs from the file in S3 was incorrectly comparing last modified dates. It was comparing a unix timestamp (local_stats.st_mtime) to s3_last_modified.microseconds, which only gives the microseconds portion of the date. This meant that unless the last modified date was in Jan 1970, this would always evaluate to false. I changed s3_last_modified to use .timestamp() which returns a unix timestamp so that we can compare correctly. I also added an additional test case to ensure a file with the same size but different last modified date (local < s3) gets downloaded as we didn't have a test case for that.

related: #60223


^ 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 airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Jan 8, 2026
@marcosmartinezfco
Copy link

Amazing, thanks for this.

@potiuk potiuk merged commit 1bf026b into apache:main Jan 9, 2026
91 checks passed
stegololz pushed a commit to stegololz/airflow that referenced this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

S3 DAG bundle sync sometimes skips updated objects; local /tmp copy remains stale until folder is deleted

4 participants