Skip to content

Commit

Permalink
use a query instead and delete that commit that uses data object proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
alanking committed Nov 2, 2023
1 parent 9cb0c79 commit 70ba379
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions server/api/src/rsDataObjCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,17 @@ namespace
return;
}

auto [doi, lm] = id::make_data_object_proxy(_comm, fs::path{_inp.objPath});
irods::experimental::query_builder qb;

if (!id::root_resource_has_replica(doi, destination_resource)) {
if (const auto zone = fs::zone_name(_inp.objPath); zone) {
qb.zone_hint(*zone);
}

const auto path = fs::path{_inp.objPath};
const auto qstr =
fmt::format("select DATA_ID where COLL_NAME = '{0}' and DATA_NAME = '{1}' and DATA_RESC_HIER like '{2};%' || = '{2}'",
path.parent_path().c_str(), path.object_name().c_str(), destination_resource);
if (auto q = qb.build(_comm, qstr); q.empty()) {
THROW(HIERARCHY_ERROR,
fmt::format("[{}]: Cannot overwrite [{}] on resource [{}] because resource does not hold a replica.",
__func__,
Expand Down

0 comments on commit 70ba379

Please sign in to comment.