aoelvp94 commented on PR #76971:
URL: https://github.com/apache/airflow/pull/76971#issuecomment-7023690502

   Thanks both for picking this up so quickly. I checked out both branches and 
ran each operator against main's tests, both PRs' tests, a few extra edge 
cases, and the original repro against Azurite + S3Mock.
   
   Both fix the reported case end to end: on the emulators, `replace=False` now 
skips the existing `out/a.txt` and leaves it untouched, where main raises 
`ResourceExistsError`.
   
   My vote is #76971, for three reasons:
   
   1. **It compares what is actually written.** The filter checks 
`_create_key(blob_name, blob_prefix, file)`, the exact name `move_file()` 
uploads to. #76887 strips the prefix from the listing instead, which diverges 
when `blob_prefix` ends in `/`: with `blob_prefix="out/"` and an existing 
`out/a.txt`, #76887 skips `a.txt`, but the operator would write `out//a.txt`, 
which does not exist, so the file is never copied.
   2. **It also fixes the `blob_name` path.** On main, that branch compares 
only the last path segment, so an existing `blob_name` whose basename differs 
from the `s3_key` basename is not skipped, and the upload fails the same way. 
#76887 leaves this as is.
   3. **The test fixtures match reality.** `get_blobs_list_recursive` returns 
full blob names, never relative ones. The existing fixtures mock relative 
names, which is why the bug went unnoticed. #76971 updates them; #76887 keeps 
them alongside the new cases.
   
   One behaviour change worth noting in the changelog: with `blob_name` and 
`replace=False`, the task now skips whenever that blob exists, regardless of 
basename. That matches the documented intent of `replace=False`.
   
   #76887 was first and is a correct fix for the reported case, so credit to 
its author. If you're both OK with it, I'd suggest going with #76971, and 
@pranjal9091 could co-review it. A maintainer will need to approve the workflow 
run on #76971 before CI can run.


-- 
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]

Reply via email to