Repository navigation
[4.x] Backport #1540, #1533, #1535, #1537 and #1545 - #1554
Conversation
du() and AioS3FileSystem._du() looked up every entry that find() listed with info(), which sent HeadObject for each object that no cached listing held: three objects listed with maxdepth=None cost one ListObjectsV2 and three HeadObject requests, a version_aware filesystem looked up every object, and with withdirs each directory that no cached listing held cost a further HeadObject, and a ListObjectsV2 unless an object of its name existed. Count the size of each listed entry instead, named by its bucket and key without a version, so that a requested version keeps the key bucket/key that info() gives it. The sizes of the entries of one name are added: the directory of an object that is also a key prefix counts nothing, where the lookup of its name counted the object below the path as well. A directory is named by its key, so the directory bucket/d/ of the key d//x counts under its name whatever maxdepth is, where the lookup without maxdepth named it bucket/d. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 56c1deb)
…ds (GH-1519) S3FileSystem._walk_tree() and AioS3FileSystem._walk_directory() held the same walk, and the keyword arguments of walk(), which fsspec passes to ls(), reached their private parameters: walk(path, yield_failed=True) yielded a failed listing in S3FileSystem and raised TypeError in the sync walk() of AioS3FileSystem, and directory="x" raised AttributeError or TypeError. _walk_steps() is now the one walk. It does no I/O: it yields the path or the listed directory to list and is sent the entries, or the OSError of the listing, so that S3FileSystem lists in the calling thread and AioS3FileSystem._walk() awaits each listing in a thread of the filesystem and calls on_error in the event loop, as before. The walk entry points read detail, refresh and versions and ignore the other keyword arguments, as ls() does. _walk_listing() lists a path or a listed directory for the walk and for the tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 815718f)
- Make the callable of S3Executor.submit(), submit_to(), run() and run_shielded() positional-only, and the future of submit_to(), so that keyword arguments named fn, self or future reach the callable. The coroutines of AioS3FileSystem that forward their caller's keyword arguments into run() no longer raise TypeError for them, and the functools.partial bindings added to avoid the collision are dropped. - Start no call of a map once an enclosing stop_retries_on() scope has been stopped; such a call's outcome is a CancelledError. Scopes that unstoppable_retries() clears do not stop it. - Classify each failure of a map with the counts predicate once, instead of up to three times, and take no further item once a failure has stopped the batch. An error raised by iterating the items is raised as an interrupt of the waiting thread is. - Document that a request submitted from a thread of the request pool runs in that thread outside the limit of its file or operation. Backport (4.x), partial by decision on #1327 and #1533: the first item (positional-only callables and future, and the removal of the functools.partial bindings in AioS3FileSystem) is master only (5.0.0), since it breaks callers that pass fn=, self= or future= by keyword. Left out of this commit: the "/" in the signatures of S3Executor.submit(), submit_to(), run(), run_shielded(), S3ThreadPool.submit() and _S3PoolScope.submit(), the class docstring sentence on positional-only arguments, every change to pyathena/filesystem/s3_async.py (all of them drop partial bindings), and test_keyword_arguments_reach_callable. The other three items are applied as on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 5b8b740)
…1472) As in S3FileSystem, the annotation copies of a committed multipart copy run in unstoppable_retries(), so that an enclosing stop scope, which now keeps a map from starting its calls, does not leave the destination without its annotations. The copy's own failure still stops the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 877e63a)
…H-1472) Round-one review repairs: - The stop of an enclosing stop scope aborts the map as an error of the counts predicate does: no further item is taken, and the map raises CancelledError once the running calls have ended, whatever stop_on_failure is. A map in a stopped scope therefore takes no item, and cat(on_error="omit"/"return") no longer turns the stop into ignored per-item errors. - A CancelledError always counts and is not passed to counts. - An error of counts stops the batch and is raised whichever thread classifies the failure, instead of becoming the outcome, the failure, or the raised error depending on that thread. - The classified futures are kept by identity and not dropped by clear(), so a done callback that runs after the map has returned does not classify a failure again or keep its future. - Share the rejecting test executor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 97ba132)
- Replace the separate abort error and the stop_on_failure check of the first failure with one error that the batch raises once it stops. - Describe the done callback's except branch as it now works, and drop the internal serialization of counts from the map() docstring. - Share the late-callback Future patch as _late_callbacks(), and reuse ImmediateExecutor for the inline executor of a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ee8d904)
Independent review repairs: - The waiting thread checks the enclosing stop scopes every second and aborts the map, so that a map whose calls are queued behind those of other operations ends and cancels them. - A failure is marked classified only once it is recorded, so that an interrupt before that leaves it to the next thread that sees it; an interrupt in counts is raised also after an earlier failure. - The futures of a batch are not kept by a variable of the submitting frame, which an inline call's traceback keeps, and clear() drops the error to raise, whose traceback can refer to the batch. - A batch operation of a single item, which runs in the calling thread, does not start once an enclosing stop scope has stopped and always raises a CancelledError, as a map does. - Drop the garbage collection example of inline submissions from the docs; a finalizer in a pool thread closes its file in another thread. - Tests: the predicate-error test checks that no further call runs, the late-callback helper fails if a callback does not end, the queued-cancellation test waits for the held call, and the keyword test covers the scope's submit(). Backport conflict (4.x): tests/pyathena/filesystem/test_s3_executor.py. This commit extends test_keyword_arguments_reach_callable, which the 4.x backport of 5b8b740 leaves out with the positional-only item (master only). Resolved by leaving out that test's extension; the rest of the commit is applied as on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit e85c7f6)
Independent follow-up repairs: - The waiting thread checks the enclosing stop scopes before each wait, so that a batch whose calls have all ended returns its outcomes, as it does when it has ended before the wait starts. - An error of counts is recorded before its future is marked classified. - Tests: the predicate-error test checks that a rejecting executor gets no further submission, and the queued-stop test covers map_async(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 3dc44ea)
…1472) - _watch_scopes() aborts only a batch that has not ended, so that calls that end between the loop check and the stop return their outcomes. - The queued-stop test stops the scope once the map is waiting, so that it fails if the scopes are checked only when the wait starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit caaec0a)
- touch(truncate=False) looks the object up without the listing cache and sends PutObject with IfNoneMatch="*", translating the 412 into the documented ValueError, so that it never replaces an object that a stale cached listing or a concurrent writer hides. - A multipart copy of a source without a version to pin (none, or "null") copies each part with CopySourceIfMatch on the ETag that HeadObject reported, unless the caller gives a CopySourceIf* condition, so that a source replaced during the copy fails it instead of completing with parts of two objects. - When CopyObject rejects a source with InvalidRequest, cp_file (sync and aio) looks the source up again without the cache and copies it with a multipart upload if it has outgrown CopyObject since its size was cached. - S3Core.call() rewinds the operation's streamed payload before a retry, such as the AnnotationPayload of PutObjectAnnotation, not only a Body. Backport conflict (4.x): S3FileSystem.touch() in pyathena/filesystem/s3.py. On master, d82b612 (#1435, master only) had made touch() send PutObject through core.call() and return the raw response; 4.x sends it with core.put_object() and returns S3PutObject.to_dict(). Resolved with this commit's own delta only: the 4.x core.put_object() call is wrapped in the try/except that turns the 412 (FileExistsError) of IfNoneMatch="*" into the ValueError, and the 4.x return value is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 8e5d42e)
- touch() rejects a bucket before any lookup, and invalidates the path when PutObject answers 412, which shows the object exists. - A failed re-lookup after CopyObject's InvalidRequest raises CopyObject's error, not the lookup's. - The ETag condition of the parts yields only to CopySourceIfMatch and CopySourceIfUnmodifiedSince, which it would override; CopySourceIfNoneMatch and CopySourceIfModifiedSince are sent with it. - The annotations are read after the upload completes, not when the copy starts; the docs and docstring say so. - S3Core shares one operation-model lookup between operation_params() and the streamed payload, and its docstrings name the payload. - The live touch() check that could not fail is removed; test_exclusive_create already sends IfNoneMatch to S3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit d27caa9)
- touch() names its error message once and invalidates the path in finally, after a success or any failure of the PutObject it sent. - cp_file computes the source lookup parameters once and passes them to _copy_source_outgrown(). - plan_multipart_copy() collects the given parameter names once for the SSE-C and the condition checks, and states the condition rule in one place. - S3Core reads the streamed payload member directly, which botocore always sets for an operation with streaming input. - The docs state when the tags and the annotations are read in one sentence. - Tests drop a redundant parameter and a conditional assertion. Backport conflict (4.x): S3FileSystem.touch() in pyathena/filesystem/s3.py, for the same cause as the backport of 8e5d42e: 4.x sends PutObject with core.put_object() and returns S3PutObject.to_dict(), where master (d82b612, #1435, master only) returns the raw response of core.call(). Resolved with this commit's own delta only: the shared "exists" message, the invalidation in finally (also after the 412), and the return from inside the try, which on 4.x returns core.put_object(...).to_dict(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 0a0406a)
…-1522) - touch(truncate=False) decides with one HeadObject of the key as written, for every key, so a missing key no longer costs a ListObjectsV2; the temporary refresh flag of _object_exists() goes away. - The re-lookup after CopyObject's InvalidRequest addresses the parsed source, so a key that ends in a slash is not looked up without it, and any failure of that lookup, not only an OSError, raises CopyObject's error. - The docs and the plan docstring limit the abort to a part copy that finds the source replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 21876ee)
…quests in tests (GH-1522) - _key_exists() looks the key up with _head_object(refresh=True), so the HeadObject that finds an object replaces the stale cached answer, and one that finds none evicts it. - The tests assert the whole request sequence of a missing key (HeadObject, then PutObject) and that exists() sees an object the lookup found. - The part_params docstring says that the core adds its request_kwargs, including their conditions, when it sends each request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 05727d2)
- An abort answered with NoSuchUpload discards the write instead of leaving it ABORT_FAILED, so a later abort sends nothing. - A creation that waited behind other requests checks the stop scopes before it is sent, as the part requests do. - An abort() call records its thread; a later call takes over an abort whose call ended without recording its outcome, as a second interrupt can make it, instead of waiting for it forever. - An interrupt while the abort waits for a running creation no longer disappears: it is raised once the abort has ended. - The part planner keeps a merged tail of the maximum part size as one part, as S3Core.part_ranges() does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 17680f6)
) Self-review round one: - A failed abort raises its failure again, not the deferred interrupt, so that S3File and the sync copy keep logging it with the upload ID; the operation still stops with an error. - A call in another thread takes the abort over from a call in the main thread, which interrupts may have ended, such as a close handed over by a garbage collection; a single write is not used by two threads at once. - The copy's docstring and the guide describe the deferred interrupt and what a NoSuchUpload abort leaves after a completion that took effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 987cce4)
Self-review round two: the async files and copies use one write from the event loop and pool threads, so the take-over rule rests on the callers not aborting one write from two threads at once, and on the async aborts running in pool threads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 187e5cb)
…borts (GH-1526) Independent review: - The abort records its outcome in _end_abort() under a with statement of the lock itself, not _update(): an interrupt as _update()'s generator hands over the lock left the lock held by the suspended generator while the interrupt's traceback lived, and a retry in this thread waited for it forever. - A call in another thread returns without waiting for an abort that the main thread owns, instead of taking it over: a close that a garbage collection hands over could otherwise send a second abort while the main thread's abort runs. - The wait for a running creation checks whether it is done inside the interrupt handler, so that an interrupt as the check returns does not end the wait. - The queued-creation test waits for the creation with a bound, and the GH-1077 test no longer pins the context of the raised interrupt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 5cc7888)
Independent review follow-up: abort() cancels queued requests, whose done callbacks then run in its thread and changed the session through the _update() generator context manager. An interrupt as that generator handed over the lock left the lock held by the suspended generator, and the abort's own outcome then waited for it forever. Every change now takes the lock with a with statement of the lock itself, which CPython releases whatever interrupts it, and notifies the waits through _publish() before releasing it. Tests: the creation-wait test also interrupts the check for completion; the main-thread scenario of the two-interrupt test runs bounded, with its runner thread as the main thread; the test that modelled the generator's window is removed with the generator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit b5ebd9a)
Independent review follow-up 2: - withdraw_complete() notifies the waits also when there is nothing to withdraw, as before, so that a call retried after an interrupt kept the first from notifying resolves the waiters. - The another-thread scenario of the two-interrupt test runs in a forked child, whose main thread is the forking one, instead of patching threading.main_thread in a bounded thread, which leaked the patch when the bound expired. - The creation-wait test releases the creation only when the wait goes on after the interrupt, so that a wait that ends early fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 5a50b9b)
Independent review follow-up 3: the same-thread cases also run in the main thread of a forked child, which interrupts reach and which is killed on a deadlock, instead of a daemon thread that a deadlock would leave holding sys.monitoring; the creation-wait abort runs bounded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit b5d2549)
…ject copies (GH-1527) - The response models keep the fields that botocore returns: HeadObject's ExpiresString, Restore, ArchiveStatus, PartsCount and the rest, PutObject's Size, DeleteObject's RequestCharged, the Owner and RestoreStatus of listed objects (new S3RestoreStatus), RestoreStatus of versions, the BucketArn of buckets and HeadBucket's location fields (S3Bucket.from_head_response), the CommonPrefixes of upload listings, and the delete marker fields of DeleteObjects (new S3DeletedObject in S3DeleteResult.deleted_objects). New fields default to None, so that the constructors and earlier pickles stay compatible. - list_multipart_uploads() follows NextKeyMarker alone, as directory buckets page; listings with an explicit EncodingType="url" send the next key marker decoded. - The filesystem requests the enclosing "/"-terminated prefix for the uploads of a key in a directory bucket, and invalidates the listings above an upload in a directory bucket once its abort has been sent (clear_multipart_uploads(), S3File.discard(), the async file's discard). - S3Object: copy.copy() copies the metadata mapping, S3Object() and fromkeys() work, to_api_repr() returns a copy of the metadata. - repr() of S3MultipartCopyPlan and S3FileTarget leaves out the request parameters and the buffered append data. - Docs: S3Owner, the new models, S3DeleteBatch under requests, unparseable Expires values, and corrected docstrings. Backport conflict (4.x): TestS3PutObject.test_to_dict in tests/pyathena/filesystem/test_s3_object.py. On master, d82b612 (#1435, master only) had keyed to_dict() by the field names; on 4.x it keys them with a leading underscore. Resolved with this commit's own delta only: the 4.x assertion also expects the key of the new size field, "_size". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 123968c)
) Self-review round one: - The files also invalidate the listings above their upload in a directory bucket once its creation has succeeded, as #1527 asks for creation and abort. - list_multipart_uploads() sends the next key marker as given: a directory bucket obfuscates it, so decoding it could corrupt it; only list_object_versions() decodes it, inline. - clear_multipart_uploads() checks the directory bucket once and invalidates each key once. - copy.copy() of an S3Object dispatches to copy() of its class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 72a323b)
Self-review round two: botocore returns ExpiresString with any Expires header and removes Expires only when it cannot parse it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 26ff04e)
…1527) Independent review: - list_object_versions() also decodes the key marker when the core's request_kwargs give EncodingType="url". - S3DeleteResult derives deleted or deleted_objects from the other when only one is given, so that a result built from paths equals the result of a response without delete marker fields. - The listing pages and the result of DeleteObjects keep RequestCharged; the shape test compares their top-level shapes, omitting the echoes of their requests, and the value-level checksum test is restored. - A committed write keeps the listings when it is discarded; the prefix of a directory-bucket key that starts with "/" is "/". - Tests: the async file's creation and abort invalidation, ListBuckets' BucketArn, the core-level EncodingType, and the keys of fromkeys(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 2f0f1ce)
Independent review follow-up: - S3DeleteResult no longer derives deleted or deleted_objects from the other, which pickles of earlier versions skipped and which dataclasses.replace() undid; deleted_objects and request_charged take no part in its equality, as request_charged of the listing pages, so that results and pages compare as before the fields. - Only a discard whose abort may send a request invalidates the listings, not one of a committed or already discarded write. - Tests: RequestCharged values of the pages and the delete result, a repeated discard, and a bounded close in the async test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 85b9d30)
…-1527) Independent review follow-up 2: a discard invalidates the listings unless the write was already discarded or ends committed, judged after the abort, so that a discard that waited for a failing commit and then aborted invalidates them. Tests: the delete marker version ID directly, page equality and hashing with RequestCharged, dataclasses.replace() of a delete result, and bounded repeated and async scenarios. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 62c05df)
Independent review follow-up 3: the sync scenario runs in call_bounded, so that a regression that blocks any of its discards fails the test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 8f926dc)
| self.invalidate_cache(path) | ||
| return object_.to_dict() | ||
| try: | ||
| return self.core.put_object(s3_path, None, **kwargs).to_dict() |
There was a problem hiding this comment.
Self-review round 1 (implementation behavior): CLEAN
Scope: git diff 6b4dd57a6685b5da061e1b95557deea55489ee0d..0afe623b69b39ce824fde144c3c8a3fcb8022800 (merge base = #1553's head; 31 commits, cherry-picks of #1540 c1+c3, #1533, #1535, #1537, #1545).
Covered:
- Patch fidelity:
git patch-idof every backport commit against its master commit. Only 11 differ: the 5 conflict resolutions and the Make the S3Executor call contract consistent (GH-1472) #1533 carve-out (5b8b740, e85c7f6, 8e5d42e, 0a0406a, 123968c), and 6 whose context alone differs (4.x keepsProtocol/_Connection, the 4.xtouch()body, and a reordered hunk in 97ba132). For 97ba132, the file contents after the commit equal master's except the left-out positional-only lines andtest_keyword_arguments_reach_callable. - Make the S3Executor call contract consistent (GH-1472) #1533 item 1 left out: the
S3Executor/S3ThreadPool/_S3PoolScopesignatures equal those oforigin/4.x, ands3_async.pykeeps itsfunctools.partialbindings. No backported call passesfn=,self=orfuture=torun()/submit()/submit_to(), and none of the new calls relies on the dropped partials (grep of the added.run(/.submitcalls). touch()(this line): the 4.x return valueS3PutObject.to_dict()is kept; it now includes_sizefrom Keep the response fields, page directory-bucket uploads, and fix S3Object copies (GH-1527) #1545 (additive).- Differential checks of the master PRs, rerun on this branch with the Settle the response models, S3Object, and the listing cache #1341 fake S3 (
diffcheck.py, base run twice, identical):- Keep writes from destroying or mixing object data #1535 (
matrices/1522.py), the commits before vs after its backport: 33 cases, 19 changed, all expected, none missing. Master reported 33/19. - Fix the write session's abort, queued creation, and last part (GH-1526) #1537 (
1526.py): 21 cases, 5 changed, all expected (master: 21/5). - Keep the response fields, page directory-bucket uploads, and fix S3Object copies (GH-1527) #1545 (
1527.py): 28 cases, 9 changed, all expected (master: 28/9). - Share one walk body and take du() sizes from the listed entries (GH-1519) #1540 (
/tmp/pyathena-1519/harness.py): on the 970 cases that the master runs share, the outputs before and after commit 1 equal master's base and commit-1 outputs exactly. Commit 3 changes the same 7walk-T1-*cases as on master.
- Keep writes from destroying or mixing object data #1535 (
- Offline
tests/pyathena -m "not aws": 4021 passed.just lint,just docs lint. A Sphinx build of the working tree adds only "duplicate object description" warnings for the new model fields, a kind thatorigin/4.xalready has.
Findings: none.
Limits: the #1533 commits have no differential harness; their regression tests are ported with them and pass. Live AWS tests not run (CI on Ready).
| self.invalidate_cache(path) | ||
| return object_.to_dict() | ||
| try: | ||
| return self.core.put_object(s3_path, None, **kwargs).to_dict() |
There was a problem hiding this comment.
Self-review round 2 (claims, callers, operations): FINDINGS → repaired in the PR body
Scope: the same 6b4dd57a6685b5da061e1b95557deea55489ee0d..0afe623b69b39ce824fde144c3c8a3fcb8022800, the PR body, the conflict notes in the commit messages, and the docs the commits change.
Claims checked:
- "
touch()matches master apart from the return value and its docstring": false as written.diffof the method against 23c068e also shows the 4.xcore.put_object(...)call, the comment above it, and theTypeErrordocstring line (on4.x,core.put_object()builds{**params, "Bucket": ..., "Key": ...}, soBucket/Keyin kwargs are overridden, not rejected). The PR body now states exactly these differences. - The conflict causes named in the commit messages:
git log -Sfinds d82b612 (Return the raw touch() response and settle one request parameter rule (GH-1383) #1435) as the master commit that movedtouch()tocore.call()and the raw response, and keyedto_dict()by field names. 4.x has neither. - "Share one walk body and take du() sizes from the listed entries (GH-1519) #1540 commit 19633ee is master only" and "Fix the write session's abort, queued creation, and last part (GH-1526) #1537 item 4 optional on 4.x": both as stated in those PRs' bodies.
- Release notes: taken from the master PR bodies. The
_sizekey in the result oftouch()is 4.x-specific (S3PutObject.to_dict()keys every dataclass field) and is listed.
Existing callers on 4.x: S3DeleteBatch stays importable from s3_core (old pickles load). The new model fields default to None (#1545's pickle tests pass). touch(truncate=False) now always sends a HeadObject, and PutObject carries If-None-Match: * (release-noted as on master).
Docs: docs/filesystem.md/docs/aio.md say nothing about touch() that the 4.x return value contradicts.
Evidence: the test counts and differential checks in round 1 ran on this head.
Limits: the ported regression tests were not rerun against 4.x with their fixes reverted (master's PRs recorded those mutation checks). The differential checks above are the 4.x-side evidence that each fix changes the expected cases.
| self.invalidate_cache(path) | ||
| return object_.to_dict() | ||
| try: | ||
| return self.core.put_object(s3_path, None, **kwargs).to_dict() |
There was a problem hiding this comment.
Independent review (relayed): Codex CLI 0.172.0, model gpt-6.2-astra, reasoning effort max, codex exec -s read-only, session 01a2280d-3fb6-7f21-a864-c013d1a3a8fc. Static review only (no builds or tests).
Scope: 6b4dd57a6685b5da061e1b95557deea55489ee0d..0afe623b69b39ce824fde144c3c8a3fcb8022800, in a detached snapshot of the head (unchanged afterwards). The prompt gave the master merge SHAs, the master-only commits and the 4.x contracts to keep (connection=/s3_filesystem, touch() → S3PutObject.to_dict(), underscore keys), with no PR number, description or author conclusions.
Reviewer coverage: all 31 cherry-picks in order ("Twenty-six have identical added and removed lines. The other five differ only for the requested executor omission, the 4.x touch() return path, or the _size assertion"); du()/walk() without 19633ee; executor stop scopes, failure accounting and annotation copies ("compatible with the retained keyword-callable signatures and functools.partial bindings"); conditional touch(), copy conditions, payload rewind, write-session abort and creation, part sizing; response fields, directory-bucket uploads, S3Object copies; tests against "Choose what to test" and the AWS fixtures ("All seven filesystem tests unique to the 4.x base remain present").
Result: CLEAN.
| self.invalidate_cache(path) | ||
| return object_.to_dict() | ||
| try: | ||
| return self.core.put_object(s3_path, None, **kwargs).to_dict() |
There was a problem hiding this comment.
Branch update after #1553 merged: review scope unchanged
gh pr update-branch merged 4.x (dc7f81a, the merge of #1553) into this branch: head 0afe623 → 37cd1b3. The tree of dc7f81a equals that of 6b4dd57 (the base reviewed before), and the tree of the new head equals that of 0afe623 (git rev-parse <sha>^{tree}), so git diff dc7f81ac..37cd1b35 is the reviewed diff. The two self-review rounds and the independent review above apply to it unchanged.
WHAT
The third batch of the
4.xbackports decided in #1327 (comment): the filesystem fixes of #1340 and #1341 merged after #1534, in master merge order. Each commit is agit cherry-pick -xof the master commit.Follows #1553 (merged); the branch was updated with
4.xafter that merge, with no change to its tree.4.xdu()takes its sizes from the listed entries instead of a HeadObject per object; one walk body forwalk()/_walk(), which ignore keyword arguments other thandetail,refreshandversions.countsclassifies each failure once; no further item is taken after a failure.touch(truncate=False)sendsIfNoneMatch="*"and looks the key up without the cache; multipart copies of an unversioned source pin its ETag;S3Core.call()rewinds a streamed payload before a retry.NoSuchUpload, a queued creation after a stop, two interrupts duringabort(), one interrupt duringdiscard(), and the size of the last part.S3Objectcopies, andrepr()without request parameters.Partial ports, by decision (#1327 and the maintainer, 2026-11-30):
AioS3FileSystem._du()runsdu()in a thread) is master only, as its PR states; commit 815718f is included and applies without it.fn/futureofS3Executor.submit(),submit_to(),run(),run_shielded()and the pool and scopesubmit(), is master only (it breaks callers that passfn=by keyword). The backport of 5b8b740 leaves out the/in those signatures, the docstring sentence, every change tos3_async.py(all of them drop thefunctools.partialbindings that item 1 made unneeded) andtest_keyword_arguments_reach_callable; e85c7f6 leaves out that test's extension. Items 2-4 are applied as on master.4.xper its PR) is included.Conflicts. Resolved with each commit's own delta only, and recorded in the commit messages:
S3FileSystem.touch(): on master, d82b612 (Return the raw touch() response and settle one request parameter rule (GH-1383) #1435, master only) madetouch()return the raw PutObject response throughcore.call().4.xkeepscore.put_object(...)and returnsS3PutObject.to_dict(); the commits'IfNoneMatch="*", 412-to-ValueErrortranslation and invalidation infinallywrap that call.touch()differs from master at 23c068e only in that 4.x code: thecore.put_object(s3_path, None, **kwargs).to_dict()call and the comment above it, and the docstring'sReturnsandTypeErrorlines (on4.x,BucketandKeyin kwargs are overridden by the path instead of raising).test_s3_executor.py: the extension of the left-out keyword test.TestS3PutObject.test_to_dict:4.xkeysto_dict()with a leading underscore (Return the raw touch() response and settle one request parameter rule (GH-1383) #1435 changed that on master), so the new field is expected as_size.Release notes (from the master PRs, for
4.x):du()(Share one walk body and take du() sizes from the listed entries (GH-1519) #1540): where an object is also a key prefix andwithdirs=Trueis passed, the object's size no longer counts under the directory; withwithdirs=Trueandmaxdepth=None, a directory whose name ends in an empty segment gets its own zero-size key; sizes come from a cached listing where one exists, instead of a HeadObject; an object deleted between the listing and the lookup no longer raisesFileNotFoundError.walk()(Share one walk body and take du() sizes from the listed entries (GH-1519) #1540): results change only for calls that passyield_failedordirectory, which no longer change the result or raise.cat/cat_rangesof a list,rm,copy/get/put/pipeof a list or dict,chmod(recursive=True), and parallel range reads raiseCancelledErrorwithout sending requests. An aio move whose copy has committed when the scope is stopped leaves both objects and raisesCancelledError. Acountspredicate is called once per failure, and an error that it raises stops the batch and is raised.touch(truncate=False)(Keep writes from destroying or mixing object data #1535) looks the object up even when the cache has it, and its PutObject carriesIf-None-Match: *; an S3-compatible store that rejects that header now fails the call. Multipart copies of a source without a pinned version sendx-amz-copy-source-if-matchwith each part, andS3Core.plan_multipart_copy()returns that condition inpart_params.None),S3DeleteResult.deleted_objects,S3Bucket.from_head_response(),S3RestoreStatus,S3DeletedObject. On4.x,touch()returns the new_sizekey ofS3PutObject.to_dict().WHY
#1327 decided to backport the fixes merged to master after the
4.xcut in one session, in master merge order. This PR continues after #1553.TEST
Tested commit: 0afe623, on #1553's head; the current head 37cd1b3 (
4.xmerged in) has the same tree.just lintandjust docs lint: passed.tests/pyathena -m "not aws"(dummy credentials and an unreachable endpoint, so no AWS request is sent): 4021 passed (3909 on [4.x] Backport #1489, #1478, #1480, #1501, #1515 and #1534 #1553's head).🤖 Generated with Claude Code