[PATCH v1 3/4] gossiper: change make_random_gossip_digest to return value instead of modifying passed parameter

1 view
Skip to first unread message

Gleb Natapov

<gleb@scylladb.com>
unread,
Apr 7, 2025, 3:41:12 AMApr 7
to scylladb-dev@googlegroups.com
---
gms/gossiper.hh | 3 +--
gms/gossiper.cc | 7 ++++---
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gms/gossiper.hh b/gms/gossiper.hh
index 1d1f984cee9..1677277a1be 100644
--- a/gms/gossiper.hh
+++ b/gms/gossiper.hh
@@ -369,9 +369,8 @@ class gossiper : public seastar::async_sharded_service<gossiper>, public seastar
* The gossip digest is built based on randomization
* rather than just looping through the collection of live endpoints.
*
- * @param g_digests list of Gossip Digests.
*/
- void make_random_gossip_digest(utils::chunked_vector<gossip_digest>& g_digests) const;
+ utils::chunked_vector<gossip_digest> make_random_gossip_digest() const;

public:
/**
diff --git a/gms/gossiper.cc b/gms/gossiper.cc
index 582f6403ae1..94e582466fd 100644
--- a/gms/gossiper.cc
+++ b/gms/gossiper.cc
@@ -1095,8 +1095,7 @@ void gossiper::run() {
logger.trace("My heartbeat is now {}", hbs.get_heart_beat_version());
}

- utils::chunked_vector<gossip_digest> g_digests;
- make_random_gossip_digest(g_digests);
+ utils::chunked_vector<gossip_digest> g_digests = make_random_gossip_digest();

if (g_digests.size() > 0) {
gossip_digest_syn message(get_cluster_name(), get_partitioner_name(), g_digests, get_group0_id());
@@ -1287,7 +1286,8 @@ void gossiper::quarantine_endpoint(locator::host_id id, clk::time_point quaranti
}
}

-void gossiper::make_random_gossip_digest(utils::chunked_vector<gossip_digest>& g_digests) const {
+utils::chunked_vector<gossip_digest> gossiper::make_random_gossip_digest() const {
+ utils::chunked_vector<gossip_digest> g_digests;
generation_type generation;
version_type max_version;

@@ -1306,6 +1306,7 @@ void gossiper::make_random_gossip_digest(utils::chunked_vector<gossip_digest>& g
}
g_digests.push_back(gossip_digest(es->get_ip(), generation, max_version));
}
+ return g_digests;
}

future<> gossiper::replicate(endpoint_state es, permit_id pid) {
--
2.47.1

Reply all
Reply to author
Forward
0 new messages