Repository navigation
Use offset in performSinglepartUpload for Azure - #114975
Conversation
|
Workflow [PR], commit [2b0e5b7] Summary: ✅
AI ReviewSummaryThe PR fixes incremental Azure backup range uploads by honoring Final VerdictStatus: ✅ Approve LLVM Coverage ReportMeasured on commit 2b0e5b7.
Changed lines: Changed C/C++ lines covered: 52/57 (91.23%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units12 translation units recompiled, 38 s compile time in total, 12 of them have a recent master baseline. |
`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.
|
🕵 Follow-up on my previous reply, after reproducing this against Azurite with a 26.7 server (neither fix present) — the bug is real and it loses data, but the route to it is narrower than the report says, and the test needed one more setting to reach it. There is a second gate besides the multi-object one. With
|
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=114975&sha=42581e0c27fdd48645f31bdb01747e2c06d8d98b&name_0=PR&name_1=Docker%20keeper%20image and provide a fix in a separate PR. If the fix is already in progress, link it here. It is unrelated to this pull request, which does not touch the Docker images: |
|
Confirmed unrelated to this pull request. Only the The retry is already in place and it declined this failure. From
It is per-request, as you read it. The amd64 leg of this same job resolved Sending a separate PR that adds the missing signature. Both Docker image jobs share the list, so the server image leg is covered too. |
|
Fix PR: #117301 Rather than adding the One correction to the breadth figure. Of the 24 |
|
📊 Cloud Performance Report ✅ AI verdict: This PR only changes Azure blob-storage backup copy code (dropping the unused offset argument from copyAzureBlobStorageFile and routing partial-range copies through a buffered upload). None of that runs during a TPC-H query. The single flagged Q17 "improvement" (-34.0%, median 100 -> 66 ms) is on a query the deterministic history flags as noisy, and with the base run's measurements themselves being highly variable, this is run-to-run variance rather than a real speedup — downgraded to not_sure. No query-execution regressions or improvements are attributable to this change. clickbench🟢 No significant changes tpch_adapted_1_officialFlagged queries (1 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
…quest method `Docker keeper image` failed resolving its two base images from Docker Hub with `httpReadSeeker: failed open: unexpected status from GET request to ...: 400 Bad Request`, and the retry did not fire: `No retryable errors found, stopping retries`, `command failed after 1/2 attempt(s)`. `BUILDX_RETRY_ERRORS` carried `unexpected status from HEAD request`, and its status-code entries are 429/5xx only, so nothing matched a 400 on a GET. The method is an interpolated field of a single containerd format string, `unexpected status from %s request to %s: %s`, so the entry only ever covered whichever method happened to be observed when it was written. Dropping the method from the token makes it a strict superset of the entry it replaces: the removed string contains the new one as a prefix, so every stderr line retried before is still retried. A second attempt would have worked. The failing leg died at metadata resolution after 951 s, while `head-alpine-arm64`, same platform and same two base images, resolved both fresh in 0.6 s each only 9 s later. So this was one invocation stuck on one poisoned request pair, and the 400 was transient, which is also why a status-code allowlist is unsound for this failure mode. The token accepts a permanent 4xx too. That is bounded by `BUILDX_RETRIES = 2`, it is already the status quo for HEAD, and `buildx_timeout` already divides the remaining job budget by 2 attempts, so a second attempt consumes budget the model already reserves. Neither the attempt count nor the timeout divisor changes here. Validated by replaying the captured stderr through `Shell.run`: master's list matches 0 of its 17 runtime tokens and stops at 1/2 attempts, byte-identical to the CI log, while the new token matches 3 lines and reaches 2/2. Changing only GET to HEAD in that same capture makes master's own unmodified list retry it, which isolates the request method as the whole defect. Genuine permanent buildx failures, including a live capture, still fail fast on the first attempt. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=114975&sha=42581e0c27fdd48645f31bdb01747e2c06d8d98b&name_0=PR&name_1=Docker%20keeper%20image PR: ClickHouse#114975 Related: ClickHouse#114975 (comment) Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Cherry pick #114975 to 26.3: Use offset in performSinglepartUpload for Azure
Backport #114975 to 26.8: Use offset in performSinglepartUpload for Azure
…-buffer-overflows Conflicts in `BackupIO_AzureBlobStorage.cpp` and `copyAzureBlobStorageFile.h`: master (#114975) removed the `src_offset` parameter of `copyAzureBlobStorageFile` and made `BackupWriterAzureBlobStorage::copyFileFromDisk` take the Azure native copy only for whole-object copies, which is exactly the change requested by the AI review on this branch; keep master's version of both and thread this branch's `src_etag` argument through it.
Backport #114975 to 26.6: Use offset in performSinglepartUpload for Azure
Backport #114975 to 26.3: Use offset in performSinglepartUpload for Azure
Backport #114975 to 26.7: Use offset in performSinglepartUpload for Azure
Incremental backups to Azure Blob Storage wrote the wrong bytes for every file that is only partially copied.
performSinglepartUploadincopyAzureBlobStorageFile.cppread from position 0 instead ofoffset, so it uploaded the beginning of each file instead of the tail. Restoring such a backup silently dropped all data written after the base backup.copyAzureBlobStorageFilealso lost itssrc_offsetparameter, so that a range can no longer be dropped on the floor: its native-copy branch callsCopyFromUri/StartCopyFromUri, which carry no byte range and always transfer the whole source blob. ConsequentlyBackupWriterAzureBlobStorage::copyFileFromDisknow takes the native copy only when the request covers the entire source and copies a range through buffers, exactly likeBackupWriterS3::copyFileFromDisk. This guard is a consequence of the narrowed interface rather than a reproduced bug:BackupImpldispatches only immutable-file entries tocopyFileFromDisk, and those never have a partialbase_sizetoday, so no current backup path reached the native copy with a range. The data loss above is reproduced by the incrementalLogtable tests, which go through the ranged buffered upload.Closes: #103193
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed incremental backups to Azure Blob Storage storing the beginning of each file instead of its tail. Restoring such a backup silently dropped all the data written after the base backup.
Workflow [PR]
Sync PR [sync-upstream/pr/114975]
Version info
26.8.3.46,26.7.7.32,26.6.5.57,26.3.32.11