Skip to content

Commit 31ca5f1

Browse files
authored
Merge pull request #31002 from andrwng/metastore-retry-configs
ct/l1/metastore: add configurations for RPC retries
2 parents 19359c7 + 6de81aa commit 31ca5f1

7 files changed

Lines changed: 58 additions & 10 deletions

File tree

src/v/cloud_topics/level_one/metastore/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,15 @@ redpanda_cc_library(
176176

177177
redpanda_cc_library(
178178
name = "retry",
179+
srcs = [
180+
"retry.cc",
181+
],
179182
hdrs = [
180183
"retry.h",
181184
],
185+
implementation_deps = [
186+
"//src/v/config",
187+
],
182188
visibility = ["//visibility:public"],
183189
deps = [
184190
":metastore",

src/v/cloud_topics/level_one/metastore/leader_router.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "cluster/metadata_cache.h"
1717
#include "cluster/partition_leaders_table.h"
1818
#include "cluster/shard_table.h"
19+
#include "config/configuration.h"
1920
#include "hashing/murmur.h"
2021
#include "model/namespace.h"
2122
#include "resource_mgmt/cpu_scheduling.h"
@@ -250,13 +251,16 @@ requires requires(
250251
ss::future<typename req_t::resp_t>
251252
leader_router::remote_dispatch(req_t request, model::node_id leader_id) {
252253
using resp_t = req_t::resp_t;
254+
auto rpc_timeout
255+
= config::shard_local_cfg().cloud_topics_metastore_rpc_timeout_ms();
253256
auto res = co_await _connection_cache->local()
254257
.with_node_client<proto_t>(
255258
_self,
256259
ss::this_shard_id(),
257260
leader_id,
258261
rpc_timeout,
259-
[request = std::move(request)](proto_t proto) mutable {
262+
[request = std::move(request),
263+
rpc_timeout](proto_t proto) mutable {
260264
return (proto.*Func)(
261265
std::move(request),
262266
::rpc::client_opts{

src/v/cloud_topics/level_one/metastore/leader_router.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ class leader_router : public ss::peering_sharded_service<leader_router> {
134134
using proto_t = cloud_topics::l1::rpc::impl::l1_rpc_client_protocol;
135135
using client = cloud_topics::l1::rpc::impl::l1_rpc_client_protocol;
136136

137-
static constexpr std::chrono::seconds rpc_timeout{5};
138-
139137
// utilities for boiler plate RPC code.
140138

141139
template<auto Func, typename req_t>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2026 Redpanda Data, Inc.
3+
*
4+
* Licensed as a Redpanda Enterprise file under the Redpanda Community
5+
* License (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* https://github.com/redpanda-data/redpanda/blob/master/licenses/rcl.md
9+
*/
10+
#include "cloud_topics/level_one/metastore/retry.h"
11+
12+
#include "config/configuration.h"
13+
14+
#include <seastar/core/lowres_clock.hh>
15+
16+
namespace cloud_topics::l1 {
17+
18+
retry_chain_node make_default_metastore_rtc(ss::abort_source& as) {
19+
return {
20+
as,
21+
ss::lowres_clock::now()
22+
+ config::shard_local_cfg().cloud_topics_metastore_retry_timeout_ms(),
23+
default_metastore_retry_backoff};
24+
}
25+
26+
} // namespace cloud_topics::l1

src/v/cloud_topics/level_one/metastore/retry.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ namespace cloud_topics::l1 {
2424

2525
using namespace std::chrono_literals;
2626

27-
static constexpr auto default_metastore_retry_timeout = 5s;
2827
static constexpr auto default_metastore_retry_backoff = 100ms;
2928

30-
inline retry_chain_node make_default_metastore_rtc(ss::abort_source& as) {
31-
return {
32-
as,
33-
ss::lowres_clock::now() + default_metastore_retry_timeout,
34-
default_metastore_retry_backoff};
35-
}
29+
/// Build a retry_chain_node whose overall deadline is driven by the
30+
/// cloud_topics_metastore_retry_timeout_ms cluster config property.
31+
retry_chain_node make_default_metastore_rtc(ss::abort_source& as);
3632

3733
template<typename Func>
3834
concept metastore_operation = requires(Func f) {

src/v/config/configuration.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5073,6 +5073,22 @@ configuration::configuration()
50735073
"behind and writes are being throttled.",
50745074
{.needs_restart = needs_restart::no, .visibility = visibility::tunable},
50755075
5min)
5076+
, cloud_topics_metastore_rpc_timeout_ms(
5077+
*this,
5078+
"cloud_topics_metastore_rpc_timeout_ms",
5079+
"Timeout for a single L1 metastore RPC to the metastore partition "
5080+
"leader. Bounds one attempt; the overall operation may retry until "
5081+
"cloud_topics_metastore_retry_timeout_ms elapses.",
5082+
{.needs_restart = needs_restart::no, .visibility = visibility::tunable},
5083+
30s)
5084+
, cloud_topics_metastore_retry_timeout_ms(
5085+
*this,
5086+
"cloud_topics_metastore_retry_timeout_ms",
5087+
"Overall deadline for retrying an L1 metastore operation on transport "
5088+
"errors. To allow more than one attempt, keep this larger than "
5089+
"cloud_topics_metastore_rpc_timeout_ms.",
5090+
{.needs_restart = needs_restart::no, .visibility = visibility::tunable},
5091+
90s)
50765092
, cloud_topics_metastore_block_cache_size(
50775093
*this,
50785094
"cloud_topics_metastore_block_cache_size",

src/v/config/configuration.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,8 @@ struct configuration final : public config_store {
852852
cloud_topics_metastore_replication_timeout_ms;
853853
property<std::chrono::milliseconds>
854854
cloud_topics_metastore_lsm_apply_timeout_ms;
855+
property<std::chrono::milliseconds> cloud_topics_metastore_rpc_timeout_ms;
856+
property<std::chrono::milliseconds> cloud_topics_metastore_retry_timeout_ms;
855857
bounded_property<size_t> cloud_topics_metastore_block_cache_size;
856858
bounded_property<size_t> cloud_topics_metastore_write_buffer_size;
857859
bounded_property<uint32_t> cloud_topics_metastore_max_pre_open_fibers;

0 commit comments

Comments
 (0)