Skip to content

Preserve S3 chunks after uncertain PUT commits - #1470

Merged
bootjp merged 2 commits into
mainfrom
feature/s3-put-unknown-outcome
Nov 13, 2026
Merged

bootjp merged 2 commits into
mainfrom
feature/s3-put-unknown-outcome

Conversation

@bootjp

@bootjp bootjp commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Keep newly uploaded chunks when a PutObject metadata commit was attempted but its outcome is uncertain.
  • Add real-Raft regression coverage for lost commit replies with inline and offloaded chunks.

Risk

An indeterminate failed PUT can retain orphan chunks until reconciliation. This is intentional: deleting them could corrupt an object whose manifest committed. Definitive conflicts and pre-dispatch failures still clean up.

Verification

  • go test ./adapter -run \u0027TestS3(PutObject|UploadPart)LostCommitReplyPreservesReferencedChunks\u0027 -count=1 passed.
  • go test ./adapter -run \u0027^TestS3\u0027 -count=1 -timeout=5m passed.
  • Full local go test ./adapter -count=1 timed out after 10 minutes with a large multi-node Raft goroutine dump; sharded CI results are pending.
  • Commit hook lint: 0 issues.

Author: bootjp

Summary by CodeRabbit

  • 不具合修正
    • オブジェクトの更新や置き換え時に、処理結果を確認できないエラーが発生しても、保存済みのデータが失われにくくなりました。
    • 応答が失われた場合でも、置き換え後のオブジェクトを取得できるようになりました。

Signed-off-by: bootjp <contact@bootjp.me>
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 43 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 391dfd01-c09b-4824-aa10-94ede2b25c9e
Commits

Reviewing files that changed from the base of the PR and between 3b60102 and 823a8dc.

Files selected for processing: 2

  • adapter/s3.go
  • adapter/s3_mutation_outcome_test.go

No actionable comments were generated in the recent review.

Walkthrough

PutObjectのコミット失敗時に、アップロード済みチャンクを削除する条件を変更しました。コミット後にエラーが返る場合のテストを追加し、置換後のマニフェストと内容を確認します。

Changes: S3 PutObject のコミット結果

Layer / File(s) Summary
コミット結果に応じたチャンク保持
adapter/s3.go, adapter/s3_mutation_outcome_test.go
変更が未試行、またはエラーが再試行可能な場合に限り、失敗時にチャンクを削除します。テストでは、インラインとオフロードの各ケースで、コミット後にエラーが返る場合のチャンク保持を検証します。また、オブジェクト置換後のマニフェストと GET の内容を確認します。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • bootjp/elastickv#1357: S3 マルチパート処理で、書き込み結果が不確実な場合のチャンク保持を扱っています。

Suggested reviewers: claude

Merge Risk: Minimal · previous review 3b601

This change keeps uploaded S3 chunks when the outcome of a PutObject commit is uncertain. That avoids corrupting an object whose manifest may have committed. Orphan chunks may remain until reconciliation. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed PRタイトル「Preserve S3 chunks after uncertain PUT commits」は、変更の主目的を正確に示している。adapter/s3.go では、コミット試行済みで再試行不能なエラー時にチャンクを削除しないよう条件を変更しており、テストも未確定な PUT コミット後にチャンクが保持されることを検証している。タイトルは簡潔で、変更内容と一致する。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7ca137c8-aec2-4509-bd9b-035be87cdb4d
Commits

Reviewing files that changed from the base of the PR and between eb25adb and 3b60102.

Files selected for processing: 2

  • adapter/s3.go
  • adapter/s3_mutation_outcome_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@bootjp

bootjp commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T04:08:07.882845Z 823a8dc Manual request
🔒 Security Review ✅ Completed 2026-11-13T04:10:35.413503Z 823a8dc Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 3b60102f66

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bootjp
bootjp marked this pull request as ready for review November 13, 2026 03:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b60102f66

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread adapter/s3.go Outdated
Comment on lines +1025 to +1026
if !mutationAttempted || isRetryableS3MutationErr(err) {
s.cleanupS3PutObjectChunks(r.Context(), state, upload, bucket, objectKey)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clean up chunks after definitive non-retryable dispatch failures

If the metadata dispatch is rejected locally with kv.ErrLeaderProxyCircuitOpen after the payload has uploaded, this condition now skips cleanup even though the manifest cannot have committed. commitS3PutObject returns mutationAttempted=true whenever it calls the dispatch helper, while normalizeS3MetadataDispatchError preserves this definitive error and isRetryableS3MutationErr returns false for it. Consequently, these failed PUTs retain unreferenced payload chunks unnecessarily, potentially accumulating substantial storage during forwarding failures. Distinguish uncertain outcomes from definitive rejections rather than using retryability as the cleanup criterion.

Useful? React with 👍 / 👎.

Signed-off-by: bootjp <contact@bootjp.me>
@bootjp

bootjp commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

Addressed the P2 finding: definitive metadata-dispatch rejections now clean uploaded chunks; only an unknown transaction outcome suppresses cleanup. Added a pre-dispatch circuit-open regression for inline and offloaded writes. S3 tests passed locally.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 823a8dcf56

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 823a8dcf56

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@bootjp
bootjp merged commit abf7c5f into main Nov 13, 2026
18 checks passed
@bootjp
bootjp deleted the feature/s3-put-unknown-outcome branch November 13, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant