Commit Graph
31 Commits
Author SHA1 Message Date
Mingyu Chen (Rayner)andOwen Leung 378dc72412 branch-4.1: [fix](be): fix BE access to aws under eks pod identity #67076 (#67555)
Cherry-picked from #67076

**Depends on #67554** (the branch-4.1 backport of #66851) (the
aws-sdk-cpp 1.11.219 -> 1.11.221 pin). BE cannot compile
this without `GeneralHTTPCredentialsProvider.h`, which first ships in
1.11.221, so that PR has to
land and the pre-built thirdparty artifacts be re-published first.

### Backport notes

branch-4.1 does not have the `common/cpp/obj-client/` refactor, so this
could not be applied
verbatim:

- The `CredProviderType::Container` switch case lives in **two** places
on this branch,
`be/src/util/s3_util.cpp` and `cloud/src/recycler/s3_accessor.cpp`,
instead of the single
`common/cpp/obj-client/auth/aws_credential_factory.cpp` upstream. Both
now call
  `create_container_credentials_provider()`, and the then-unused
  `<aws/core/platform/Environment.h>` include was dropped from both.
- `common/cpp/aws_common.{h,cpp}` and
`common/cpp/custom_aws_credentials_provider_chain.cpp` carry
the same change as upstream (the new `AWS_CONTAINER_*` constants,
`container_credentials_available()`
and `create_container_credentials_provider()`); the declarations follow
this branch's local
  indentation in `aws_common.h`.
- The tests reach the same providers through this branch's entry points:
  `S3ClientFactory::get_aws_credentials_provider()` and
  `S3Accessor::_get_aws_credentials_provider_v2()`.
- `ContainerProviderTypeIsUsableAsStsBaseProvider` is **not** carried
over. Upstream it exists to
reach `AwsCredentialFactory::create()` below `S3ClientFactory`; this
branch has no such layer, so
the case would have been a second copy of
`ContainerProviderTypeReadsRotatedTokenFileForPodIdentity`
-- both go through the very same
`_create_credentials_provider(Container)`. The other five new
cases, the two new test headers and the MSK IAM cases are all carried
over unchanged.

The other files (`be/src/runtime/aws_msk_iam_auth.cpp`,
`be/test/runtime/aws_msk_iam_auth_test.cpp`,
`gensrc/proto/cloud.proto`, `gensrc/thrift/AgentService.thrift`) applied
cleanly.

`clang-format` 16 was run over every changed file under `be/src`,
`be/test`, `cloud/src` and
`cloud/test` (the paths the Code Formatter workflow checks) and reports
no diff. BE was **not**
compiled locally: this branch's `thirdparty/installed` is still on
aws-sdk-cpp 1.11.219, so the new
header is not available until the backport of #66851 lands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DzUYFcGHQH3bnLGCjpncVj

Co-authored-by: Owen Leung <owen.leung2@gmail.com>
2026-09-07 18:25:44 +08:00
github-actions[bot]andbobhan1 7c165f1301 branch-4.1: [improvement](cloud) Add dry-run mode for BE-to-MS RPC rate limiting #66977 (#67240)
Cherry-picked from #66977

Co-authored-by: bobhan1 <baohan@selectdb.com>
2026-09-06 15:50:17 +08:00
Refrainandliaoxin 8fdcc4d0b6 branch-4.1: [improvement](be) Add CPU-aware S3 rate limiter #65420 (#66896)
<!-- pr-watcher:conflict-pick
task_id=conflict-pick:ccb064f018a074242ce0193b0487f993c16feedbe9a1cb47bff45f24bdabda53
-->
### What problem does this PR solve?

Related PR: #65420

