diff --git a/Control/AthenaIPCTools/src/AthenaSharedWriter.cxx b/Control/AthenaIPCTools/src/AthenaSharedWriter.cxx index 74b6027d7e1ef6cfcf6eb94c34a983174f090a44..40c3d48b5e58cbd9faf3b8af4d7c35271283e4c7 100644 --- a/Control/AthenaIPCTools/src/AthenaSharedWriter.cxx +++ b/Control/AthenaIPCTools/src/AthenaSharedWriter.cxx @@ -31,6 +31,7 @@ StatusCode AthenaSharedWriter::initialize() { } // Initialize IAthenaSharedWriterSvc ATH_CHECK(m_sharedWriterSvc.retrieve()); + ATH_CHECK(m_sharedWriterSvc->share(m_numberOfClients.value())); return StatusCode::SUCCESS; } //___________________________________________________________________________ diff --git a/Control/AthenaKernel/AthenaKernel/IAthenaSharedWriterSvc.h b/Control/AthenaKernel/AthenaKernel/IAthenaSharedWriterSvc.h index 43200e7b0c31db6bc2b515522574ff029fb35bcb..e23bff389c06d1ca8fda664b398031e074a3622e 100644 --- a/Control/AthenaKernel/AthenaKernel/IAthenaSharedWriterSvc.h +++ b/Control/AthenaKernel/AthenaKernel/IAthenaSharedWriterSvc.h @@ -11,6 +11,9 @@ static const InterfaceID IID_IAthenaSharedWriterSvc( "IAthenaSharedWriterSvc", 1 class IAthenaSharedWriterSvc : virtual public ::IService { public: + virtual StatusCode share(int numClients = 0) = 0; + + /// Gaudi boilerplate static const InterfaceID& interfaceID() { return IID_IAthenaSharedWriterSvc; } }; diff --git a/Control/AthenaMPTools/src/SharedWriterTool.cxx b/Control/AthenaMPTools/src/SharedWriterTool.cxx index 4b743a02e58751a8ac09085961992a117d027962..5075d75ffd462636b6fe1c535c375a3b300952cf 100644 --- a/Control/AthenaMPTools/src/SharedWriterTool.cxx +++ b/Control/AthenaMPTools/src/SharedWriterTool.cxx @@ -243,6 +243,9 @@ std::unique_ptr<AthenaInterprocess::ScheduledWork> SharedWriterTool::exec_func() if(sc.isFailure() || sharedWriterSvc==0) { ATH_MSG_ERROR("Error retrieving AthenaRootSharedWriterSvc"); all_ok=false; + } else if(!sharedWriterSvc->share(m_nprocs).isSuccess()) { + ATH_MSG_ERROR("Exec function could not share data"); + all_ok=false; } AthCnvSvc* cnvSvc = dynamic_cast<AthCnvSvc*>(m_cnvSvc); if (cnvSvc == 0 || !cnvSvc->disconnectOutput("").isSuccess()) { diff --git a/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp b/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp index 5364d26c5f236beb2d201212bc3ee197511f8148..eea0dc2bdd28ae296547b71c01bf8ca8230e8837 100644 --- a/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp +++ b/Database/APR/RootStorageSvc/src/RootTreeIndexContainer.cpp @@ -12,10 +12,9 @@ // Root include files #include "TTree.h" +#include "TMemFile.h" #include "TBranch.h" -#include <iostream> - using namespace pool; using namespace std; @@ -76,7 +75,7 @@ DbStatus RootTreeIndexContainer::transAct(Transaction::Action action) { DbStatus status = RootTreeContainer::transAct(action); if (action == Transaction::TRANSACT_FLUSH) { if (m_tree == nullptr) return Error; - if (m_index_ref != nullptr && m_tree->GetEntries() > 0 && m_tree->GetEntryNumberWithIndex(nextRecordId()) == -1) { + if (m_index_ref != nullptr && m_tree->GetEntries() > 0 && dynamic_cast<TMemFile*>(m_tree->GetCurrentFile()) == nullptr && m_tree->GetEntryNumberWithIndex(nextRecordId()) == -1) { m_tree->BuildIndex("index_ref"); } } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx index 4de3b302c0857ef1ef9af1bf16dcf35b825a6892..bca157b86f9d3c9ff9cc1fec71e906e56f01e405 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx @@ -564,6 +564,7 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe ATH_MSG_ERROR("connectOutput FAILED extract file name and technology."); return(StatusCode::FAILURE); } + const std::string oldOutputConnection = outputConnection; if (!m_outputStreamingTool.empty() && m_outputStreamingTool[0]->isClient() && m_streamMetaDataOnly) { m_fileCommitCounter[outputConnection] = m_fileCommitCounter[outputConnection] + 1; if (m_fileFlushSetting[outputConnection] > 0 && m_fileCommitCounter[outputConnection] % m_fileFlushSetting[outputConnection] == 0) { @@ -599,7 +600,7 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe ATH_MSG_ERROR("commitOutput - caught exception: " << e.what()); return(StatusCode::FAILURE); } - if (!this->cleanUp(outputConnection).isSuccess()) { + if (!this->cleanUp(oldOutputConnection).isSuccess()) { ATH_MSG_ERROR("commitOutput FAILED to cleanup converters."); return(StatusCode::FAILURE); } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.cxx index 3b25a5de0263bb943f73070f016c455b949e264b..410e4e4742b6c53630734295bc92faba8328304b 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.cxx @@ -69,7 +69,7 @@ StatusCode AthenaRootSharedWriterSvc::initialize() { } else { std::string propertyName = "StreamMetaDataOnly"; bool streamMetaDataOnly(false); - BooleanProperty streamMetaDataOnlyProp(propertyName,streamMetaDataOnly); + BooleanProperty streamMetaDataOnlyProp(propertyName, streamMetaDataOnly); if (propertyServer->getProperty(&streamMetaDataOnlyProp).isFailure()) { ATH_MSG_INFO("Conversion service does not have StreamMetaDataOnly property"); } else if(streamMetaDataOnlyProp.value()) { @@ -87,10 +87,10 @@ StatusCode AthenaRootSharedWriterSvc::initialize() { return StatusCode::SUCCESS; } //___________________________________________________________________________ -StatusCode AthenaRootSharedWriterSvc::start() { +StatusCode AthenaRootSharedWriterSvc::share(int numClients) { ATH_MSG_VERBOSE("Start commitOutput loop"); StatusCode sc = m_cnvSvc->commitOutput("", false); - while (m_rootClientCount > 0 || (m_rootClientIndex == 0 && (sc.isSuccess() || sc.isRecoverable()))) { + while (m_rootClientCount > 0 || (m_rootClientIndex < numClients && (sc.isSuccess() || sc.isRecoverable()))) { if (sc.isSuccess()) { ATH_MSG_VERBOSE("Success in commitOutput loop"); } else if (m_rootMonitor != nullptr) { diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.h index dc9c989df3410cb6edf919f2269bb2d99fc1aaa7..40fbab2425e05faa42b67708038f03ffb4fafd78 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaRootSharedWriterSvc.h @@ -36,11 +36,12 @@ public: // Constructor and Destructor public: /// Gaudi Service Interface method implementations: virtual StatusCode initialize() override; - virtual StatusCode start() override; virtual StatusCode stop() override; virtual StatusCode finalize() override; virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface) override; + virtual StatusCode share(int numClients = 0) override; + private: ServiceHandle<IConversionSvc> m_cnvSvc{this,"AthenaPoolCnvSvc","AthenaPoolCnvSvc"};