locator: tablet_map: get_primary_replica: return tablet_replica
This is required by repair when it will start using get_primary_replica in a following patch. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -245,9 +245,9 @@ dht::token_range tablet_map::get_token_range(tablet_id id) const {
|
||||
}
|
||||
}
|
||||
|
||||
host_id tablet_map::get_primary_replica(tablet_id id) const {
|
||||
tablet_replica tablet_map::get_primary_replica(tablet_id id) const {
|
||||
const auto info = get_tablet_info(id);
|
||||
return info.replicas.at(size_t(id) % info.replicas.size()).host;
|
||||
return info.replicas.at(size_t(id) % info.replicas.size());
|
||||
}
|
||||
|
||||
future<std::vector<token>> tablet_map::get_sorted_tokens() const {
|
||||
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
dht::token_range get_token_range(tablet_id id) const;
|
||||
|
||||
/// Returns the primary replica for the tablet
|
||||
host_id get_primary_replica(tablet_id id) const;
|
||||
tablet_replica get_primary_replica(tablet_id id) const;
|
||||
|
||||
/// Returns a vector of sorted last tokens for tablets.
|
||||
future<std::vector<token>> get_sorted_tokens() const;
|
||||
|
||||
@@ -5055,7 +5055,7 @@ future<std::map<token, inet_address>> storage_service::get_tablet_to_endpoint_ma
|
||||
const auto& tmap = tm.tablets().get_tablet_map(table);
|
||||
std::map<token, inet_address> result;
|
||||
for (std::optional<locator::tablet_id> tid = tmap.first_tablet(); tid; tid = tmap.next_tablet(*tid)) {
|
||||
result.emplace(tmap.get_last_token(*tid), tm.get_endpoint_for_host_id(tmap.get_primary_replica(*tid)));
|
||||
result.emplace(tmap.get_last_token(*tid), tm.get_endpoint_for_host_id(tmap.get_primary_replica(*tid).host));
|
||||
co_await coroutine::maybe_yield();
|
||||
}
|
||||
co_return result;
|
||||
|
||||
Reference in New Issue
Block a user