Repository navigation
fix: preserve tiered metadata on incomplete bulk-delete replies - #277
perfloop[bot] wants to merge 4 commits into
Conversation
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
[Medium impact] The PR appears safe to merge, with the previous test coverage gap addressed. SummaryTiered bulk deletes preserve local metadata when the upstream reply is incomplete or cannot be parsed. Proxy-mode invalidation stays unchanged.
Reviews (2) · Last reviewed commit: "fix: preserve tiered metadata on incompl..." · Reviewed by Greptile |
| const rejectedPrefix = `<DeleteResult><Error><Key>local-key</Key><Code>AccessDenied</Code></Error>` | ||
| tests := []struct { | ||
| name string | ||
| readErr error | ||
| }{ | ||
| {name: "truncated response read", readErr: io.ErrUnexpectedEOF}, | ||
| {name: "fully received malformed result"}, |
There was a problem hiding this comment.
Completeness check lacks independent coverage
Both failure cases use XML with an unclosed DeleteResult, so both would still pass if capture.Complete were removed from the new guard. The forwarder can capture parseable XML before a final read error, so this leaves that protection untested.
Add a case that returns <DeleteResult/> followed by io.ErrUnexpectedEOF, then checks that metadata and GET/HEAD results stay unchanged.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Response to this feedback.
This suggestion matches the existing test style and is valid. The current cases do not distinguish an incomplete response that is already parseable from an unparseable body, so I’ll add the requested <DeleteResult/> plus io.ErrUnexpectedEOF case and verify the metadata and GET/HEAD behavior.
There was a problem hiding this comment.
Addressed in 7873c1bcd60dbee6f5b9d9dab187f97e68ec50cd. Response to this feedback.
Added a parseable <DeleteResult/> response that ends with io.ErrUnexpectedEOF to TestTieredBulkDeleteTruncatedFailurePreservesLocalObject. The test asserts that this incomplete capture leaves the metadata and validated GET/HEAD results unchanged.
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Tiered mode treats local metadata as authoritative for locally stored objects. For parsed
DeleteObjectsrequests, an incomplete or unparseable 2xx result no longer authorizes removal of the pre-forward metadata versions. Complete, parsed results retain the existing per-key error handling and version guard. Proxy-mode conservative invalidation is unchanged.TestTieredBulkDeleteTruncatedFailurePreservesLocalObjectchecks the same failure scenarios before and after the handler change.This condition holds with this change and does not hold at
6c04b1ebf459e45f9b5289d13312def9fca3bf2f:For POST /{bucket}?delete in tiered mode, a valid request containing a non-versioned local-tier key with successful pre-forward metadata lookup and unchanged, unexpired metadata must not remove its captured metadata after an incomplete or unparseable 2xx upstream result; a key whose upstream deletion was rejected remains readable through validated GET and HEAD..TestTieredBulkDeleteResultControlspasses on the final source. It covers complete all-error and quiet-success replies and a newer local PUT during forwarding. The existingTestHandleDeleteObjects_UnparseableResultInvalidatesAllAndPreservesResponsealso passes on the final source and retains proxy-mode malformed-result coverage. The small adapter used for the source comparison is not part of this pull request; the native tests are.make buildandmake lint-cipassed, as did the focused proxy tests. The fullmake testsuite remains target-CI work.Generated by Perfloop.
Note
Medium Risk
Changes authoritative metadata removal for tiered bulk deletes; incorrect gating could leave stale objects or drop metadata too aggressively, but scope is limited to DeleteObjects convergence with new regression tests.
Overview
Tiered
DeleteObjectsno longer drops local metadata on ambiguous upstream 2xx bodies. Post-success reconciliation now runsconvergeTieredDeleteonly when the captured response is complete and theDeleteResultXML parses; truncated reads, read errors after a partial body, and malformed XML leave pre-forward metadata and validated GET/HEAD behavior unchanged. Per-key success vs<Error>handling is unchanged when the result is complete and parseable.Proxy-mode bulk delete behavior is unchanged: it still invalidates before forward and, after 2xx, can conservatively fence every requested key when the result cannot be parsed. Docs in
README.mdanddocs/tiered-mode.mdspell out the split between proxy invalidation and tiered authoritative metadata.Adds
proxy/tiered_bulk_delete_test.gofor incomplete/unparseable failures, all-error replies, quiet success, and a racing local PUT during an in-flight delete.Reviewed by Cursor Bugbot for commit 7873c1b. Bugbot is set up for automated code reviews on this repo. Configure here.