Commit a8916aee authored by Ramon Nou's avatar Ramon Nou
Browse files

Handle local sources in replica migration

parent 7581a73c
Loading
Loading
Loading
Loading
Loading
+5 −0
Changes for src/daemon/malleability/malleable_manager.cpp: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -679,6 +679,10 @@ MalleableManager::redistribute_metadata() {
int
MalleableManager::do_migration(gkfs::rpc::MigrationJob& job) {
    if(gkfs::rpc::is_replica_migration_job(job)) {
        if(job.source_node == RPC_DATA->local_host_id()) {
            // The normal path below reads the local chunk storage and writes
            // the target. Use it when the selected source copy is local.
        } else {
            std::vector<char> buffer(gkfs::config::rpc::chunksize);
            const auto result = gkfs::malleable::rpc::forward_data_from_source(
                    job.path, buffer.data(), buffer.size(), job.chunk_id,
@@ -688,6 +692,7 @@ MalleableManager::do_migration(gkfs::rpc::MigrationJob& job) {
            }
            return result.first == 0 ? 0 : -1;
        }
    }

    // Read chunk data from local storage
    std::string chunk_path;
+1 −1
Changes for src/daemon/malleability/rpc/forward_redistribution.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -163,7 +163,7 @@ forward_data_from_source(const std::string& path, void* buf, const size_t count,
                         const uint64_t chnk_id, const uint64_t source_id,
                         const int source_copy, const uint64_t dest_id) {
    if(source_id == dest_id) {
        return {forward_data(path, buf, count, chnk_id, dest_id), count};
        return {EINVAL, 0};
    }

    std::vector<std::pair<void*, std::size_t>> segments{{buf, count}};