[feature] (cloud) Add Alibaba Cloud OSS C++ SDK stack - Part 1#61329
[feature] (cloud) Add Alibaba Cloud OSS C++ SDK stack - Part 1#61329nsivarajan wants to merge 1 commit into
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
/review |
There was a problem hiding this comment.
Code Review: OSS Native Storage Vault Support
This PR adds a significant new feature — native Alibaba Cloud OSS storage vault support with ECS instance profile, STS AssumeRole, and explicit AK/SK authentication. The architecture closely mirrors the existing S3 implementation, which is a good structural choice. However, the review identified several critical and high-severity issues that must be addressed before merge.
Critical Checkpoint Conclusions (per code-review skill Part 1.3)
1. Does the code accomplish its goal?
- Partially. The code implements the OSS file system, reader, writer, credential providers, cloud recycler accessor, and FE vault management. However, several correctness bugs and missing pieces prevent it from being production-ready.
2. Is the modification small, clear, and focused?
- The scope is large but well-organized across clear module boundaries. However, the change is large enough that thorough testing is essential, and the test coverage has significant gaps.
3. Concurrency:
- Issue found:
OSSFileWriter::_complete_part_task_callbackwrites_stwithout holding_completed_lock, while the S3 equivalent holds the lock. This is a data race. - Issue found:
OSSFileWriterdestructor does not wait on_async_close_pack->futureunlike S3, creating use-after-free risk with async close. OSSClientHolderconcurrency model is acceptable (lock-and-copy pattern forget()).
4. Lifecycle management:
- Issue found: OSS SDK
InitializeSdk()is called butShutdownSdk()is never called (both in BE and cloud modules). - Critical:
OSSFileWriterdestructor does not wait on async close future — potential use-after-free.
5. Configuration items:
- New configs
max_oss_client_retry,oss_read_base_wait_time_ms,oss_read_max_wait_time_msare mutable and properly declared.
6. Incompatible changes:
- None. The protobuf enum
OSS = 0already existed.USE_OSSifdef ensures backward compatibility.
7. Parallel code paths:
- Multiple divergences from S3: Missing
check_after_uploadverification, missingSCOPED_CONCURRENCY_COUNT, missingcompile_check_begin.h, different error handling inexists_impl, differentlist_implsemantics.
8. Test coverage:
- Critical gap:
OSSStorageVaultTesthas a bug invalidProps()(missingtypekey) — ALL tests will throwIllegalArgumentExceptionfrom the base class. - BE credential provider tests require live cloud infrastructure — no mocked unit tests.
- Regression test lacks negative test cases and does not use
order_qtpattern. - Cloud accessor tests will fail due to missing empty-path guards in
delete_directoryandlist_directory.
9. Observability:
- bvar metrics are added for reader and writer. OSS accessor has latency recorders. Adequate.
- Minor: OSS reuses S3 DorisMetrics (with TODO comments), conflating monitoring.
10. Transaction/persistence:
- CRITICAL:
OSSResourceis NOT registered inGsonUtils.resourceTypeAdapterFactory. When FE journals anOSSResourcecreation/alter to EditLog and then replays it on restart, deserialization will fail because the subtype is unknown. This can prevent FE from starting. File:fe/fe-core/src/main/java/org/apache/doris/persist/gson/GsonUtils.java— add.registerSubtype(OSSResource.class, OSSResource.class.getSimpleName()).
11. FE-BE variable passing:
OSSProperties.getObjStoreInfoPB()does not setuse_path_styleunlikeS3Properties.
12. Performance:
batch_upload_implis sequential (no parallelism) — acceptable for now but suboptimal.download_implbuffers entire file in memory viardbuf()— could OOM for large files.
13. Other issues:
- SECURITY:
runtime.setIgnoreSSL(true)in STS AssumeRole path disables TLS certificate verification for credential exchange. - Data safety:
parse_oss_last_modifiedreturns 0 (epoch) on parse failure, causing the recycler to treat unparseable objects as maximally old and delete them. build.shnever passesBUILD_OSSto cmake for BE — theDISABLE_BUILD_OSSenv var has no effect.- STS AssumeRole always uses
ecs_ram_rolefor base credentials, ignoring user-provided AK/SK.
Summary of Issues by Severity
| Severity | Count | Key Issues |
|---|---|---|
| CRITICAL | 3 | OSSResource not in GsonUtils (FE crash on restart), setIgnoreSSL(true) in STS path, OSSStorageVaultTest broken |
| HIGH | 8 | Writer _st data race, writer destructor use-after-free, delete_directory/list_directory missing guards, exists() swallows errors, parse failure → epoch deletion, STS ignores AK/SK, BUILD_OSS not passed to cmake, OSSResource weak validation |
| MEDIUM | 10+ | Missing compile_check, missing check_after_upload, list_impl semantics, retry only handles 2 error codes, etc. |
| LOW | 6+ | Metric reuse, temp file naming, jitter range, etc. |
Inline comments are attached to the most important issues.
6a99dd0 to
e8db2f2
Compare
gavinchou
left a comment
There was a problem hiding this comment.
Nice PR, however, there may be something need to consider more carefully.
Introducing OSSStorageVault will break the consistency with the existing S3StorageVault which also can access OSS. And, it may introduce extra complexity.
Try to use the provider field and some configurations to make the existing s3 vaults work with native OSS client too. e.g.
if (vault.provider == "OSS" && Config.enable_oss_native_sdk) {
objclient = new OssRemote(); // check DefaultRemote.java and RemoteBase.java for more info
}
the above pattern should also work for the BE side.
I left some initial feedback on this PR, and feel free to discuss or suggest changes.
|
Thanks @gavinchou for the suggestion. Agreed on consistency — the modified approach removes OSSStorageVault and reuses S3StorageVault. OSS is detected by endpoint via OSSProperties.guessIsMe() and serialized through OSSProperties.getObjStoreInfoPB(), which stamps provider=OSS in the proto. On the BE side, provider=OSS + enable_oss_native_sdk routes to the native Alibaba OSS SDK (required for ECS instance profile, STS AssumeRole, RRSA/OIDC); otherwise falls back to the existing AWS SDK S3-compatible path. All other providers are unchanged. The Thrift storage policy path (PushStoragePolicyTask) and the flat-map path (TVF/Export/Load) are also designed to carry provider=OSS through to the BE so routing is consistent across all paths. Hope this aligns with the Doris pattern for standardisation and future provider additions — please let me know if any adjustment is needed. |
…pe credential support
4550afe to
0e6ec62
Compare
0e6ec62 to
25e3898
Compare
|
run buildall |
TPC-H: Total hot run time: 29376 ms |
TPC-DS: Total hot run time: 177743 ms |
ClickBench: Total hot run time: 24.95 s |
FE UT Coverage ReportIncrement line coverage `` 🎉 |
|
run feut |
FE UT Coverage ReportIncrement line coverage `` 🎉 |
What problem does this PR solve?
Issue Number: close #65793
Related PR: part 1 of 4 — see issue for full series
PR's to follow : PR2: #65794
Problem Summary
Doris BE currently accesses OSS through the AWS S3-compatible SDK path. This works for basic AK/SK operations but cannot use ECS instance profile credentials, STS AssumeRole, RRSA, or environment variable providers — all of which require the native Alibaba Cloud OSS C++ SDK.
The
fe-filesystem-ossSPI module only supports static AK/SK credentials for OSS. Users running Doris on Alibaba Cloud ECS must embed long-lived access keys in configuration even when an ECS RAM role is attached, and cannot use STS AssumeRole or Kubernetes RRSA (RAM Roles for Service Accounts) for pod-level identity.This PR completes the FE-side credential chain for the
fe-filesystem-ossSPI, adding type-based dispatch viaoss.credentials_providerand support for:oss.role_arn/oss.external_idoss.oidc_token_file+oss.oidc_provider_arn)ALIBABA_CLOUD_ACCESS_KEY_ID/SECRETThis is PR 1 of 4. It is additive and does not change any existing code paths. The native OSS C++ SDK (BE-side routing) is wired in PR-3, gated behind
enable_oss_native_sdk = falseby default.Changes
fe/fe-filesystem/fe-filesystem-oss/pom.xml— addaliyun-java-sdk-sts 3.1.3andaliyun-java-sdk-core 4.7.6AliyunCredentialsBridge.java(new) — adaptsAlibabaCloudCredentialsProviderto the OSS SDK'sCredentialsProviderinterface; handles session token extraction forBasicSessionCredentialsOssCredentialsProviderType.java(new) — enum foross.credentials_providervalues with aliases (ecs_ram_role→INSTANCE_PROFILE,web_identity→OIDC)OssFileSystemProperties.java—toBackendKv()now includes"provider"="OSS"so BE can route to the native SDK pathOssObjStorage.java—buildOssClient()switches onOssCredentialsProviderType; ECS role name auto-discovered from metadata ifoss.ecs_ram_role_nameunsetfe/fe-core/(additive only)OSSProperties.java— addsroleArn(OSS_ROLE_ARN),externalId(AWS_EXTERNAL_ID);getBackendConfigProperties()now emits"provider"="OSS",AWS_ROLE_ARN,AWS_EXTERNAL_IDfor BE credential routingRelease note
Add
oss.credentials_providertype-based dispatch for ECSinstance profile, STS AssumeRole, RRSA, and environment variable credential modes. Existing static AK/SK path is unchanged. All changes are additive.Check List
Test:
Behavior changed:
oss.credentials_providerproperty key accepted in OSS catalog/SPIproperties. No existing property keys changed. Default behavior (static AK/SK)
is preserved when
oss.credentials_provideris absent.Documentation: