Repository navigation
squid-19.2.7: Backport/620 - #37
Merged
Merged
Conversation
When RGW rejects an S3 request with -ERR_RATE_LIMITED, return an HTTP Retry-After header that tells the client how many seconds to wait before retrying. The value is computed from the current token-bucket deficit and replenishment rate, so a polite client that honors the header will retry right around when its tokens recover. The delay is threaded out of the rate limiter through req_state and onto the response in abort_early(). The rate-limit check now returns int64_t seconds (0 = allowed) instead of bool, with a 1-second floor on the rejected path. The seconds-to-recover calculation is factored into a small static helper RateLimiterEntry::compute_delay(limit, needed, interval) so it can be unit-tested directly. Each dimension (ops, bytes) calls it independently and the caller takes the max, leaving room for additional limit dimensions in the future. The user-facing documentation is updated to describe the new header and to suggest proxy-layer remapping for operators who need 429 instead of the existing 503. Tracker: https://tracker.ceph.com/issues/64083 Tracker: https://tracker.ceph.com/issues/67655 Signed-off-by: Lumir Sliva <[email protected]> (cherry picked from commit 3dae903) 3dae903 has been cherry-picked without its parents: 91e9f00 "rgw: ops large budget caused by rate limiter was enabled and max_ops set to 0" and dae572d "rgw: add rate limit for LIST & DELETE ops" Conflicts: src/rgw/rgw_process.cc - rate_limit(): bool -> int64_t and remove s->info.request_params from should_rate_limit() (added by dae572d). src/rgw/rgw_ratelimit.h - should_rate_limit_list() and should_rate_limit_delete(): remove them (added by dae572d). - should_rate_limit_read(): remove decrement in `if (read_ops() > 0)` (91e9f00's fix). But keep return type int64_t. - should_rate_limit_write(): remove decrement in `if (write_ops() > 0)` (91e9f00's fix). But keep return type int64_t. - RateLimiterEntry::should_rate_limit(): signature switches `bool is_read` -> `OpType op_type` (dae572d). Kept the bool, changed only the return type to int64_t. - RateLimiterEntry::should_rate_limit(): keep the direct should_rate_limit_write() call instead of switch over OpType. - RateLimiter::should_rate_limit() signature: remove the added `const std::string& resource` parameter the `ldpp_dout(this, 21) << ... std::quoted(key) ...` trace (dae572d). Not a conflict but adapted manually: `main` reads the interval from g_ceph_context->_conf->rgw_ratelimit_interval, an option added by dae572d. Replace it with a new constant with the default value of 60s, RateLimiterEntry::ratelimit_interval_seconds = 60. src/test/rgw/test_rgw_ratelimit.cc - Change bool success / EXPECT_EQ(true|false, success) to int64_t delay / EXPECT_EQ(0, delay) or EXPECT_GT(delay, 0). - should_rate_limit(): do not apply the extra "" resource argument (dae572d). - giveback_tokens(); do not apply (resource, info) arguments to giveback_tokens() (dae572d). - OpType::Read/Write in the RGWRateLimitEntry tests stay as bool. (cherry picked from commit e90dca8) Signed-off-by: Uwe Schwaeke <[email protected]>
Signed-off-by: Uwe Schwaeke <[email protected]>
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.
Closes cobaltcore-dev/cloud-storage#620
Backport file
release-management/backports/<uuid>.mdadded (or updated) by this PRidin frontmatter matches the filename stemprovenance.upstream_prsset (orprovenance.type: otherwith another:block)Stage-B risk (filled per
release-management/backports/RISK-RUBRIC.md)blast— cosmetic / availability / data-lossconflict— clean / trivial / substantivecoverage— strong / partial / weakhighband)Merge
Land this via
just merge-backport PR=<N>— do not click the green merge button.The just recipe constructs the merge commit's
Backport-Idtrailer.