Repository navigation
Cherry pick #114975 to 26.3: Use offset in performSinglepartUpload for Azure - #118251
Merged
robot-clickhouse-ci-2 merged 10 commits intoSep 5, 2026
Merged
Conversation
`BackupWriterAzureBlobStorage::copyFileFromDisk` forwards `start_pos` and `length` into `copyAzureBlobStorageFile`, but the native-copy branch of that helper calls `CopyFromUri` / `StartCopyFromUri`, which carry no byte range and always transfer the entire source blob. The requested range was therefore silently ignored whenever `allow_azure_native_copy` was on, so an incremental backup could store a whole file where only its tail belongs, and restoring it would reconstruct the wrong bytes. Guard the native copy the same way `BackupWriterS3::copyFileFromDisk` does: it is used only when the request covers the entire source, measured with `getEncryptedFileSize` for an encrypted source. `start_pos != 0` alone is not a sound test, because a prefix `[0, length)` of a bigger file is a range too. Ranged copies fall back to `BackupWriterDefault::copyFileFromDisk`, which reads through buffers and honors the range. To make the trap unrepeatable, `copyAzureBlobStorageFile` loses its `src_offset` parameter: it now copies a whole blob, like `copyS3File`, and callers that need a range use `copyDataToAzureBlobStorageFile` instead. The new integration test reaches the native copy with a non-zero `start_pos`. A `Log` data file on an Azure disk normally gets one object per `INSERT`, and a multi-object source is already excluded from the native copy, so the table is truncated and refilled by a single `INSERT` with `max_block_size = 1`: every row lands in its own compressed block, the first block stays byte-identical to the one the base backup holds, and the whole file is a single blob.
An Azure disk hands out random blob paths, so by default `BackupFileInfo` takes the checksum of a file from its remote path (`canCalculateChecksumFromRemotePath`) and cannot compute a prefix checksum at all, which leaves `base_size` at 0 and makes every incremental backup copy whole files. The test therefore has to ask for content checksums with `allow_checksums_from_remote_paths = 0`, otherwise it never reaches the ranged copy it is meant to cover. Verified against Azurite with a 26.7 server, which has neither fix: the restored table comes back with one row instead of two. Disabling the native copy and forcing the multipart upload -- the offset-correct path in that build -- restores both rows, which is the route the fix now takes for a ranged copy.
The comment claimed the test reaches the native-copy branch of `BackupWriterAzureBlobStorage::copyFileFromDisk` with a partial range. It does not: a `Log` table backs its data files with `BackupEntryFromAppendOnlyFile`, and `BackupImpl` hands only immutable-file entries to `copyFileFromDisk`, so the incremental backup goes through `copyDataToFile`, i.e. the ranged buffered upload fixed in `performSinglepartUpload`. The whole-object guard in `copyFileFromDisk` is required because `copyAzureBlobStorageFile` no longer carries an offset, but no backup entry with a partial range is dispatched to it today. Addresses the AI review thread on this test.
Use offset in performSinglepartUpload for Azure
…ypick/26.3/114975 # Conflicts: # tests/integration/test_backup_restore_azure_blob_storage/test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #114975
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job