Skip to content

fix(s3): fix concurrent write exception for oci (#3310)#3313

Merged
allenzhu merged 1 commit into
1.6from
cp_oci_concurrency
Apr 14, 2026
Merged

fix(s3): fix concurrent write exception for oci (#3310)#3313
allenzhu merged 1 commit into
1.6from
cp_oci_concurrency

Conversation

@allenzhu
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 14, 2026 09:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses OCI-specific behavior where conditional S3 writes can fail with a concurrent update error even after another concurrent attempt has already succeeded, by suppressing failure recording for “losing” attempts once a write is completed.

Changes:

  • Suppress failed putObjectStats(..., false) recording for fast-retry attempts if another attempt has already completed successfully.
  • Short-circuit the primary write failure handler when another attempt has already completed, releasing the buffer and skipping failure stats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +369 to +377
// OCI S3 and AWS S3 have different write mechanisms for conditional operations.
// AWS silently overwrites objects, while OCI returns the following error:
// FAILED_PRECONDITION: A concurrent update to object xx was modified concurrently.
// If one write has succeeded, do not log failed records.
if (completedFlag.get()) {
data.release();
return null;
}

Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The new early-return in the primary write failure handler only checks completedFlag once at the top. There’s still a race where completedFlag can flip to true (fast-retry succeeds) after this check but before the code enqueues a retry, causing unnecessary extra writes/retries even though finalCf will (or already did) complete successfully. Consider re-checking completedFlag/finalCf.isDone() immediately before scheduling any retry (queued/delayed) and, if already completed, skip retry and release the remaining data reference.

Copilot uses AI. Check for mistakes.
Comment on lines +347 to +353
// OCI S3 and AWS S3 have different write mechanisms for conditional operations.
// AWS silently overwrites objects, while OCI returns the following error:
// FAILED_PRECONDITION: A concurrent update to object xx was modified concurrently.
// If one write has succeeded, do not log failed records.
if (!completedFlag.get()) {
S3OperationStats.getInstance().putObjectStats(objectSize, false).record(retryTimerUtil.elapsedAs(TimeUnit.NANOSECONDS));
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The added comment says “do not log failed records”, but the guarded call is recording failure metrics (putObjectStats(..., false)), not logging. Please adjust the wording (and ideally avoid duplicating the same multi-line comment in both handlers) so future readers don’t confuse metrics recording with log emission.

Copilot uses AI. Check for mistakes.
@allenzhu allenzhu merged commit 54d7676 into 1.6 Apr 14, 2026
10 checks passed
@allenzhu allenzhu deleted the cp_oci_concurrency branch April 14, 2026 12:47
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.

3 participants