Skip to content

Instantly share code, notes, and snippets.

@layus
Created December 7, 2023 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save layus/d9da87d4c9694ad09d3be66fe49f606c to your computer and use it in GitHub Desktop.
Save layus/d9da87d4c9694ad09d3be66fe49f606c to your computer and use it in GitHub Desktop.
diff --git a/tmp2/source/src/v/cloud_storage/remote_segment.cc b/tmp/source/src/v/cloud_storage/remote_segment.cc
index e64d1264180a..194a5264dc09 100644
--- a/tmp2/source/src/v/cloud_storage/remote_segment.cc
+++ b/tmp/source/src/v/cloud_storage/remote_segment.cc
@@ -83,7 +83,7 @@ public:
ss::future<uint64_t>
operator()(uint64_t size, ss::input_stream<char> stream) {
- for (const auto [start, end] : _range) {
+ for (const auto &[start, end] : _range) {
const auto bytes_to_read = end.value_or(_segment._size - 1) - start
+ 1;
auto reservation = co_await _segment._cache.reserve_space(
diff --git a/tmp2/source/src/v/kafka/server/tests/offset_for_leader_epoch_utils.cc b/tmp/source/src/v/kafka/server/tests/offset_for_leader_epoch_utils.cc
index 01423fcf6b4b..327d1bcb8240 100644
--- a/tmp2/source/src/v/kafka/server/tests/offset_for_leader_epoch_utils.cc
+++ b/tmp/source/src/v/kafka/server/tests/offset_for_leader_epoch_utils.cc
@@ -26,7 +26,7 @@ kafka_offset_for_epoch_transport::offsets_for_leaders(
model::topic topic_name, pid_to_term_map_t term_per_partition) {
kafka::offset_for_leader_epoch_request req;
kafka::offset_for_leader_topic t{topic_name, {}, {}};
- for (const auto [pid, term] : term_per_partition) {
+ for (const auto &[pid, term] : term_per_partition) {
t.partitions.emplace_back(kafka::offset_for_leader_partition{
.partition = pid,
.current_leader_epoch = kafka::leader_epoch{-1},
diff --git a/tmp2/source/src/v/redpanda/admin_server.cc b/tmp/source/src/v/redpanda/admin_server.cc
index 47b267c890b7..1ddc9d73bfbf 100644
--- a/tmp2/source/src/v/redpanda/admin_server.cc
+++ b/tmp/source/src/v/redpanda/admin_server.cc
@@ -148,8 +148,8 @@ namespace {
template<typename C>
class lw_shared_container {
public:
- using iterator = C::iterator;
- using value_type = C::value_type;
+ using iterator = typename C::iterator;
+ using value_type = typename C::value_type;
explicit lw_shared_container(C&& c)
: c_{ss::make_lw_shared<C>(std::move(c))} {}
diff --git a/tmp2/source/src/v/resource_mgmt/cpu_profiler.cc b/tmp/source/src/v/resource_mgmt/cpu_profiler.cc
index 6ecc8e0719f2..9fafc5f704bb 100644
--- a/tmp2/source/src/v/resource_mgmt/cpu_profiler.cc
+++ b/tmp/source/src/v/resource_mgmt/cpu_profiler.cc
@@ -104,7 +104,7 @@ cpu_profiler::shard_samples cpu_profiler::shard_results() const {
ssx::sformat("{}", backtrace.first), backtrace.second);
}
- return {ss::this_shard_id(), dropped_samples, results};
+ return cpu_profiler::shard_samples(ss::this_shard_id(), dropped_samples, results);
}
void cpu_profiler::poll_samples() {
diff --git a/tmp2/source/src/v/resource_mgmt/cpu_profiler.h b/tmp/source/src/v/resource_mgmt/cpu_profiler.h
index 8beb8d7d9393..b06440985887 100644
--- a/tmp2/source/src/v/resource_mgmt/cpu_profiler.h
+++ b/tmp/source/src/v/resource_mgmt/cpu_profiler.h
@@ -56,6 +56,15 @@ public:
};
struct shard_samples {
+ shard_samples(
+ ss::shard_id shard,
+ size_t dropped_samples,
+ std::vector<sample> samples
+ ):
+ shard(shard),
+ dropped_samples(dropped_samples),
+ samples(samples)
+ { };
ss::shard_id shard;
size_t dropped_samples;
std::vector<sample> samples;
@@ -86,6 +95,13 @@ private:
config::binding<std::chrono::milliseconds> _sample_period;
struct profiler_result {
+ profiler_result(
+ size_t dropped_samples,
+ std::vector<seastar::cpu_profiler_trace> samples
+ ):
+ dropped_samples(dropped_samples),
+ samples(samples)
+ { };
size_t dropped_samples;
std::vector<seastar::cpu_profiler_trace> samples;
};
diff --git a/tmp2/source/src/v/serde/serde.h b/tmp/source/src/v/serde/serde.h
index e1e10df6321a..e5c1049dbe6d 100644
--- a/tmp2/source/src/v/serde/serde.h
+++ b/tmp/source/src/v/serde/serde.h
@@ -910,8 +910,8 @@ template<typename T>
std::decay_t<T>
read_nested(iobuf_parser& in, std::size_t const bytes_left_limit) {
using Type = std::decay_t<T>;
- static_assert(
- std::is_default_constructible_v<T> || has_serde_direct_read<T>);
+ //static_assert(
+ // std::is_default_constructible_v<T> || has_serde_direct_read<T>);
if constexpr (has_serde_direct_read<T>) {
auto const h = read_header<Type>(in, bytes_left_limit);
return Type::serde_direct_read(in, h);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment