Skip to content

squid-19.2.7: Backport/620 - #37

Merged
uw-sc merged 2 commits into
squid-19.2.7-cobaltcore-storagefrom
backport/620
Oct 16, 2026
Merged

uw-sc merged 2 commits into
squid-19.2.7-cobaltcore-storagefrom
backport/620

Conversation

@uw-sc

@uw-sc uw-sc commented Oct 16, 2026

Copy link
Copy Markdown

Closes cobaltcore-dev/cloud-storage#620

Backport file

  • release-management/backports/<uuid>.md added (or updated) by this PR
  • id in frontmatter matches the filename stem
  • provenance.upstream_prs set (or provenance.type: other with an other: block)

Stage-B risk (filled per release-management/backports/RISK-RUBRIC.md)

  • blast — cosmetic / availability / data-loss
  • conflict — clean / trivial / substantive
  • coverage — strong / partial / weak
  • Risk-notes paragraph in the prose section (required for high band)

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-Id trailer.

lumir-sliva and others added 2 commits October 16, 2026 11:04
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]>
@uw-sc
uw-sc merged commit 6c4302a into squid-19.2.7-cobaltcore-storage Oct 16, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants