Repository navigation
Upload an empty blob in a single part in the Azure read and write copy - #131587
alexey-milovidov merged 1 commit into
Conversation
`UploadHelper::performCopy` chose the single-part path only for `total_size < max_single_part_upload_size`, so with `max_single_part_upload_size = 0` an empty blob went to the multipart path, whose `calculatePartSize` rejects size 0 with LOGICAL_ERROR `Chosen multipart upload for an empty file. This must not happen`. `plain_rewritable` copies the blob of every file it unlinks, and the flag of a permanently detached table is an empty file, so `ATTACH TABLE` of such a table in a database on an Azure `plain_rewritable` disk with `max_single_part_upload_size = 0` (and `use_native_copy = 0`, the disk default) failed and left the table permanently detached; debug and sanitizer builds aborted. Found by La Casa Del Dolor (amd_msan). Use `<=`, the rule `WriteBufferFromAzureBlobStorage` already applies to the same setting and `copyS3File` applies on S3. An object of exactly `max_single_part_upload_size` bytes is now uploaded with one Put Blob, as the writer already does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261114-101400 |
|
Workflow [PR], commit [4a29ba2] Summary: ✅
AI ReviewSummaryPR #131587 fixes copying empty Azure blobs when Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units8 translation units recompiled, 13 s compile time in total, 8 of them have a recent master baseline. |
1be838e
Related: #94024
Related: #129316
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
Logical error: Chosen multipart upload for an empty filewhen an Azure Blob Storage disk withmax_single_part_upload_size = 0copies an empty file, for example onATTACH TABLEof a permanently detached table in a database stored on aplain_rewritableAzure disk.Description
On 26.3.60.2, 26.8.34.13 and 26.10.2.103,
ATTACH TABLEof a table detached withDETACH TABLE ... PERMANENTLY, in a database on aplain_rewritableAzure disk withmax_single_part_upload_size = 0, fails withCode: 49 ... Chosen multipart upload for an empty file. This must not happen, and the table stays permanently detached; debug and sanitizer builds abort. Found by La Casa Del Dolor (amd_msan): fatal.log (report).Root cause: before removing a file,
plain_rewritablecopies its blob, and the permanently-detached flag is an empty file. Withuse_native_copy = 0(the disk default) the copy reads and writes throughUploadHelper::performCopy, which chose the single-part upload only fortotal_size < max_single_part_upload_size. With the threshold0an empty blob went to the multipart path, whosecalculatePartSizerejects size 0.Change: use
<=, the ruleWriteBufferFromAzureBlobStoragealready applies to the same setting andcopyS3Fileapplies on S3. An empty blob is now always uploaded in a single part. The only other effect: an object of exactlymax_single_part_upload_sizebytes is now uploaded with onePut Blob, as the writer already does.Validation: the new stateless test fails on master (the server aborts) and passes with the fix, 50/50 randomized runs; the same holds for an
encrypteddisk overcacheover the Azure disk. The Azure stateless tests give the same results with and without the fix.Workflow [PR]
Sync PR [sync-upstream/pr/131587]
Version info
26.11.1.2374-master(included in26.11and later)