token_metadata: update_topology: make endpoint_dc_rack arg optional
It's better to pass a disengaged optional when the caller doesn't have the information rather than passing the default dc_rack location so the latter will never implicitly override a known endpoint dc/rack location. Signed-off-by: Benny Halevy <bhalevy@scylladb.com> Closes #15300
This commit is contained in:
committed by
Tomasz Grabiec
parent
08f8fd30ea
commit
7119c1d8cc
@@ -118,8 +118,8 @@ public:
|
||||
return _bootstrap_tokens;
|
||||
}
|
||||
|
||||
void update_topology(inet_address ep, endpoint_dc_rack dr, std::optional<node::state> opt_st, std::optional<shard_id> shard_count = std::nullopt) {
|
||||
_topology.add_or_update_endpoint(ep, std::nullopt, std::move(dr), std::move(opt_st), std::move(shard_count));
|
||||
void update_topology(inet_address ep, std::optional<endpoint_dc_rack> opt_dr, std::optional<node::state> opt_st, std::optional<shard_id> shard_count = std::nullopt) {
|
||||
_topology.add_or_update_endpoint(ep, std::nullopt, std::move(opt_dr), std::move(opt_st), std::move(shard_count));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -933,8 +933,8 @@ token_metadata::get_bootstrap_tokens() const {
|
||||
}
|
||||
|
||||
void
|
||||
token_metadata::update_topology(inet_address ep, endpoint_dc_rack dr, std::optional<node::state> opt_st, std::optional<shard_id> shard_count) {
|
||||
_impl->update_topology(ep, std::move(dr), std::move(opt_st), std::move(shard_count));
|
||||
token_metadata::update_topology(inet_address ep, std::optional<endpoint_dc_rack> opt_dr, std::optional<node::state> opt_st, std::optional<shard_id> shard_count) {
|
||||
_impl->update_topology(ep, std::move(opt_dr), std::move(opt_st), std::move(shard_count));
|
||||
}
|
||||
|
||||
boost::iterator_range<token_metadata::tokens_iterator>
|
||||
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
/**
|
||||
* Update or add endpoint given its inet_address and endpoint_dc_rack.
|
||||
*/
|
||||
void update_topology(inet_address ep, endpoint_dc_rack dr, std::optional<node::state> opt_st = std::nullopt,
|
||||
void update_topology(inet_address ep, std::optional<endpoint_dc_rack> opt_dr, std::optional<node::state> opt_st = std::nullopt,
|
||||
std::optional<shard_id> shard_count = std::nullopt);
|
||||
/**
|
||||
* Creates an iterable range of the sorted tokens starting at the token t
|
||||
|
||||
@@ -31,6 +31,6 @@ struct endpoint_dc_rack {
|
||||
bool operator==(const endpoint_dc_rack&) const = default;
|
||||
};
|
||||
|
||||
using dc_rack_fn = seastar::noncopyable_function<endpoint_dc_rack(inet_address)>;
|
||||
using dc_rack_fn = seastar::noncopyable_function<std::optional<endpoint_dc_rack>(inet_address)>;
|
||||
|
||||
} // namespace locator
|
||||
|
||||
Reference in New Issue
Block a user