Skip to content

fix(blob): give copied blobs their own page ranges and committed blocks - #2894

Open
compiler-segfault (compiler-segfault) wants to merge 1 commit into
Azure:mainfrom
compiler-segfault:fix/copy-blob-own-page-ranges
Open

compiler-segfault (compiler-segfault) wants to merge 1 commit into
Azure:mainfrom
compiler-segfault:fix/copy-blob-own-page-ranges

Conversation

@compiler-segfault

Copy link
Copy Markdown

startCopyFromURL and copyFromURL in LokiBlobMetadataStore hand the new
blob the source's pageRangesInOrder and committedBlocksInOrder arrays
instead of copies of them. Both arrays are mutated in place: uploadPages,
clearRange and resizePageBlob rewrite the page range list, and
appendBlock pushes to the committed block list. The source and the copy end
up sharing one list, so:

  • Copying a page blob and then writing a page to the copy changes what the
    source reads back, and the source's ETag does not change.
  • Restoring a snapshot over its base blob and then writing to the restored
    blob changes what the snapshot reads back, so a backup is overwritten by the
    next write after a restore.
  • Copying an append blob and then appending to the copy adds that block to the
    source as well, and the source's own next block is not visible.

Clone both lists when the destination blob is created, using the same shape
cloneBlobModel already uses, and reuse those helpers there. The chunks
themselves stay shared copy-on-write; only the lists that are mutated in place
are copied. The SQL metadata store is not affected, since it deserializes each
blob separately.

Three regression tests cover the page blob copy, the snapshot restore and the
append blob copy. All three fail on main and pass with the change.
pageblob.test.ts and appendblob.test.ts pass in full (100 passing, 1
pending), and eslint is clean.

Fixes #2890.

Copy Blob handed the source's pageRangesInOrder and
committedBlocksInOrder arrays to the new blob. Both are mutated in
place, so writing to a copy, or to a blob restored from a snapshot,
also changed what the source blob or the snapshot read back.

Clone both lists when the destination blob is created, as
cloneBlobModel already does.
Copilot AI balanced review requested due to automatic review settings November 7, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants