Commit 5a02f590 authored by Ahmad Tarraf's avatar Ahmad Tarraf
Browse files

client: fix repair_target_host to use distributor() accessor

repair_target_host() still referenced the removed raw distributor_
field; rebind through the distributor() accessor so it reads the
current routing snapshot.
parent 52ef5d1c
Loading
Loading
Loading
Loading
Loading
+4 −3
Changes for src/client/preload_context.cpp: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -860,12 +860,13 @@ PreloadContext::unavailable_hosts() {

std::optional<gkfs::rpc::host_t>
PreloadContext::repair_target_host(const gkfs::rpc::repair_task& task) const {
    if(!distributor_) {
    const auto distributor = this->distributor();
    if(!distributor) {
        return std::nullopt;
    }
    if(task.kind == gkfs::rpc::repair_kind::data_chunk) {
        const auto targets = gkfs::rpc::locate_replicas(
                *distributor_, task.path, task.chunk_id,
                *distributor, task.path, task.chunk_id,
                replica_context_.count());
        const auto it = std::find_if(targets.begin(), targets.end(),
                                     [&](const auto& target) {
@@ -878,7 +879,7 @@ PreloadContext::repair_target_host(const gkfs::rpc::repair_task& task) const {
       task.kind == gkfs::rpc::repair_kind::metadata_create_inline ||
       task.kind == gkfs::rpc::repair_kind::metadata_size ||
       task.kind == gkfs::rpc::repair_kind::metadata_inline) {
        return gkfs::rpc::locate_metadata_replica(*distributor_, task.path,
        return gkfs::rpc::locate_metadata_replica(*distributor, task.path,
                                                  task.target_copy)
                .host;
    }