Skip to content

Fix azure append duplicate in PutContent - #6

Merged
Fricounet merged 1 commit into
datadogfrom
fricounet/azure-append-duplicate
Jun 5, 2026
Merged

Fricounet merged 1 commit into
datadogfrom
fricounet/azure-append-duplicate

Conversation

@Fricounet

@Fricounet Fricounet commented Jun 3, 2026 •

Copy link
Copy Markdown

Write PutContent objects as block blobs so Azure retries overwrite small objects instead of appending duplicate link contents. Delete legacy append-blob objects before uploading because Azure cannot replace an AppendBlob with a BlockBlob in place. Preserve zero-byte append compatibility and add Azure regression coverage for link-style content, legacy migration, and concurrent same-path writes.

The origin of the issue stems from distribution#4576 which implemented some changes from gitlab's container-registry. The issue is that in the gitlab changes, there was no modification of PutContent, which kept using an in-place update of BlockBlob instead of an AppendBlob while the distribution PR made the switch to AppendBlob.
Funnily this exact same issue had been fixed 10y ago by switching AppendBlob to BlockBlob at the time just like this PR is doing :D

@datadog-datadog-prod-us1-2

This comment has been minimized.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.30%. Comparing base (4084733) to head (4474f68).
⚠️ Report is 1 commits behind head on datadog.

Additional details and impacted files
@@           Coverage Diff            @@
##           datadog       #6   +/-   ##
========================================
  Coverage    56.30%   56.30%           
========================================
  Files          117      117           
  Lines         8719     8719           
========================================
  Hits          4909     4909           
  Misses        3140     3140           
  Partials       670      670           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Fricounet Fricounet changed the title Fricounet/azure append duplicate Fix azure append duplicate in PutContent Jun 5, 2026
@Fricounet
Fricounet force-pushed the fricounet/azure-append-duplicate branch from 4474f68 to e3b15a8 Compare June 5, 2026 09:15
Write PutContent objects as block blobs so Azure retries overwrite small objects instead of appending duplicate link contents. Delete legacy append-blob objects before uploading because Azure cannot replace an AppendBlob with a BlockBlob in place. Preserve zero-byte append compatibility and add Azure regression coverage for link-style content, legacy migration, and concurrent same-path writes.

@eakman-datadog eakman-datadog 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.

🚀 🚀

}

size = *props.ContentLength
if *props.BlobType == blob.BlobTypeBlockBlob && size == 0 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As discussed together, with this case we are "just" accepting an new happy path : when the blob is empty, we accept that append it is in fact replacing it.

We need to focus when deploying that immutability of BlobTypeBlockBlob is not assumed in the code (for example in a cache)

@Fricounet
Fricounet merged commit ed36aae into datadog Jun 5, 2026
1 check passed
@Fricounet
Fricounet deleted the fricounet/azure-append-duplicate branch June 5, 2026 13:58
@Fricounet
Fricounet restored the fricounet/azure-append-duplicate branch June 5, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants