Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v23.3.x] admin: fix cache trim parameter order #18764

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/v/cloud_storage/cache_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ ss::future<> cache::trim_manually(
std::optional<size_t> object_limit_override) {
vassert(ss::this_shard_id() == 0, "Method can only be invoked on shard 0");
auto units = co_await ss::get_units(_cleanup_sm, 1);
vlog(
cst_log.info,
"Beginning manual trim, requested bytes limit: {}, requested object "
"limit: {}",
size_limit_override,
object_limit_override);
co_return co_await trim(size_limit_override, object_limit_override);
}

Expand Down
12 changes: 6 additions & 6 deletions src/v/redpanda/admin/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ get_integer_query_param(const ss::http::request& req, std::string_view name) {

const ss::sstring& str_param = req.query_parameters.at(key);
try {
return std::stoi(str_param);
return std::stoull(str_param);
} catch (const std::invalid_argument&) {
throw ss::httpd::bad_request_exception(
fmt::format("Parameter {} must be an integer", name));
Expand Down Expand Up @@ -4042,7 +4042,7 @@ admin_server::delete_cloud_storage_lifecycle(
model::initial_revision_id revision;
try {
revision = model::initial_revision_id(
std::stoi(req->param["revision"]));
std::stoll(req->param["revision"]));
} catch (...) {
throw ss::httpd::bad_param_exception(fmt::format(
"Revision id must be an integer: {}", req->param["revision"]));
Expand All @@ -4061,13 +4061,13 @@ admin_server::delete_cloud_storage_lifecycle(
ss::future<ss::json::json_return_type>
admin_server::post_cloud_storage_cache_trim(
std::unique_ptr<ss::http::request> req) {
auto size_limit = get_integer_query_param(*req, "objects");
auto bytes_limit = static_cast<std::optional<size_t>>(
auto max_objects = get_integer_query_param(*req, "objects");
auto max_bytes = static_cast<std::optional<size_t>>(
get_integer_query_param(*req, "bytes"));

co_await _cloud_storage_cache.invoke_on(
ss::shard_id{0}, [size_limit, bytes_limit](auto& c) {
return c.trim_manually(size_limit, bytes_limit);
ss::shard_id{0}, [max_objects, max_bytes](auto& c) {
return c.trim_manually(max_bytes, max_objects);
});

co_return ss::json::json_return_type(ss::json::json_void());
Expand Down
Loading