[refactor](storage) Unify BE and Recycler object clients - #66350
Open
sollhui wants to merge 1 commit into
Open
Conversation
sollhui
requested review from
Gabriel39,
deardeng,
gavinchou,
liaoxin01,
luwei16,
morningman and
yiguolei
as code owners
August 1, 2026 09:09
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
Author
|
/review |
Move the shared S3/Azure clients, credential factories, pagination, and recursive deletion orchestration into common/client. Keep BE and Recycler policies in runtime hooks and adapters. Reuse the CPU-aware limiter manager and token-bucket fixes needed from apache#65420, but apply admission before each real provider SDK request instead of wrapping logical operations. Test: Not run (per request).
sollhui
force-pushed
the
agent/unify-be-recycler-obj-client
branch
from
August 1, 2026 09:44
f30abce to
dc25d3e
Compare
Contributor
|
Codex automated review failed and did not complete. Error: Codex completed, but no new pull request review was submitted for the current head SHA. Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
gavinchou
reviewed
Aug 1, 2026
| @@ -0,0 +1,103 @@ | |||
| // Licensed to the Apache Software Foundation (ASF) under one | |||
Contributor
There was a problem hiding this comment.
put client folder under common/cpp
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.
1. What does this PR do?
BE and Cloud Recycler currently maintain separate object-storage abstractions and separate S3/Azure client implementations. Although they call the same provider SDKs, they duplicate credential construction, error conversion, metrics, pagination, batch deletion, and provider-specific compatibility logic. The two implementations have also evolved different APIs and behavior, which makes fixes easy to apply to only one side.
This PR consolidates the provider-independent interface and the S3/Azure implementations under
common/client:ObjStorageClientinterface and shared request/response types.common/client.ObjectListIterator.ObjectStoreInfoPBwith the optional AWS session token so AK/SK/token credentials follow the same path in BE and Recycler; redact the token from logs and debug output.The branch is based on master after #65420. It keeps the CPU-aware limiter configuration and token-bucket behavior from that PR, while moving admission to the shared client immediately before each real provider SDK request.
Validation: local compilation and tests were not run as requested. The changed C++ files were formatted, and the final patch passed static whitespace, stale-include, and conflict-marker checks.
2. How are the different behaviors unified?
doris::io::ObjStorageClient, using BEStatus-style codes and eager list resultsdoris::cloud::ObjStorageClient, using integer return codes and a separate iterator APIdoris::ObjStorageClientand one set of request/response types.doris::ioaliases keep BE call sites source-compatible, while Recycler adapters convert the shared response back to its existing integer-facing API.common/client; both BE and Recycler call the same provider code.retand error messageObjectStorageResponsealways carries a Doris status code, HTTP code, and request ID. Provider failures continue updatingrecord_object_request_failed. Local BE limiter rejection keeps HTTP code0, so #65420's provider-429 retry distinction is preserved.false/empty to indicate completionEND_OF_FILEis an internal iterator sentinel and is converted to a successful empty result bynext(). It is distinct from a real providerNOT_FOUND, so a provider 404 is not silently swallowed.NoSuchKeywas treated as an empty list for S3-compatible providers such as TOSNoSuchKey-as-empty behavior once for both callers.recycler_max_tasks_per_batch.1000for S3 and256for Azure). Shared recursive deletion uses that limit, and direct oversized delete calls are still split defensively by the provider client.S3ClientFactory; empty credentials meant anonymous accessAwsCredentialFactoryimplements static AK/SK/session-token credentials, provider chains, role ARN, and external ID once. The caller explicitly selects the previous empty-credential behavior:ANONYMOUSfor BE andDEFAULT_CHAINfor Recycler.AzureAuthFactorycreates the container client and shared-key credential for both. BE's TLS CA diagnostic context remains attached to Azure errors.S3ClientConfsupported a token, butObjectStoreInfoPBdid not carry it through the storage-vault pathObjectStoreInfoPBObjectStoreInfoPB -> S3Conf -> AwsCredentialFactorynow carries AK/SK/token consistently. Token values are cleared or masked before logging.client_bvar::ScopedLatencyRAII timer. Public/common stopwatch utilities are unchanged.3. Architecture before and after
Before this PR, BE and Recycler reached the same provider SDKs through parallel implementations. Cross-cutting behavior was duplicated on both sides:
After this PR, adapters retain deployment-specific policy, while all provider behavior is implemented once in
common/client:The key boundary is that provider mechanics are shared, while environment-specific decisions remain in BE and Recycler adapters. This prevents the S3/Azure implementations from depending on BE or Recycler configuration and keeps future provider fixes in one place.