diff --git a/Control/SGComps/src/AddressRemappingSvc.cxx b/Control/SGComps/src/AddressRemappingSvc.cxx index 8efdb0af1a2d89c2b1553bcd1ddb8d805176d175..adbd41f0bc880236be07e0d7637cecf4ad37ca26 100644 --- a/Control/SGComps/src/AddressRemappingSvc.cxx +++ b/Control/SGComps/src/AddressRemappingSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @file AddressRemappingSvc.cxx @@ -32,6 +32,7 @@ #include "boost/range.hpp" + //________________________________________________________________________________ AddressRemappingSvc::AddressRemappingSvc(const std::string& name, ISvcLocator* pSvcLocator) : extends1<AthService, Athena::IInputRename>(name, pSvcLocator), @@ -413,7 +414,17 @@ StatusCode AddressRemappingSvc::renameTads (IAddressProvider::tadList& tads) } else if (isDeleted (*tad)) { - pos = tads.erase (pos); + // Rename the existing TAD to end in _DELETED. + // Drop alias/symlinks in the process. + auto tad_new = std::make_unique<SG::TransientAddress> + (tad->clID(), tad->name() + "_DELETED", + tad->address(), tad->clearAddress()); + tad_new->setProvider (tad->provider(), tad->storeID()); + // Replace the old TAD in the list with the new one. + delete tad; + tad = tad_new.release(); + + ++pos; } else { diff --git a/Control/SGComps/test/AddressRemappingSvc_test.cxx b/Control/SGComps/test/AddressRemappingSvc_test.cxx index 3cf6cfd00cda3565d026ebe08811c64beb79966a..2e91a4e60e206293ac589da43fc5294823349048 100644 --- a/Control/SGComps/test/AddressRemappingSvc_test.cxx +++ b/Control/SGComps/test/AddressRemappingSvc_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // $Id$ @@ -195,12 +195,15 @@ void fillTADList (IAddressProvider::tadList& tads, // Foo/bar1 // Foo/bar2 + symlink 321 + aliases bar2.d1, bar2.d2, bar2.x2 // Foo/foo3 + aliases foo3.x1, foo3.d2 +// Foo/fee1_DELETED +// Foo/fee1Aux._DELETED void checkTADList (const IAddressProvider::tadList& tads, const Addrs& addrs) { CLID fooclid = ClassID_traits<xAODFoo>::ID(); + CLID auxclid = ClassID_traits<SG::IConstAuxStore>::ID(); - assert (tads.size() == 3); + assert (tads.size() == 5); size_t i = 0; for (const SG::TransientAddress* tad : tads) { if (i == 0) { @@ -235,6 +238,24 @@ void checkTADList (const IAddressProvider::tadList& tads, (SG::TransientAddress::TransientAliasSet { "foo3.x1", "foo3.d2" })); } + else if (i == 3) { + assert (tad->clID() == fooclid); + assert (tad->name() == "fee1_DELETED"); + assert (tad->address() == &addrs.addr4); + assert (tad->clearAddress() == false); + assert (tad->transientID() == + SG::TransientAddress::TransientClidSet { fooclid }); + assert (tad->alias().empty()); + } + else if (i == 4) { + assert (tad->clID() == auxclid); + assert (tad->name() == "fee1Aux._DELETED"); + assert (tad->address() == &addrs.addr5); + assert (tad->clearAddress() == false); + assert (tad->transientID() == + SG::TransientAddress::TransientClidSet { auxclid }); + assert (tad->alias().empty()); + } ++i; } }