Backport
[apache/doris#65420](https://github.com/apache/doris/pull/65420) to
`branch-4.1`.

- Source merge commit: `c8b4a1c6d2105fef78a9c4db87e6a7ddde00c3c8`
- Target base commit: `984c535c98710a115b795be278710a1d987c67a5`

### Conflict resolution

- `be/src/common/config.cpp`: Added the source CPU-aware limiter
definitions while retaining branch-4.1’s
${DORIS_HOME}/plugins/connectors Trino path. (adapted)
- `be/src/util/s3_util.h`: Removed the obsolete factory rate_limiter API
required by the source change while retaining branch-4.1’s private
get_aws_credentials_provider declaration. (adapted)
- `be/src/util/s3_util.cpp`: Removed the branch-4.1 cache hash local
that became unused after applying the source factory cache-key refactor;
-Werror compilation exposed it. (adapted)
- `regression-test/data/cloud_p0/s3/test_s3_rate_limiter.out`: Removed
the extra blank line at EOF required by repository diff-check rules
without changing expected rows. (adapted)

### Checks actually run

- `git diff HEAD^ HEAD --check`: passed (exit 0)
- `clang-format --dry-run --Werror <changed C/C++ files>`: passed (exit
0)

No submodules were initialized. This automation only runs
formatting/whitespace, provenance,
conflict-marker, and clean-worktree checks. It does not run builds, unit
tests, or regression tests.

Co-authored-by: liaoxin <liaoxin@selectdb.com>
2026-08-20 09:23:00 +08:00
Gavin Chouandgavinchou b8a2a14dab branch-4.1: [fix](s3) Add S3 rate limit observability #64038 (#65974)
### What problem does this PR solve?

Backport #64038 to `branch-4.1`.

Add observability for S3 local rate limiting and S3/Azure 429 responses
so throttling-related performance issues can be diagnosed and alerted
more directly.

### What is changed?

- Add explicit S3 local rate limiter bvars for sleep duration, sleep
count, and rejected count.
- Rename the old ambiguous S3 local rate limiter bvars so their meaning
is clear.
- Log the first and every N local S3 rate limiter throttled/rejected
requests without reading bvar values for decisions.
- Add S3 429 retry/failure bvars for S3/Azure object clients, including
Azure batch delete failures.
- Capture the limiter configuration and result under the limiter lock to
avoid concurrent reset races.
- Adapt the Cloud configuration change to `branch-4.1` without bringing
in unrelated master-only fault-injection settings.

### New or renamed bvar metrics

Renamed local S3 GET limiter metrics:

- `get_rate_limit_ns` -> `s3_get_rate_limit_sleep_ns`
- `get_rate_limit_exceed_req_num` -> `s3_get_rate_limit_sleep_count`

Renamed local S3 PUT limiter metrics:

- `put_rate_limit_ns` -> `s3_put_rate_limit_sleep_ns`
- `put_rate_limit_exceed_req_num` -> `s3_put_rate_limit_sleep_count`

New local S3 limiter rejection metrics:

- `s3_get_rate_limit_rejected_count`
- `s3_put_rate_limit_rejected_count`

New S3/Azure 429 metrics:

- `s3_request_retry_too_many_requests_count`
- `s3_request_failed_too_many_requests_count`

Metric examples:

```text
s3_get_rate_limit_sleep_ns : 123456789
s3_get_rate_limit_sleep_count : 42
s3_get_rate_limit_rejected_count : 3
s3_put_rate_limit_sleep_ns : 987654321
s3_put_rate_limit_sleep_count : 27
s3_put_rate_limit_rejected_count : 1
s3_request_retry_too_many_requests_count : 8
s3_request_failed_too_many_requests_count : 2
```

Example local limiter logs:

```text
S3 GET request is throttled by local rate limiter, sleep_ms=12, sleep_count=1000, token_per_second=1000, bucket_tokens=2000, token_limit=5000
S3 PUT request is rejected by local rate limiter, rejected_count=1, token_per_second=1000, bucket_tokens=2000, token_limit=5000
```

### Tests

- `sh run-cloud-ut.sh --run --filter='s3_rate_limiter_test:*'` (7/7
passed)
- `sh run-be-ut.sh --run --filter='S3UTILTest.*:S3FileWriterTest.*'`
(24/24 passed)
- `sh run-be-ut.sh --run
--filter='AzureObjStorageClientTlsHelperTest.*'` (2/2 passed)

Co-authored-by: gavinchou <gavinchou@apache.org>
2026-07-24 11:13:50 +08:00
bobhan1 e96ddf07cb branch-4.1: [Opt](cloud) Add rate limit for BE to MS rpc (#64396)
## Proposed changes

Backport #60344 / eaa4ef92b9 to
branch-4.1.

This adds BE-to-MS RPC throttling support, including:
- host-level MS RPC rate limiters
- table-level MS backpressure throttling
- schema table exposure for backend MS RPC table throttlers
- token bucket rate limiter naming updates used by common S3/rate-limit
code

Conflict resolution notes:
- Kept branch-4.1 schema table numbering and added
SCH_BACKEND_MS_RPC_TABLE_THROTTLERS after the existing branch-local
entries.
- Kept branch-4.1 cloud config layout and added the new MS RPC
throttling configs before the compile-check boundary.

## Validation

- `git diff HEAD^ HEAD --check`
- `./run-be-ut.sh --run
--filter=HostLevelMSRpcRateLimitersTest.*:HostLevelMSRpcRateLimitersConfigTest.*:StrictQpsLimiterTest.*:TableRpcQpsRegistryTest.*:TableRpcThrottlerTest.*:MSBackpressureHandlerTest.*:LoadRelatedRpcTest.*:RpcThrottleStateMachineTest.*:RpcThrottleCoordinatorTest.*:RpcThrottleIntegrationTest.*
-j32`
  - 71 tests from 10 test suites passed.
2026-06-16 15:51:27 +08:00
github-actions[bot]andYixuan Wang 9eac4a594c branch-4.1: [fix](s3) Avoid retrying object storage SlowDown errors #63776 (#64327)
Cherry-picked from #63776

Co-authored-by: Yixuan Wang <wangyixuan@selectdb.com>
2026-06-10 14:08:37 +08:00
Yixuan Wang f63b7fd6bd branch-4.1: [improvement](cloud) Support configurable S3 credentials providers #62788 (#63680)
pick: https://github.com/apache/doris/pull/62788
2026-05-27 11:32:46 +08:00
Gavin Chouandgavinchou 3105e9d863 branch-4.1: (tools) Add show_segment_data operation to meta_tool (#62385)
## Summary
Pick #60608 to branch-4.1

Add new operation show_segment_data to meta_tool for reading and
displaying segment file column metadata and statistics.

## Changes
- Add get_field_type_string() to convert FieldType to readable string
- Add get_encoding_string() to convert EncodingTypePB to readable string
- Add get_compression_string() to convert CompressionTypePB to readable
string
- Add print_column_meta() to print column metadata recursively
- Add show_segment_data() to display segment file info and statistics
- Add common/cpp/private_member_accessor.hpp helper for accessing
private members

## Test
- [x] Compilation passed (BE meta_tool target)

## Related Issue
close #60608

---------

Co-authored-by: gavinchou <gavinchou@apache.org>
2026-04-17 12:34:39 +08:00
github-actions[bot]andYixuan Wang 921fcc02bd branch-4.1: [fix](sync_point) Fix heap-use-after-free in SyncPoint during program exit #61040 (#61434)
Cherry-picked from #61040

Co-authored-by: Yixuan Wang <wangyixuan@selectdb.com>
2026-03-18 17:35:25 +08:00
github-actions[bot]andYixuan Wang 067c41009f branch-4.0: [Enhancement](client) Supports dynamically changing the rate limiter config #59465 (#60118)
Cherry-picked from #59465

Co-authored-by: Yixuan Wang <wangyixuan@selectdb.com>
2026-01-30 16:43:13 +08:00
a6fc056a0a branch-4.0: [feat](catalog) Support passing credentials_provider_type to BE for S3 access #59082 (#59246)
Cherry-picked from #59082

Co-authored-by: zy-kkk <zhongyk10@gmail.com>
Co-authored-by: Calvin Kirs <guoqiang@selectdb.com>
2025-12-23 12:52:58 +08:00
Lei Zhang 90a79e160e branch-4.0: [feat](s3client) Use CustomAwsCredentialsProviderChain for aws sdk (#56065) (#56936)
### What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] Regression test
    - [ ] Unit Test
    - [ ] Manual test (add detailed scripts or steps below)
    - [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
        - [ ] Previous test can cover this change.
        - [ ] No code files have been changed.
        - [ ] Other reason <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
2025-10-16 11:56:48 +08:00
abmdocrt 7d6fef7b34 [Fix](Recycler) Fix recycler azure path fault (#54291) 2025-08-11 17:27:46 +08:00
Lei Zhang 0648859a0a [opt](storage) Add log and metric when aws/azure sdk do retry operation (#51485)
* Print azure sdk log to `be.INFO`
* Set aws_log_level=3 (WARN) and azure_log_level=2 (Warning) by default,
because when request failed, we don't know what happened in previously
* Set azure MaxRetries equal to config::max_s3_client_retry(10)
2025-06-12 22:10:08 +08:00
Lei Zhang a02ddbeb3a [fix](s3Client) Add ca_cert_file_paths conf for stsClient` and recycler (#50837)
* https://github.com/apache/doris/pull/32285 In previous, the pr add a
`ca_cert_file_paths` config for be s3Client, but lack of recycler and
stsClient
2025-05-13 21:36:54 +08:00
Lei Zhang b7e705b2aa [feat](s3client) Add role-based authorization for s3client (#49541) 2025-05-07 17:42:01 +08:00
Lei Zhang 00736e146b [opt](s3client) Add AWS SDK logger for recycler with error logging and enhance S3 client tests (#49422)
* Add aws sdk logger for recycler
* Default set `aws_log_level=2` for logging aws sdk error
* Add more ut for `S3ObjStorageClient`
2025-03-31 10:51:30 +08:00
Lei Zhang 329d000e35 [fix](be/recycler) Fix S3RateLimiter bvar rate_limit_exceed_req_num incorrectly
* Fix S3RateLimiter bvar `rate_limit_exceed_req_num` incorrectly
* Add more ut for S3RateLimter
2025-03-10 20:28:21 +08:00
deardeng 7b385c11fa [fix](log) Fix s3_rate_limiter.cpp LOG incomplete (#48440) 2025-03-04 20:31:49 +08:00
Gavin Chou de856351f9 [fix](syncpoint) Fix incorrect syncpoint 'has_point()' intorduced by (#43461) (#43784)
Related PR: #43461
2024-11-12 21:29:10 +08:00
deardeng 92e4857309 [fix](sync point) Fix sync point not reg but construct default value (#43461)
Fix open ENABLE_INJECTION_POINT complie switch, be log

```
W20241107 11:43:11.205868   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.275723   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.415167   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.484220   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.553351   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.622395   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.691509   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.830601   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.899286   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:11.967985   788 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:13.841727  1032 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:13.945942  1032 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:14.156761  1032 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:38.900395  3064 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:39.397446  3064 status.h:423] meet error status: [IO_ERROR]inject io error
W20241107 11:43:39.896116  3064 status.h:423] meet error status: [IO_ERROR]inject io error
```

For example, in the BE code:
```
TEST_SYNC_POINT_RETURN_WITH_VALUE("LocalFileReader::read_at_impl",
                                   Status::IOError("inject io error"))
```

However, this sync point is not used in the BE, although it is used in
the unit tests. But this macro, when expanded, will construct a default
value, and Status::IOError will print the stack log as soon as it is
constructed.
2024-11-12 10:23:52 +08:00
Lei Zhang 936ad96566 [fix](cloud) Fix aws sdk default retry policy not taking effect (#43575)
* AWS SDK default retry policy check response xml `code` to determine
retry or not, but other object storage such as `OSS`, `COS` not
compatible with AWS S3, so adding a custome retry policy for solving the
problem
2024-11-12 09:58:53 +08:00
Lei Zhang 895754bf40 [feat](cloud) Add injection point http api for ms (#41982) 2024-10-29 23:14:59 +08:00
sparrow 4f218b461a [Fix](compile) Fix clang-18 and libc++ compile problems (#34715)
## Proposed changes

Issue Number: close #xxx

Fix clang-18 and libc++ compile problems

unique() of shared_ptr is deprecated in clang-18, it's not a strict
implementation, can use use_count() instead.
And fixed some other compie errors in both using clang-18 and libc++.

## Further comments

If this is a relatively large or complex change, kick off the discussion
at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why
you chose the solution you did and what alternatives you considered,
etc...
2024-07-31 17:59:52 +08:00
AlexYue ec2cbbc5d2 [enhance](RateLimit) Add bvar to monitor object storage rate limit sleep time and failure time (#38294)
Add one bvar to monitor the failed request due to exceeds rate limit.
2024-07-31 11:35:41 +08:00
AlexYue c14320cb3c [enhance](Azure) Make azure dependency compile one config (#38239)
Previously the azure sdk would be compiled into BE by default. But
sometimes the BE would run in environment which only require AWS
s3-compatible functionality. So user can use `DISABLE_BUILD_AZURE` to
control whether build azure sdk into BE or not.

`export DISABLE_BUILD_AZURE=ON` to disable build with azure support
2024-07-25 23:44:38 +08:00
zy-kkk ba0eb23db0 [fix][compile] Resolve time_point type mismatch on MacOS and Linux (#38049)
revert #38036
We cannot change the time_point type directly, but use macros to
distinguish different compilation platforms, refer to #34054
2024-07-18 14:39:50 +08:00
AlexYue 529ba61503 [Improvement](ObjectStorage) Retry when encountering TooManyRequest response (#37199)
We can do retry for 429 using the embedded utility of corresponding sdk.
2024-07-18 11:43:16 +08:00
神技圈子 91b2030406 [fix] (compile) Resolve time_point type mismatch in s3_rate_limiter.cpp in mac (#38036)
A compilation error in `s3_rate_limiter.cpp` due to a type mismatch
between `std::chrono::system_clock::time_point` and
`std::chrono::high_resolution_clock::time_point`,Updated the
`_update_remain_token` function to accept
`std::chrono::high_resolution_clock::time_point` instead of
`std::chrono::system_clock::time_point` on MacOS。
2024-07-18 11:36:20 +08:00
AlexYue 0ad6289e1e [feature](Recycler) Add rate limit for all obj storage client implementation (#37663)
We should enable rate limit for all kinds of network IO of recycler.
This pr adds the rate limiter for obj storage client.
2024-07-16 17:24:31 +08:00
plat1ko bca8b07d7b [refactor](cloud) Extract SyncPoint to common cpp (#37165)
## Proposed changes

Extract SyncPoint to common cpp directory. Some code shared between BE
and Cloud will gradually be extracted to the `$repo_root/common/cpp`
directory in the future.
2024-07-09 17:07:59 +08:00