Skip to content

Commit

Permalink
k/quota_mgr: clean up unused quota enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
pgellert committed May 2, 2024
1 parent 91f2da7 commit 64df46a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
13 changes: 2 additions & 11 deletions src/v/kafka/server/quota_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ quota_manager::maybe_add_and_retrieve_quota(
ss::sstring(qid),
client_quota{
now,
clock::duration(0),
{static_cast<size_t>(_default_num_windows()), _default_window_width()},
{static_cast<size_t>(_default_num_windows()), _default_window_width()},
/// pm_rate is only non-nullopt on the qm home shard
Expand Down Expand Up @@ -245,12 +244,7 @@ throttle_delay quota_manager::record_produce_tp_and_throttle(
auto target_tp_rate = get_client_target_produce_tp_rate(quota_id);
auto delay_ms = throttle(
quota_id, target_tp_rate, now, it->second.tp_produce_rate);
auto prev = it->second.delay;
it->second.delay = delay_ms;
throttle_delay res{};
res.enforce = prev.count() > 0;
res.duration = it->second.delay;
return res;
return {.duration = delay_ms};
}

void quota_manager::record_fetch_tp(
Expand All @@ -276,10 +270,7 @@ throttle_delay quota_manager::throttle_fetch_tp(
it->second.tp_fetch_rate.maybe_advance_current(now);
auto delay_ms = throttle(
quota_id, *target_tp_rate, now, it->second.tp_fetch_rate);
throttle_delay res{};
res.enforce = true;
res.duration = delay_ms;
return res;
return {.duration = delay_ms};
}

// erase inactive tracked quotas. windows are considered inactive if
Expand Down
9 changes: 0 additions & 9 deletions src/v/kafka/server/quota_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,7 @@ class quota_manager : public ss::peering_sharded_service<quota_manager> {
using clock = ss::lowres_clock;

struct throttle_delay {
bool enforce{false};
clock::duration duration{0};
clock::duration enforce_duration() const {
if (enforce) {
return duration;
} else {
return clock::duration::zero();
}
}
};

quota_manager();
Expand Down Expand Up @@ -125,7 +117,6 @@ class quota_manager : public ss::peering_sharded_service<quota_manager> {
// pm_rate: partition mutation quota tracking - only on home shard
struct client_quota {
clock::time_point last_seen;
clock::duration delay;
rate_tracker tp_produce_rate;
rate_tracker tp_fetch_rate;
std::optional<token_bucket_rate_tracker> pm_rate;
Expand Down

0 comments on commit 64df46a

Please sign in to comment.