Repository navigation
Fix ObjectStorageQueue/AzureQueue silently skipping files on an empty listing page with a continuation token - #109761
Conversation
|
Workflow [PR], commit [a45833f] Summary: ✅
AI ReviewSummaryThis PR fixes Final Verdict
|
28df446 to
6d30e28
Compare
6d30e28 to
59e6e66
Compare
…e with continuation token IObjectStorageIteratorAsync::nextBatch() treated an empty listing page as end-of-listing and dropped the continuation token. Azure Blob Storage can return an empty page with a non-empty NextMarker (e.g. at a partition boundary), so AzureQueue / azureBlobStorage silently skipped objects on later pages. Follow the token instead: only finish when a page is empty AND there are no more pages. Adds a unit test. Closes ClickHouse#109751.
59e6e66 to
a45833f
Compare
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 54/55 (98.18%) · Uncovered code |
|
Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment. TL;DRFix ObjectStorageQueue/AzureQueue silently skipping files on an empty listing page with a continuation token ClickGap verified: reproduced it with the script below on ReproductionNo SQL repro exists: the bug fires only when the object-storage backend returns an empty listing page together with a non-empty continuation token (Azure Blob Storage List Blobs at an internal partition boundary), which cannot be produced deterministically from a clickhouse invocation. Operational symptom on an affected build: an AzureQueue / ObjectStorageQueue over a large Azure container (or azureBlobStorage(...) table function) returns fewer/zero objects than exist — the queue 'lists forever but processes nothing' (metric AzureListObjects keeps climbing while ObjectStorageQueueListedFiles / ObjectStorageQueueProcessedFiles stay at 0). Deterministically covered by the C++ unit test ObjectStorageIteratorAsync.EmptyPageWithContinuationTokenDoesNotStopListing (src/Disks/DiskObjectStorage/ObjectStorages/tests/gtest_object_storage_iterator_async.cpp): pre-fix returns nothing, post-fix returns all objects.Bisect
Affects
Suggested next stepThe fix has landed on master; the affected release branches above still need the backport. Component: cc fix PR author: @GalBenMoshe ClickGap · Finding: Triage metadata
|
|
This is a severe bug. We need to backport it as far back as we can. Rewritable disk does full listing at the start to collect all the directories in it. If we get not full listing here, all the tables on this disk would be corrupted. |
Backport #109761 to 26.6: Fix ObjectStorageQueue/AzureQueue silently skipping files on an empty listing page with a continuation token
Backport #109761 to 26.3: Fix ObjectStorageQueue/AzureQueue silently skipping files on an empty listing page with a continuation token
Picks up the backport of #109761, without which the plain_rewritable per-directory file listing still stops on an empty page and the new integration test fails.
… silently skipping files on an empty listing page with a continuation token
… silently skipping files on an empty listing page with a continuation token
…ge-iterator-empty-page Fix ObjectStorageQueue/AzureQueue silently skipping files on an empty listing page with a continuation token
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
ObjectStorageQueue/AzureQueue(and theazureBlobStoragetable function) silently skipping objects when the object storage returns an empty listing page together with a continuation token. Azure Blob Storage does this (e.g. when a listing crosses an internal partition boundary), and the async list iterator was treating the empty page as the end of the listing and dropping the token. It now follows the continuation token.Description
Closes #109751.
IObjectStorageIteratorAsync::nextBatch()treated an empty listing page as end-of-listing: oncurrent_batch.empty()it setis_finished = true/has_next_batch = falseand never readresult.has_next, so it discarded the continuation token and never fetched later pages.Azure Blob Storage's
List Blobsmay legitimately return a page with zero results but a non-emptyNextMarker— the client must keep following the marker until it is empty. This is documented behavior and happens, for example, when a listing crosses an internal partition boundary in a large container. Because ClickHouse stopped on the first empty page,AzureQueueandazureBlobStorage(...)silently returned fewer/zero objects than actually exist: the queue "lists forever but processes nothing" (AzureListObjectskeeps climbing whileObjectStorageQueueListedFiles/ObjectStorageQueueProcessedFilesstay at 0). It is intermittent because it depends on Azure's partition layout, and can self-recover when the layout changes.S3/GCS are unaffected: their iterator returns
has_next = IsTruncated, andListObjectsV2does not return an empty page withIsTruncated=truefor a prefix that has matching keys, so the empty branch was only reached at true end-of-listing.Azure docs confirming the empty-page-with-marker behavior:
Fix: in
nextBatch(), honorhas_nextregardless of whether the page is empty — keep following the continuation token, and only finish when a page is empty and there are no more pages.Test: added
src/Disks/DiskObjectStorage/ObjectStorages/tests/gtest_object_storage_iterator_async.cpp— a scripted iterator that returns an empty page + "has more" followed by real pages (and an empty intermediate page), asserting all objects are returned. With the previous behavior it returns nothing; with the fix it returns all objects.Version info
26.7.1.747(included in26.7and later)26.6.5.68,26.3.33.11