xylaaaaa opened a new pull request, #69082:
URL: https://github.com/apache/doris/pull/69082
### What problem does this PR solve?
Issue Number: None
Related PR: #67470
Problem Summary: BE creates every native object storage client from one flat
`S3ClientConf`. Azure reuses `ak/sk/bucket` as account/key/container, while
region, the AWS role and the AWS credential provider type sit in the same
struct and only mean something for S3. `S3ClientFactory` builds AWS and Azure
clients, owns one shared client cache, applies the rate-limit wrapper and
initializes the AWS SDK. `ObjClientHolder` keeps a mutable conf and client
side by side: `reset()` writes them under the lock, but `s3_client_conf()`
and
`full_s3_path()` read the conf without it, and two concurrent resets that
both merged onto the same old conf silently overwrite each other.
This is the first step of the BE object storage refactor. It changes how
clients are configured and managed without changing any caller-facing input:
- Add `io::ObjStorageClientConfig` with shared connection options, a client
usage (internal storage / external access) and exactly one backend
alternative: `S3ClientConfig` or `AzureClientConfig`. Azure authentication
is
a variant of methods (SharedKey only today), so a new method is a new
alternative instead of another loosely related field.
- Add `ObjStorageConfigResolver::from_client_conf()`, the single mapping from
the legacy conf. All existing inputs (FE properties, `TS3StorageParam`,
`ObjectStoreInfoPB`) still produce an `S3ClientConf` and reach the
providers
through it.
- Split construction into `S3ClientProvider` and `AzureClientProvider`, each
with its own cache keyed by the full typed config, dispatched by
`ObjStorageClientFactory`. SDK clients are still built outside the cache
lock; a losing concurrent candidate is now released after unlocking. The
BE rate-limit policy moves next to the factory and is applied by every
provider in the same way.
- `S3ClientFactory` keeps its public API as a compatibility entry: it
validates the legacy conf, keeps the test client hook, and still owns the
AWS SDK lifetime, the CA certificate path and the AWS credential helpers.
- `ObjClientHolder` now owns an immutable `ObjClientState` (conf, client,
generation) and replaces it as a whole. Readers take one snapshot, so the
conf and client always come from the same generation. A reset is published
only if no other publish happened since it read the state; otherwise it
returns `ABORTED` and the holder keeps the newer state. Both callers
(`update_s3_resource` and storage vault refresh) already handle a failed
reset by logging a warning and keeping the existing file system.
Client identity now follows the selected backend: S3 clients are no longer
split by bucket (an AWS SDK client is not bound to a bucket), and Azure
clients are no longer split by region, token or AWS role fields that the
Azure client never read. The provider cache singleton is created after the
AWS SDK is initialized, so cached AWS clients are released before
`Aws::ShutdownAPI`.
Renaming `S3URI`, `S3FileSystem`, `S3FileReader` and `S3FileWriter`, and
migrating callers from `S3ClientConf` to the typed config, are left to
follow-up changes.
### Release note
None
### Check List (For Author)
- Test: Unit Test (added, not run)
- Added `be/test/io/obj_storage/obj_storage_client_factory_test.cpp` for
the
resolver mapping, backend-specific identity, credential masking,
provider caching, holder snapshots and the concurrent reset conflict.
- Updated tests that assigned the holder's private client to use
`set_client_for_test`.
- BE was not compiled and unit tests were not run in this change;
clang-format 16 and `build-support/check-build-hygiene.sh` passed.
- Behavior changed: Yes. S3 clients are shared across buckets with the same
endpoint and credentials; Azure clients ignore S3-only fields for reuse; a
reset that races with another reset on the same holder returns `ABORTED`
instead of overwriting it.
- Does this need documentation: No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]