Repository navigation
Conversation
|
Workflow [PR], commit [0657b45] Summary: ✅
AI ReviewSummaryThis PR broadens Azure retry handling so transient Findings❌ Blockers
Final VerdictRequest changes. |
23db35d to
d906f01
Compare
673c72f to
62433f9
Compare
c1feb11 to
180ef2d
Compare
7403d37 to
775580d
Compare
copyAzureBlobStorageFile's native server-side copy caught only Unauthorized (401) and BadRequest (400) and rethrew everything else, so a transient RBAC-propagation 403 surfaced as a hard error and a credential AuthenticationException escaped the catch entirely -- both contradicting the change's "treat Azure 403 as retryable in all callers" goal. Route 403 and AuthenticationException to the existing read+write fallback, whose retry loops already treat them as retryable. Co-Authored-By: Claude Opus 4.8 <[email protected]>
getObjectMetadata issued GetProperties() with no retry, so a transient 403 or a credential AuthenticationException escaped raw. It is on the copyObject path and under tryGetObjectMetadata (which maps only NotFound), so the transient failure was not shielded by any retry loop. Wrap it in the same isRetryableAzureException + AuthenticationException retry policy the read path uses. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Remove the single-use azureCopyShouldTryNativeCopy predicate (its only consumer, the unit test, was dropped) and inline the offset==0 check into copyAzureBlobStorageFile. Co-Authored-By: Claude Opus 4.8 <[email protected]>
ReadBufferFromAzureBlobStorage and AzureObjectStorage each had an identical
anonymous-namespace getBlobPropertiesWithRetry (retry GetProperties on a
retryable 403 / credential AuthenticationException with bounded backoff). Move
it to a single IO/AzureBlobStorage/getBlobPropertiesWithRetry.{h,cpp} and call
it from both.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…broken part A connect/request timeout was caught in PocoAzureHTTPClient and turned into a synthetic HTTP 408 RawResponse. isRetryableAzureException classified 408 as non-retryable, so a transient timeout on the read path failed on the first attempt (bypassing the max_single_read_retries budget) and could be reported as POTENTIALLY_BROKEN_DATA_PART (issue #110724) -- the same false-critical symptom this PR already fixes for 403 and credential failures. Throw Azure::Core::Http::TransportException from the timeout handler instead of fabricating a 408, so the SDK RetryPolicy retries it and isRetryableAzureException treats it as retryable; also treat a genuine 408 as retryable as a safety net. Add a ONCE azure_inject_timeout failpoint and a read-retry regression test (one injected 408 is retried away and the read still returns its data). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Generalize the getBlobPropertiesWithRetry retry policy (retry a transient 403 / other retryable RequestFailedException and a credential AuthenticationException with bounded backoff) into a reusable retryAzureOperation() so the delete and native-copy paths can share the exact same policy. getBlobPropertiesWithRetry now delegates to it. Co-Authored-By: Claude Opus 4.8 <[email protected]>
check_objects_after_upload issued a raw GetProperties() after a successful upload; a transient 403/auth on that verification turned a good write into a final failure. Route it through getBlobPropertiesWithRetry. Co-Authored-By: Claude Opus 4.8 <[email protected]>
exists() ran GetProperties() under only a NotFound catch, and the delete paths (single, batch SubmitBatch, and per-object results) were single-shot, so a transient RBAC-propagation 403 or AuthenticationException failed them on the first attempt. Route them through the shared bounded retry helper, preserving the NotFound->absent mapping and the per-object blob_storage_log accounting (logged once, on the final outcome). Co-Authored-By: Claude Opus 4.8 <[email protected]>
A transient 403/auth from PollUntilDone does not mean the copy failed -- only that polling failed. Falling back to read+write there starts a second writer to the destination while the server-side copy may still be in flight. Only start the copy inside the fallback-eligible try; once StartCopyFromUri has returned, poll to completion on the same operation under the bounded retry policy and surface the error instead of switching mechanisms. Co-Authored-By: Claude Opus 4.8 <[email protected]>
7932a53 to
7f2398b
Compare
The per-object delete retry used a bare `catch (...)` to fall through and record the original error; ClickHouse's check_style `catch_all` rule flags a catch-all that neither rethrows, logs, nor saves the exception. Catch the specific Azure exception types (`RequestFailedException` / `AuthenticationException`) and record the retry's own error instead. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The read+write fallback in copyAzureBlobStorageFile (a ranged copy, or when a native server-side copy is skipped/unavailable) issued its Upload / StageBlock / CommitBlockList calls with no retry, so a transient destination 403 / auth / timeout failed the copy on the first attempt while the read side already retried. Wrap each write in the shared retryAzureOperation helper (budget max_single_download_retries) and rebuild the body stream per attempt so a retry re-sends from the start. Add a write-scoped ONCE failpoint azure_inject_forbidden_on_upload and an integration test that forces the read+write path (allow_azure_native_copy=0) and asserts the backup still succeeds.
…urning empty checksums checkDataPart caught a retryable exception (transient read, memory limit, or a retryable Azure 403/timeout) and returned empty checksums. Four of its six callers treat that empty result as a successful check: CHECK TABLE reports the part OK, loadChecksums persists an empty checksums.txt, the replicated part-check thread logs "looks good", and the CHECK TABLE recount branch instead throws a false mismatch. Rethrow the retryable exception instead -- every caller already has an isRetryableException guard that expects it, so the failure is surfaced/retried rather than masquerading as verified. Remove the now-redundant empty-result guard on the fetch path in DataPartsExchange. Broken-part suppression (POTENTIALLY_BROKEN_DATA_PART) is unchanged: it is gated at the read/reportBroken site, not by checkDataPart's return value.
Both catch arms of runWithRetries repeated the same budget-check / log_event / throw / warn / sleep / backoff sequence. Factor it into one retry_or_throw lambda. The non-retryable HTTP branch keeps its own immediate throw so the numeric status code stays in the message. Behavior-preserving.
The one-line wrapper had its own translation unit; move it inline into the header (all call sites already include it) and drop the .cpp.
|
Addressed the " |
| catch (const Azure::Core::RequestFailedException & e) | ||
| { | ||
| if (i == num_tries - 1 || !isRetryableAzureException(e, /* may_be_provisioning_access */ write_settings.is_initial_access_check)) | ||
| if (i == num_tries - 1 || !isRetryableAzureException(e)) |
There was a problem hiding this comment.
Retrying 403/408 here widens the normal blob-write path, but the two body-carrying callers still keep a single MemoryBodyStream outside the retry loop: the single-part Upload in preFinalize and the multipart StageBlock in writePart. After the first attempt the SDK may already have consumed that stream, so the next Upload/StageBlock can resend 0 or only a suffix of the payload instead of the original bytes.
copyAzureBlobStorageFile had to rebuild its MemoryBodyStream inside retryAzureOperation for exactly this reason. Please rebuild or rewind the request body per attempt here too before making a normal write-path 403/timeout retryable.
| } | ||
| } | ||
| catch (const Azure::Storage::StorageException & e) | ||
| catch (const Azure::Core::RequestFailedException & e) |
There was a problem hiding this comment.
removeObjectImpl now routes single-object deletes through retryAzureOperation, but this catch only records system.blob_storage_log failures for RequestFailedException. If token acquisition keeps failing until the retry budget is exhausted, retryAzureOperation rethrows Azure::Core::Credentials::AuthenticationException, which bypasses this block and drops the Delete log row for that deletion attempt.
That violates the deletion-logging contract, and it also contradicts the PR body's "removeObjectImpl preserves per-object delete accounting" claim. Please catch Azure::Core::Credentials::AuthenticationException here as well, log it once, and then rethrow.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 198/294 (67.35%) · Uncovered code |
|
Dear @arsenmuk, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed transient Azure Blob Storage errors during the RBAC permission-propagation window — a
403 Forbidden, a credentialAuthenticationException, or a connect/request timeout surfaced as408— being misreported asPOTENTIALLY_BROKEN_DATA_PARTand raising false critical alerts. Such transient authorization/transport failures are now treated as retryable and, if they persist, surface as a plain Azure error instead of a phantom broken part.Also fixes some following legacy issues:
403as retryable in all callers, not only the startup access check — the background-merge read path (no longer reclassified asPOTENTIALLY_BROKEN_DATA_PART), the write paths, the size/metadata lookups (tryGetFileSize/getRemoteFileMetadata/getObjectMetadata), and the server-side native copy (falls back to read+write on 403 instead of throwing)Azure::Core::Credentials::AuthenticationException, a separate type fromRequestFailedException) were not treated as retryable and could fail on the first attempt or hit the broken-part path — now retried within the same budget across the merge, write (incl. ADLS Gen2), size/metadata, delete, and native-copy pathsCloses #110724): a connect/request timeout was caught in the Poco transport and fabricated into a synthetic408response, whichisRetryableAzureExceptionthen dropped as non-retryable — so a transient timeout could surface a healthy part asPOTENTIALLY_BROKEN_DATA_PART. The timeout handler now throwsAzure::Core::Http::TransportException(already retried by the SDK retry policy and byisRetryableAzureException), and a genuine408is treated as retryablecopyAzureBlobStorageFileused server-sideCopyFromUri, which copies the whole source blob even for a ranged copy — now native copy is used only for a full-object copy (offset==0), and the read+write path that ranged copies fall back to seeks the source tooffset. The same bug on S3 was fixed independently on master (copyS3FileRange), so this PR keeps only an incremental Log-family S3 native-copy regression test that exercises that fix end-to-endStartCopyFromUrihad started a server-side copy, a transient error fromPollUntilDonefell back to read+write and started a second writer against the same destination while the original copy could still be in flight — now the read+write fallback applies only when starting the copy fails; a started copy is polled to completion on the same operationexists()/ delete retries:AzureObjectStorage::exists()and the object-delete paths (singleremoveObjectImpl, batchSubmitBatch, and per-object deferred responses) now retry a transient403/AuthenticationExceptionlike the read/upload paths, via a sharedretryAzureOperationhelper (the per-objectsystem.blob_storage_logaccounting is preserved)check_objects_after_uploadGetProperties()is now retried, so a transient failure of that check no longer turns an already-successful upload into a final failureMoveToNextPage, which skipped endpoint-prefix stripping on every page after the first — now paginates with the continuation token so every page is strippedsystem.blob_storage_logDelete events — now each object is logged before rethrowingRECEIVED_EMPTY_DATAinreadBigAtAzure::Core::RequestFailedExceptioninstead of onlyAzure::Storage::StorageException, so non-storage Azure failures don't bypass their status-code handlingTests: a failpoint-based integration suite (
test_azure_403_handling: 403 retried / not a broken part, credential auth-failure not a broken part, a408request timeout retried on read, batch-delete failure still logged), plus Azure and S3 incremental Log-family native-copy regression tests.Closes #106298
Closes #110724