![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
This class provides the interface to the LCG POOL persistency software.
More...
#include <PoolSvc.h>
|
virtual StatusCode | initialize () override |
| Required of all Gaudi services: More...
|
|
virtual StatusCode | io_reinit () override |
|
virtual StatusCode | start () override |
| Required of all Gaudi services: More...
|
|
virtual StatusCode | stop () override |
|
virtual StatusCode | finalize () override |
| Required of all Gaudi services: More...
|
|
virtual StatusCode | io_finalize () override |
|
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) override |
| Required of all Gaudi services: see Gaudi documentation for details. More...
|
|
virtual Token * | registerForWrite (const Placement *placement, const void *obj, const RootType &classDesc) override |
|
virtual void | setObjPtr (void *&obj, const Token *token) override |
|
virtual unsigned int | getOutputContext (const std::string &label) override |
|
virtual unsigned int | getInputContext (const std::string &label, unsigned int maxFile=0) override |
|
virtual const std::map< std::string, unsigned int > & | getInputContextMap () const override |
|
virtual const coral::Context * | context () const override |
|
virtual void | loadComponent (const std::string &compName) override |
|
virtual void | setShareMode (bool shareCat) override |
|
virtual const pool::IFileCatalog * | catalog () const override |
|
virtual void | lookupBestPfn (const std::string &token, std::string &pfn, std::string &type) const override |
|
virtual void | renamePfn (const std::string &pf, const std::string &newpf) override |
|
virtual pool::ICollection * | createCollection (const std::string &collectionType, const std::string &connection, const std::string &collectionName, unsigned int contextId=IPoolSvc::kInputStream) const override |
|
virtual Token * | getToken (const std::string &connection, const std::string &collection, const unsigned long ientry) const override |
|
virtual StatusCode | connect (pool::ITransaction::Type type, unsigned int contextId=IPoolSvc::kInputStream) override |
| Connect to a logical database unit; PersistencySvc is chosen according to transaction type (accessmode). More...
|
|
virtual StatusCode | commit (unsigned int contextId=IPoolSvc::kInputStream) const override |
| Commit data for a given contextId and flush buffer. More...
|
|
virtual StatusCode | commitAndHold (unsigned int contextId=IPoolSvc::kInputStream) const override |
| Commit data for a given contextId and hold buffer. More...
|
|
virtual StatusCode | disconnect (unsigned int contextId=IPoolSvc::kInputStream) const override |
| Disconnect PersistencySvc associated with a contextId. More...
|
|
virtual StatusCode | disconnectDb (const std::string &connection, unsigned int contextId=IPoolSvc::kInputStream) const override |
| Disconnect single Database. More...
|
|
virtual long long int | getFileSize (const std::string &dbName, long tech, unsigned int contextId) const override |
| Get POOL FileSize attribute for database without logging a message. More...
|
|
virtual StatusCode | getAttribute (const std::string &optName, std::string &data, long tech, unsigned int contextId=IPoolSvc::kInputStream) const override |
| Get POOL attributes - domain. More...
|
|
virtual StatusCode | getAttribute (const std::string &optName, std::string &data, long tech, const std::string &dbName, const std::string &contName="", unsigned int contextId=IPoolSvc::kInputStream) const override |
| Get POOL attributes - db/file, container/collection. More...
|
|
virtual StatusCode | setAttribute (const std::string &optName, const std::string &data, long tech, unsigned int contextId=IPoolSvc::kOutputStream) const override |
| Set POOL attributes - domain. More...
|
|
virtual StatusCode | setAttribute (const std::string &optName, const std::string &data, long tech, const std::string &dbName, const std::string &contName="", unsigned int contextId=IPoolSvc::kOutputStream) const override |
| Set POOL attributes - db/file, container/collection. More...
|
|
virtual StatusCode | setFrontierCache (const std::string &conn) override |
| Setup Frontier cache for given logical or physical connection name. More...
|
|
virtual | ~PoolSvc () |
| Destructor. More...
|
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
CallMutex | m_pool_mut |
|
coral::Context * | m_context {nullptr} |
|
bool | m_shareCat {false} |
|
pool::IFileCatalog * | m_catalog {nullptr} |
|
std::vector< pool::IPersistencySvc * > | m_persistencySvcVec |
|
std::vector< CallMutex * > | m_pers_mut |
|
std::map< std::string, unsigned int > | m_inputContextLabel |
|
std::map< std::string, unsigned int > | m_outputContextLabel |
|
std::string | m_mainOutputLabel {} |
|
std::map< unsigned int, unsigned int > | m_contextMaxFile |
|
std::map< unsigned int, std::list< Guid > > m_guidLists | ATLAS_THREAD_SAFE |
|
StringProperty | m_fileOpen {this,"FileOpen","overwrite"} |
| FileOpen, the open mode for the file ("append" or "overwrite"). More...
|
|
IntegerProperty | m_dbAgeLimit {this,"MaxFilesOpen",0} |
| MaxFilesOpen, option to have PoolSvc limit the number of open Input Files: default = 0 (No files are closed automatically) More...
|
|
StringProperty | m_writeCatalog {this,"WriteCatalog","xmlcatalog_file:PoolFileCatalog.xml"} |
| WriteCatalog, the file catalog to be used to register output files (also default input catalog): default = "" (use POOL default). More...
|
|
StringArrayProperty | m_readCatalog {this,"ReadCatalog",{},"List of catalog files to read from","OrderedSet<std::string>"} |
| ReadCatalog, the list of additional POOL input file catalogs to consult: default = empty vector. More...
|
|
BooleanProperty | m_useROOTIMT {this,"UseROOTImplicitMT",true} |
| Use ROOT Implicit MultiThreading, default = true. More...
|
|
BooleanProperty | m_useROOTMaxTree {this,"UseROOTIncreaseVMaxTree",false} |
| Increase virtual TTree size to avoid backreads in multithreading, default = false. More...
|
|
BooleanProperty | m_attemptCatalogPatch {this,"AttemptCatalogPatch",true} |
| AttemptCatalogPatch, option to create catalog: default = false. More...
|
|
IntegerProperty | m_retrialPeriod {this,"ConnectionRetrialPeriod",300} |
| ConnectionRetrialPeriod, retry period for CORAL Connection Service: default = 30 seconds. More...
|
|
IntegerProperty | m_retrialTimeOut {this,"ConnectionRetrialTimeOut",3600} |
| ConnectionRetrialTimeOut, the retrial time out for CORAL Connection Service: default = 300 seconds. More...
|
|
IntegerProperty | m_timeOut {this,"ConnectionTimeOut",5} |
| ConnectionTimeOut, the time out for CORAL Connection Service: default = 5 seconds. More...
|
|
BooleanProperty | m_connClean {this,"ConnectionCleanUp",false} |
| ConnectionCleanUp - whether to use CORAL connection management thread: default = false. More...
|
|
IntegerProperty | m_frontierComp {this,"FrontierCompression",5} |
| Frontier proprties, compression level and list of schemas to be refreshed: default = 5. More...
|
|
StringArrayProperty | m_frontierRefresh {this,"FrontierRefreshSchema",{}} |
|
BooleanProperty | m_sortReplicas {this,"SortReplicas",true} |
| Use DBReplicaSvc to sort database connections, default = true. More...
|
|
This class provides the interface to the LCG POOL persistency software.
Definition at line 36 of file PoolSvc.h.
◆ CallMutex
◆ PoolStream
Stream to distinguish the POOL Stream instances.
Enumerator |
---|
kInputStream | |
kOutputStream | |
Definition at line 40 of file IPoolSvc.h.
◆ ~PoolSvc()
◆ catalog()
◆ clearState()
void PoolSvc::clearState |
( |
| ) |
|
|
private |
Definition at line 242 of file PoolSvc.cxx.
245 delete persistencySvc;
248 for (
const auto& persistencyMutex :
m_pers_mut) {
249 delete persistencyMutex;
◆ commit()
Commit data for a given contextId and flush buffer.
- Parameters
-
contextId | [IN] poolStream to be commited. |
Implements IPoolSvc.
Definition at line 631 of file PoolSvc.cxx.
633 return(StatusCode::FAILURE);
635 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
640 return(StatusCode::FAILURE);
646 return(StatusCode::SUCCESS);
◆ commitAndHold()
Commit data for a given contextId and hold buffer.
- Parameters
-
contextId | [IN] poolStream to be commited. |
Implements IPoolSvc.
Definition at line 649 of file PoolSvc.cxx.
651 return(StatusCode::FAILURE);
653 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
658 return(StatusCode::FAILURE);
661 return(StatusCode::SUCCESS);
◆ connect()
Connect to a logical database unit; PersistencySvc is chosen according to transaction type (accessmode).
Implements IPoolSvc.
Definition at line 599 of file PoolSvc.cxx.
602 ATH_MSG_WARNING(
"connect: Using default output Stream instead of id = " << contextId);
607 ATH_MSG_WARNING(
"connect: Using default input Stream instead of id = " << contextId);
610 ATH_MSG_INFO(
"Connecting to InputStream for: " << contextId);
615 return(StatusCode::FAILURE);
617 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
621 return(StatusCode::SUCCESS);
625 return(StatusCode::FAILURE);
628 return(StatusCode::SUCCESS);
◆ context()
const coral::Context * PoolSvc::context |
( |
| ) |
const |
|
overridevirtual |
◆ createCatalog()
Definition at line 953 of file PoolSvc.cxx.
958 if (
catalog.compare(0, 8,
"apcfile:") == 0 ||
catalog.compare(0, 7,
"prfile:") == 0) {
959 std::string::size_type cpos =
catalog.find(
':');
974 <<
" in $ATLAS_POOLCOND_PATH and $DATAPATH");
986 ATH_MSG_ERROR(
"setWriteCatalog - caught exception: " <<
e.what());
◆ createCollection()
- Returns
- a pointer to a Pool Collection.
- Parameters
-
collectionType | [IN] string containing the collection type. |
connection | [IN] string containing the connection. |
collectionName | [IN] string containing the persistent name of the collection. |
contextId | [IN] id for PoolSvc persistency service to use for input. |
Implements IPoolSvc.
Definition at line 446 of file PoolSvc.cxx.
450 ATH_MSG_DEBUG(
"createCollection() type="<< collectionType <<
", connection=" << connection
451 <<
", name=" << collectionName <<
", contextID=" << contextId);
452 std::string collection(collectionName);
453 if (collectionType ==
"RootCollection") {
454 if (collectionName.find(
"PFN:") == std::string::npos
455 && collectionName.find(
"LFN:") == std::string::npos
456 && collectionName.find(
"FID:") == std::string::npos) {
457 collection =
"PFN:" + collectionName;
461 ATH_MSG_WARNING(
"createCollection: Using default input Stream instead of id = " << contextId);
464 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
466 bool insertFile =
false;
467 if (connection.compare(0, 4,
"PFN:") == 0) {
468 std::string fid, fileType;
472 ATH_MSG_INFO(
"File is not in Catalog! Attempt to open it anyway.");
476 if (collectionType ==
"ImplicitCollection") {
477 std::unique_ptr<pool::IDatabase> dbH =
getDbHandle(contextId, connection);
478 if (dbH ==
nullptr) {
479 ATH_MSG_INFO(
"Failed to get Session/DatabaseHandle to create POOL collection.");
486 std::map<unsigned int, unsigned int>::const_iterator maxFileIter =
m_contextMaxFile.find(contextId);
487 if (maxFileIter !=
m_contextMaxFile.end() && maxFileIter->second > 0 && !dbH->
fid().empty()) {
489 m_guidLists[contextId].remove(
guid);
490 m_guidLists[contextId].push_back(
guid);
491 while (m_guidLists[contextId].
size() > maxFileIter->second + 1) {
496 if (contH ==
nullptr) {
497 ATH_MSG_INFO(
"Failed to find container " << collection <<
" to create POOL collection.");
504 ATH_MSG_INFO(
"Failed to open container to check POOL collection - trying.");
513 if (collectionType ==
"RootCollection" &&
515 ATH_MSG_INFO(
"Writing ExplicitROOT Collection - do not pass session pointer");
521 std::string tree_error, rntuple_error;
525 tree_error =
e.what();
528 collDes.setType(
"RNTCollection");
532 std::unique_ptr<pool::IDatabase> dbH =
getDbHandle(contextId, connection);
533 if (dbH !=
nullptr) {
534 if (!dbH->
fid().empty()) {
539 rntuple_error =
e.what();
541 if( !collPtr )
throw pool::Exception(
"Failed to open APR Collection as RootCollection or RNTCollection: "
542 + tree_error +
" | " + rntuple_error,
543 "PoolSvc::createCollection",
"PoolSvc" );
546 std::unique_ptr<pool::IDatabase> dbH =
getDbHandle(contextId, connection);
547 if (dbH ==
nullptr) {
549 }
else if (dbH->
fid().empty()) {
550 ATH_MSG_INFO(
"Cannot retrieve the FID of an existing POOL database: '"
551 << connection <<
"' - FileCatalog will NOT be updated.");
558 if (
m_useROOTMaxTree && Gaudi::Concurrency::ConcurrencyFlags::numConcurrentEvents() > 1) {
◆ disconnect()
Disconnect PersistencySvc associated with a contextId.
- Parameters
-
contextId | [IN] poolStream to be disconnected. |
Implements IPoolSvc.
Definition at line 664 of file PoolSvc.cxx.
665 ATH_MSG_DEBUG(
"Disconnect request for contextId=" << contextId);
667 return(StatusCode::SUCCESS);
669 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
672 if (!
commit(contextId).isSuccess()) {
674 return(StatusCode::FAILURE);
679 ATH_MSG_ERROR(
"disconnect failed to diconnect PersistencySvc");
680 return(StatusCode::FAILURE);
683 return(StatusCode::SUCCESS);
◆ disconnectDb()
Disconnect single Database.
- Parameters
-
connection | [IN] connection string for Database to be disconnected. |
contextId | [IN] context id of database to be disconnected. |
Implements IPoolSvc.
Definition at line 686 of file PoolSvc.cxx.
688 return(StatusCode::SUCCESS);
690 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
691 std::unique_ptr<pool::IDatabase> dbH =
getDbHandle(contextId, connection);
692 if (dbH ==
nullptr) {
694 return(StatusCode::FAILURE);
696 std::map<unsigned int, unsigned int>::const_iterator maxFileIter =
m_contextMaxFile.find(contextId);
698 m_guidLists[contextId].remove(
Guid(dbH->
fid()));
701 return(StatusCode::SUCCESS);
◆ finalize()
StatusCode PoolSvc::finalize |
( |
| ) |
|
|
overridevirtual |
◆ getAttribute() [1/2]
StatusCode PoolSvc::getAttribute |
( |
const std::string & |
optName, |
|
|
std::string & |
data, |
|
|
long |
tech, |
|
|
const std::string & |
dbName, |
|
|
const std::string & |
contName = "" , |
|
|
unsigned int |
contextId = IPoolSvc::kInputStream |
|
) |
| const |
|
overridevirtual |
Get POOL attributes - db/file, container/collection.
Implements IPoolSvc.
Definition at line 745 of file PoolSvc.cxx.
751 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
753 if (dbH ==
nullptr) {
754 ATH_MSG_DEBUG(
"getAttribute: Failed to get Session/DatabaseHandle to get POOL property.");
755 return(StatusCode::FAILURE);
765 std::ostringstream oss;
766 if (contName.empty()) {
767 if (
data ==
"DbLonglong") {
769 }
else if (
data ==
"double") {
771 }
else if (
data ==
"string") {
776 ATH_MSG_INFO(
"Database (" << dbH->
pfn() <<
") attribute [" << optName <<
"]" <<
": " << oss.str());
779 if (contH ==
nullptr) {
780 ATH_MSG_DEBUG(
"Failed to get ContainerHandle to get POOL property.");
781 return(StatusCode::FAILURE);
783 if (
data ==
"DbLonglong") {
785 }
else if (
data ==
"double") {
790 ATH_MSG_INFO(
"Container attribute [" << contName <<
"." << optName <<
"]: " << oss.str());
793 return(StatusCode::SUCCESS);
◆ getAttribute() [2/2]
StatusCode PoolSvc::getAttribute |
( |
const std::string & |
optName, |
|
|
std::string & |
data, |
|
|
long |
tech, |
|
|
unsigned int |
contextId = IPoolSvc::kInputStream |
|
) |
| const |
|
overridevirtual |
Get POOL attributes - domain.
Implements IPoolSvc.
Definition at line 722 of file PoolSvc.cxx.
727 ATH_MSG_WARNING(
"getAttribute: Using default input Stream instead of id = " << contextId);
730 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
732 std::ostringstream oss;
733 if (
data ==
"DbLonglong") {
735 }
else if (
data ==
"double") {
742 return(StatusCode::SUCCESS);
◆ getContainerHandle()
Get Container handle.
Definition at line 1026 of file PoolSvc.cxx.
1028 if (dbH ==
nullptr) {
1035 if (contName.find(
"DataHeader") != std::string::npos) {
1036 contH = dbH->
containerHandle(contName.substr(0, contName.find(
"_p")));
1040 return(std::unique_ptr<pool::IContainer>(contH));
◆ getDbHandle()
std::unique_ptr< pool::IDatabase > PoolSvc::getDbHandle |
( |
unsigned int |
contextId, |
|
|
const std::string & |
dbName |
|
) |
| const |
|
private |
Get Database handle.
Definition at line 996 of file PoolSvc.cxx.
999 ATH_MSG_WARNING(
"getDbHandle: Using default input Stream instead of id = " << contextId);
1014 if (
dbName.compare(0, 4,
"PFN:") == 0) {
1016 }
else if (
dbName.compare(0, 4,
"LFN:") == 0) {
1018 }
else if (
dbName.compare(0, 4,
"FID:") == 0) {
1023 return(std::unique_ptr<pool::IDatabase>(dbH));
◆ getFileSize()
long long int PoolSvc::getFileSize |
( |
const std::string & |
dbName, |
|
|
long |
tech, |
|
|
unsigned int |
contextId |
|
) |
| const |
|
overridevirtual |
Get POOL FileSize attribute for database without logging a message.
Implements IPoolSvc.
Definition at line 704 of file PoolSvc.cxx.
705 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
707 if (dbH ==
nullptr) {
708 ATH_MSG_DEBUG(
"getFileSize: Failed to get Session/DatabaseHandle to get POOL FileSize property.");
◆ getInputContext()
unsigned int PoolSvc::getInputContext |
( |
const std::string & |
label, |
|
|
unsigned int |
maxFile = 0 |
|
) |
| |
|
overridevirtual |
- Returns
- an Id for an input context (POOL persistency service) and create it if needed.
- Parameters
-
label | [IN] string label to name new context and allow sharing (returns existing contextId) |
maxFile | [IN] maximum number of open input files. |
Implements IPoolSvc.
Definition at line 368 of file PoolSvc.cxx.
370 if (!
label.empty()) {
376 return(contextIter->second);
386 if (!
label.empty()) {
◆ getInputContextMap()
const std::map< std::string, unsigned int > & PoolSvc::getInputContextMap |
( |
| ) |
const |
|
overridevirtual |
◆ getOutputContext()
unsigned int PoolSvc::getOutputContext |
( |
const std::string & |
label | ) |
|
|
overridevirtual |
- Returns
- an Id for an output context (POOL persistency service) and create it if needed.
- Parameters
-
label | [IN] string label to name new context and allow sharing (returns existing contextId) |
Implements IPoolSvc.
Definition at line 341 of file PoolSvc.cxx.
352 return(contextIter->second);
◆ getToken()
Token * PoolSvc::getToken |
( |
const std::string & |
connection, |
|
|
const std::string & |
collection, |
|
|
const unsigned long |
ientry |
|
) |
| const |
|
overridevirtual |
- Returns
- a token for a container entry.
- Parameters
-
connection | [IN] string containing the connection/file name. |
collection | [IN] string containing the persistent name of the collection. |
ientry | [IN] entry number for the token to be returned |
Implements IPoolSvc.
Definition at line 575 of file PoolSvc.cxx.
580 if (dbH ==
nullptr) {
587 if (contH ==
nullptr) {
592 for (
unsigned long ipos = 0; ipos < ientry; ipos++) {
593 delete thisToken; thisToken = tokenIter->
next();
595 delete tokenIter; tokenIter =
nullptr;
◆ initialize()
StatusCode PoolSvc::initialize |
( |
| ) |
|
|
overridevirtual |
Required of all Gaudi services:
Definition at line 57 of file PoolSvc.cxx.
60 return(StatusCode::FAILURE);
65 if (!iomgr.retrieve().isSuccess()) {
67 return(StatusCode::FAILURE);
69 if (!iomgr->io_register(
this).isSuccess()) {
70 ATH_MSG_FATAL(
"Could not register myself with the IoComponentMgr !");
71 return(StatusCode::FAILURE);
76 if (
catalog.compare(0, 16,
"xmlcatalog_file:") == 0) {
86 if (
m_writeCatalog.value().compare(0, 16,
"xmlcatalog_file:") == 0) {
96 return(StatusCode::FAILURE);
101 return(StatusCode::FAILURE);
103 coral::ConnectionService conSvcH;
104 coral::IConnectionServiceConfiguration& csConfig = conSvcH.configuration();
108 csConfig.enablePoolAutomaticCleanUp();
109 csConfig.setConnectionTimeOut(
m_timeOut);
111 csConfig.disablePoolAutomaticCleanUp();
112 csConfig.setConnectionTimeOut(0);
114 ATH_MSG_INFO(
"Set connectionsvc retry/timeout/IDLE timeout to "
120 <<
" seconds with connection cleanup "
121 << (csConfig.isPoolAutomaticCleanUpEnabled() ?
"enabled" :
"disabled"));
123 coral::IWebCacheControl& webCache = conSvcH.webCacheControl();
125 ATH_MSG_INFO(
"Frontier compression level set to " << webCache.compressionLevel());
129 if (Gaudi::svcLocator()->service(
"DBReplicaSvc", replicasvc).isSuccess()) {
130 csConfig.setReplicaSortingAlgorithm(*replicasvc);
131 ATH_MSG_INFO(
"Successfully setup replica sorting algorithm");
◆ interfaceID()
static const InterfaceID& IPoolSvc::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
Retrieve interface ID.
Definition at line 44 of file IPoolSvc.h.
44 {
return(IID_IPoolSvc); }
◆ io_finalize()
StatusCode PoolSvc::io_finalize |
( |
| ) |
|
|
overridevirtual |
Definition at line 266 of file PoolSvc.cxx.
275 return(StatusCode::SUCCESS);
◆ io_reinit()
StatusCode PoolSvc::io_reinit |
( |
| ) |
|
|
overridevirtual |
Definition at line 143 of file PoolSvc.cxx.
146 if (!iomgr.retrieve().isSuccess()) {
148 return(StatusCode::FAILURE);
150 if (!iomgr->io_hasitem(
this)) {
151 ATH_MSG_FATAL(
"IoComponentMgr does not know about myself !");
152 return(StatusCode::FAILURE);
155 for (std::size_t icat = 0,
imax = readcat.size(); icat <
imax; icat++) {
156 if (readcat[icat].
compare(0, 16,
"xmlcatalog_file:") == 0) {
157 std::string
fileName = readcat[icat].substr(16);
158 if (iomgr->io_contains(
this,
fileName)) {
159 if (!iomgr->io_retrieve(
this,
fileName).isSuccess()) {
161 return(StatusCode::FAILURE);
163 readcat[icat] =
"xmlcatalog_file:" +
fileName;
169 if (
m_writeCatalog.value().compare(0, 16,
"xmlcatalog_file:") == 0) {
171 if (iomgr->io_contains(
this,
fileName)) {
172 if (!iomgr->io_retrieve(
this,
fileName).isSuccess()) {
174 return(StatusCode::FAILURE);
◆ loadComponent()
void PoolSvc::loadComponent |
( |
const std::string & |
compName | ) |
|
|
overridevirtual |
- Returns
- void
- Parameters
-
compName | [IN] string name of the component to be loaded. |
Implements IPoolSvc.
Definition at line 401 of file PoolSvc.cxx.
◆ lookupBestPfn()
void PoolSvc::lookupBestPfn |
( |
const std::string & |
token, |
|
|
std::string & |
pfn, |
|
|
std::string & |
type |
|
) |
| const |
|
overridevirtual |
- Returns
- void
- Parameters
-
token | [IN] filename/token string to be translated |
pfn | [OUT] string PFN of database |
type | [OUT] string filetype of database |
Implements IPoolSvc.
Definition at line 413 of file PoolSvc.cxx.
415 if (token.compare(0, 4,
"PFN:") == 0) {
417 }
else if (token.compare(0, 4,
"LFN:") == 0) {
419 }
else if (token.compare(0, 4,
"FID:") == 0) {
420 dbID = token.substr(4);
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ patchCatalog()
◆ poolCondPath()
std::string PoolSvc::poolCondPath |
( |
const std::string & |
leaf | ) |
|
|
private |
Resolve a file using ATLAS_POOLCOND_PATH.
Definition at line 1043 of file PoolSvc.cxx.
1046 const char* cpath =
std::getenv(
"ATLAS_POOLCOND_PATH");
1047 if (cpath && strcmp(cpath,
"") != 0) {
1048 const std::string testpath = std::string(cpath) +
"/" + leaf;
1052 if (FILE*
fp = std::fopen(testpath.c_str(),
"r")) {
◆ queryInterface()
StatusCode PoolSvc::queryInterface |
( |
const InterfaceID & |
riid, |
|
|
void ** |
ppvInterface |
|
) |
| |
|
overridevirtual |
Required of all Gaudi services: see Gaudi documentation for details.
Definition at line 278 of file PoolSvc.cxx.
280 *ppvInterface =
dynamic_cast<IPoolSvc*
>(
this);
283 return(::AthService::queryInterface(riid, ppvInterface));
286 return(StatusCode::SUCCESS);
◆ registerForWrite()
- Returns
- a token to a Data Object written to Pool.
- Parameters
-
placement | [IN] pointer to the placement hint. |
obj | [IN] pointer to the Data Object to be written to Pool. |
classDesc | [IN] pointer to the Seal class description for the Data Object. |
Implements IPoolSvc.
Definition at line 289 of file PoolSvc.cxx.
293 const std::string& auxString = placement->
auxString();
294 if (!auxString.empty()) {
295 if (auxString.compare(0, 6,
"[CTXT=") == 0) {
296 ::sscanf(auxString.c_str(),
"[CTXT=%08X]", &contextId);
297 }
else if (auxString.compare(0, 8,
"[CLABEL=") == 0) {
301 ATH_MSG_WARNING(
"registerForWrite: Using default output Stream instead of id = " << contextId);
305 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
307 if (token ==
nullptr) {
◆ renamePfn()
void PoolSvc::renamePfn |
( |
const std::string & |
pf, |
|
|
const std::string & |
newpf |
|
) |
| |
|
overridevirtual |
- Returns
- void
- Parameters
-
pf | [IN] filename to be renamed |
newpf | [IN] new filename |
Implements IPoolSvc.
Definition at line 431 of file PoolSvc.cxx.
432 std::string dbID,
type;
◆ setAttribute() [1/2]
StatusCode PoolSvc::setAttribute |
( |
const std::string & |
optName, |
|
|
const std::string & |
data, |
|
|
long |
tech, |
|
|
const std::string & |
dbName, |
|
|
const std::string & |
contName = "" , |
|
|
unsigned int |
contextId = IPoolSvc::kOutputStream |
|
) |
| const |
|
overridevirtual |
Set POOL attributes - db/file, container/collection.
Implements IPoolSvc.
Definition at line 820 of file PoolSvc.cxx.
827 ATH_MSG_WARNING(
"setAttribute: Using default output Stream instead of id = " << contextId);
830 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
832 if (dbH ==
nullptr) {
833 ATH_MSG_DEBUG(
"Failed to get Session/DatabaseHandle to set POOL property.");
834 return(StatusCode::FAILURE);
844 bool retError =
false;
846 bool hasTTreeName = (contName.length() > 6 && contName.compare(0, 6,
"TTree=") == 0);
848 objName = hasTTreeName ? contName.substr(6) : contName;
851 }
else if(
data[
data.size() - 1] ==
'L' ) {
858 return(StatusCode::FAILURE);
862 if (contH ==
nullptr) {
863 ATH_MSG_DEBUG(
"Failed to get ContainerHandle to set POOL property.");
864 return(StatusCode::FAILURE);
866 if (
auto p = contName.find(
'(');
p != std::string::npos) {
867 objName = contName.substr(
p + 1);
868 objName.erase(objName.find(
')'));
869 }
else if (
auto p = contName.find(
"::");
p != std::string::npos) {
870 objName = contName.substr(
p + 2);
871 }
else if (
auto p = contName.find(
'_');
p != std::string::npos) {
872 objName = contName.substr(
p + 1);
873 objName.erase(objName.find(
'/'));
875 std::string::size_type off = 0;
876 while ((off = objName.find_first_of(
"<>/")) != std::string::npos) {
885 ATH_MSG_DEBUG(
"Failed to set POOL container property, " << optName <<
" for " << contName <<
" : " << objName <<
" to " <<
data);
886 return(StatusCode::FAILURE);
889 return(StatusCode::SUCCESS);
◆ setAttribute() [2/2]
Set POOL attributes - domain.
Implements IPoolSvc.
Definition at line 796 of file PoolSvc.cxx.
801 ATH_MSG_WARNING(
"setAttribute: Using default output Stream instead of id = " << contextId);
804 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
809 return(StatusCode::FAILURE);
814 return(StatusCode::FAILURE);
817 return(StatusCode::SUCCESS);
◆ setFrontierCache()
StatusCode PoolSvc::setFrontierCache |
( |
const std::string & |
conn | ) |
|
|
overridevirtual |
Setup Frontier cache for given logical or physical connection name.
Implements IPoolSvc.
Definition at line 892 of file PoolSvc.cxx.
897 std::vector<std::string> physcons;
898 if (
conn.find(
':') == std::string::npos) {
901 const std::string lookSvcStr(
"CORAL/Services/XMLLookupService");
902 coral::IHandle<coral::ILookupService> lookSvcH =
m_context->query<coral::ILookupService>();
903 if (!lookSvcH.isValid()) {
905 lookSvcH =
m_context->query<coral::ILookupService>();
907 if (!lookSvcH.isValid()) {
909 return(StatusCode::FAILURE);
911 coral::IDatabaseServiceSet* dbset = lookSvcH->lookup(
conn, coral::ReadOnly);
912 if (dbset !=
nullptr) {
913 for (
int irep = 0, nrep = dbset->numberOfReplicas(); irep < nrep; ++irep) {
914 const std::string pcon = dbset->replica(irep).connectionString();
915 if (pcon.compare(0, 9,
"frontier:") == 0) {
916 physcons.push_back(pcon);
919 delete dbset; dbset =
nullptr;
923 }
else if (
conn.compare(0, 9,
"frontier:") == 0) {
924 physcons.push_back(
conn);
927 if (physcons.size() == 0) {
928 return(StatusCode::SUCCESS);
930 coral::ConnectionService conSvcH;
934 coral::IWebCacheControl& webCache = conSvcH.webCacheControl();
935 for (std::vector<std::string>::const_iterator iter = physcons.begin(), last = physcons.end();
936 iter != last; ++iter) {
943 webCache.refreshTable(*iter,
"DUMMYTABLE");
946 webCache.refreshSchemaInfo(*iter);
948 ATH_MSG_DEBUG(
"Cache flag for connection " << *iter <<
" set to " << webCache.webCacheInfo(*iter).isSchemaInfoCached());
950 return(StatusCode::SUCCESS);
◆ setObjPtr()
void PoolSvc::setObjPtr |
( |
void *& |
obj, |
|
|
const Token * |
token |
|
) |
| |
|
overridevirtual |
- Returns
- void
- Parameters
-
obj | [OUT] pointer to the Data Object. |
token | [IN] token of the Data Object for which a Pool Ref is filled. |
Implements IPoolSvc.
Definition at line 313 of file PoolSvc.cxx.
315 const std::string& auxString = token->
auxString();
316 if (!auxString.empty()) {
317 if (auxString.compare(0, 6,
"[CTXT=") == 0) {
318 ::sscanf(auxString.c_str(),
"[CTXT=%08X]", &contextId);
319 }
else if (auxString.compare(0, 8,
"[CLABEL=") == 0) {
323 ATH_MSG_WARNING(
"setObjPtr: Using default input Stream instead of id = " << contextId);
327 ATH_MSG_VERBOSE(
"setObjPtr: token=" << token->
toString() <<
", auxString=" << auxString <<
", contextID=" << contextId);
329 std::lock_guard<CallMutex> lock(*
m_pers_mut[contextId]);
331 std::map<unsigned int, unsigned int>::const_iterator maxFileIter =
m_contextMaxFile.find(contextId);
333 m_guidLists[contextId].remove(token->
dbID());
334 m_guidLists[contextId].push_back(token->
dbID());
335 while (m_guidLists[contextId].
size() > maxFileIter->second) {
◆ setShareMode()
void PoolSvc::setShareMode |
( |
bool |
shareCat | ) |
|
|
overridevirtual |
- Returns
- void
- Parameters
-
shareCat | [IN] bool to share the file catalog. |
Implements IPoolSvc.
Definition at line 405 of file PoolSvc.cxx.
◆ setupPersistencySvc()
StatusCode PoolSvc::setupPersistencySvc |
( |
| ) |
|
|
private |
Definition at line 184 of file PoolSvc.cxx.
192 return(StatusCode::FAILURE);
198 ATH_MSG_FATAL(
"Failed to enable thread safety in ROOT via PersistencySvc.");
199 return(StatusCode::FAILURE);
204 return(StatusCode::FAILURE);
215 return(StatusCode::SUCCESS);
◆ start()
StatusCode PoolSvc::start |
( |
| ) |
|
|
overridevirtual |
Required of all Gaudi services:
Definition at line 218 of file PoolSvc.cxx.
222 ATH_MSG_FATAL(
"Failed to enable implicit multithreading in ROOT via PersistencySvc.");
223 return(StatusCode::FAILURE);
227 return(StatusCode::SUCCESS);
◆ stop()
StatusCode PoolSvc::stop |
( |
| ) |
|
|
overridevirtual |
Definition at line 230 of file PoolSvc.cxx.
231 bool retError =
false;
238 return(retError ? StatusCode::FAILURE : StatusCode::SUCCESS);
◆ SvcFactory< PoolSvc >
◆ ATLAS_THREAD_SAFE
std::map<unsigned int, std::list<Guid> > m_guidLists PoolSvc::ATLAS_THREAD_SAFE |
|
mutableprivate |
◆ m_attemptCatalogPatch
BooleanProperty PoolSvc::m_attemptCatalogPatch {this,"AttemptCatalogPatch",true} |
|
private |
AttemptCatalogPatch, option to create catalog: default = false.
Definition at line 240 of file PoolSvc.h.
◆ m_catalog
◆ m_connClean
BooleanProperty PoolSvc::m_connClean {this,"ConnectionCleanUp",false} |
|
private |
ConnectionCleanUp - whether to use CORAL connection management thread: default = false.
Definition at line 248 of file PoolSvc.h.
◆ m_context
coral::Context* PoolSvc::m_context {nullptr} |
|
private |
◆ m_contextMaxFile
std::map<unsigned int, unsigned int> PoolSvc::m_contextMaxFile |
|
private |
◆ m_dbAgeLimit
IntegerProperty PoolSvc::m_dbAgeLimit {this,"MaxFilesOpen",0} |
|
private |
MaxFilesOpen, option to have PoolSvc limit the number of open Input Files: default = 0 (No files are closed automatically)
Definition at line 228 of file PoolSvc.h.
◆ m_fileOpen
StringProperty PoolSvc::m_fileOpen {this,"FileOpen","overwrite"} |
|
private |
FileOpen, the open mode for the file ("append" or "overwrite").
Definition at line 225 of file PoolSvc.h.
◆ m_frontierComp
IntegerProperty PoolSvc::m_frontierComp {this,"FrontierCompression",5} |
|
private |
Frontier proprties, compression level and list of schemas to be refreshed: default = 5.
Definition at line 250 of file PoolSvc.h.
◆ m_frontierRefresh
StringArrayProperty PoolSvc::m_frontierRefresh {this,"FrontierRefreshSchema",{}} |
|
private |
◆ m_inputContextLabel
std::map<std::string, unsigned int> PoolSvc::m_inputContextLabel |
|
private |
◆ m_mainOutputLabel
std::string PoolSvc::m_mainOutputLabel {} |
|
private |
◆ m_outputContextLabel
std::map<std::string, unsigned int> PoolSvc::m_outputContextLabel |
|
private |
◆ m_pers_mut
◆ m_persistencySvcVec
◆ m_pool_mut
◆ m_readCatalog
StringArrayProperty PoolSvc::m_readCatalog {this,"ReadCatalog",{},"List of catalog files to read from","OrderedSet<std::string>"} |
|
private |
ReadCatalog, the list of additional POOL input file catalogs to consult: default = empty vector.
Definition at line 233 of file PoolSvc.h.
◆ m_retrialPeriod
IntegerProperty PoolSvc::m_retrialPeriod {this,"ConnectionRetrialPeriod",300} |
|
private |
ConnectionRetrialPeriod, retry period for CORAL Connection Service: default = 30 seconds.
Definition at line 242 of file PoolSvc.h.
◆ m_retrialTimeOut
IntegerProperty PoolSvc::m_retrialTimeOut {this,"ConnectionRetrialTimeOut",3600} |
|
private |
ConnectionRetrialTimeOut, the retrial time out for CORAL Connection Service: default = 300 seconds.
Definition at line 244 of file PoolSvc.h.
◆ m_shareCat
bool PoolSvc::m_shareCat {false} |
|
private |
◆ m_sortReplicas
BooleanProperty PoolSvc::m_sortReplicas {this,"SortReplicas",true} |
|
private |
◆ m_timeOut
IntegerProperty PoolSvc::m_timeOut {this,"ConnectionTimeOut",5} |
|
private |
ConnectionTimeOut, the time out for CORAL Connection Service: default = 5 seconds.
Definition at line 246 of file PoolSvc.h.
◆ m_useROOTIMT
BooleanProperty PoolSvc::m_useROOTIMT {this,"UseROOTImplicitMT",true} |
|
private |
Use ROOT Implicit MultiThreading, default = true.
Definition at line 235 of file PoolSvc.h.
◆ m_useROOTMaxTree
BooleanProperty PoolSvc::m_useROOTMaxTree {this,"UseROOTIncreaseVMaxTree",false} |
|
private |
Increase virtual TTree size to avoid backreads in multithreading, default = false.
Definition at line 237 of file PoolSvc.h.
◆ m_writeCatalog
StringProperty PoolSvc::m_writeCatalog {this,"WriteCatalog","xmlcatalog_file:PoolFileCatalog.xml"} |
|
private |
WriteCatalog, the file catalog to be used to register output files (also default input catalog): default = "" (use POOL default).
Definition at line 231 of file PoolSvc.h.
The documentation for this class was generated from the following files:
IntegerProperty m_timeOut
ConnectionTimeOut, the time out for CORAL Connection Service: default = 5 seconds.
char data[hepevt_bytes_allocation_ATLAS]
static CollectionFactory * get()
Retrieves the collection factory singleton.
static const Guid & null()
NULL-Guid: static class method.
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
std::map< unsigned int, std::list< Guid > > m_guidLists ATLAS_THREAD_SAFE
This class provides the interface to the LCG POOL persistency software.
void lookupFileByPFN(const std::string &pfn, std::string &fid, std::string &tech) const
Get FID and filetype for a given PFN.
std::unique_ptr< pool::IDatabase > getDbHandle(unsigned int contextId, const std::string &dbName) const
Get Database handle.
IntegerProperty m_retrialTimeOut
ConnectionRetrialTimeOut, the retrial time out for CORAL Connection Service: default = 300 seconds.
const std::string & containerName() const
Access container name.
bool setWriteModeForNonExisting(Mode mode)
Sets the opening mode when a non existing database is opened for writing Acceptable values are RAISE_...
std::string find(const std::string &s)
return a remapped string
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
StringProperty m_fileOpen
FileOpen, the open mode for the file ("append" or "overwrite").
IntegerProperty m_frontierComp
Frontier proprties, compression level and list of schemas to be refreshed: default = 5.
void registerPFN(const std::string &pfn, const std::string &ftype, std::string &fid)
Register PFN, assign new FID if not given.
std::map< std::string, unsigned int > m_inputContextLabel
virtual StatusCode connect(pool::ITransaction::Type type, unsigned int contextId=IPoolSvc::kInputStream) override
Connect to a logical database unit; PersistencySvc is chosen according to transaction type (accessmod...
virtual StatusCode commit(unsigned int contextId=IPoolSvc::kInputStream) const override
Commit data for a given contextId and flush buffer.
BooleanProperty m_attemptCatalogPatch
AttemptCatalogPatch, option to create catalog: default = false.
virtual const ITechnologySpecificAttributes & technologySpecificAttributes() const =0
Returns the object holding the technology specific attributes for a given technology domain.
virtual void connectForRead()=0
Connects explicitly to the database for read operations.
const std::string & auxString() const
Access auxiliary string.
virtual const pool::IFileCatalog * catalog() const override
void renamePFN(const std::string &pfn, const std::string &newpfn)
Rename PFN.
virtual StatusCode disconnect(unsigned int contextId=IPoolSvc::kInputStream) const override
Disconnect PersistencySvc associated with a contextId.
const Guid & dbID() const
Access database identifier.
StringArrayProperty m_frontierRefresh
virtual bool disconnectAll()=0
Explicitly disconnects all the databases.
virtual const std::string & pfn()=0
Returns the physical file name of this database.
const std::string toString() const
Automatic conversion to string representation.
void commit()
Save catalog to file.
bool setAttribute(const std::string &attributeName, const T &atttibuteValue, const std::string &option="")
Templated method to set an attribute.
virtual ITokenIterator * tokens(const std::string &selection)=0
Starts an iteration over the tokens in the container.
coral::Context * m_context
#define ATH_MSG_VERBOSE(x)
virtual StatusCode setAttribute(const std::string &optName, const std::string &data, long tech, unsigned int contextId=IPoolSvc::kOutputStream) const override
Set POOL attributes - domain.
virtual ITransaction & transaction()=0
Returns the transaction object.
virtual const std::string & fid()=0
Returns the file identifier of this database.
StringProperty m_writeCatalog
WriteCatalog, the file catalog to be used to register output files (also default input catalog): defa...
virtual OpenMode openMode() const =0
Returns the opening mode. It can be used to check whether the database is connected.
virtual Token * next()=0
Returns the pointer to next token.
BooleanProperty m_useROOTMaxTree
Increase virtual TTree size to avoid backreads in multithreading, default = false.
Type
Transaction type enumeration.
virtual const ITechnologySpecificAttributes & technologySpecificAttributes() const =0
Returns the object holding the technology specific attributes.
void lookupFileByLFN(const std::string &lfn, std::string &fid) const
Return the status of a LFName.
This class provides a token that identifies in a unique way objects on the persistent storage.
void setLevel(MsgLevel l)
static const InterfaceID & interfaceID()
Retrieve interface ID.
std::recursive_mutex CallMutex
Token & fromString(const std::string &from)
Build from the string representation of a token.
std::vector< CallMutex * > m_pers_mut
std::string m_mainOutputLabel
Base exception class for the POOL system.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
virtual unsigned int getOutputContext(const std::string &label) override
virtual bool commitAndHold()=0
Commits the holds transaction.
virtual void connectForWrite()=0
Connects explicitly to the database for write/update operations.
std::unique_ptr< pool::IContainer > getContainerHandle(pool::IDatabase *dbH, const std::string &contName) const
Get Container handle.
virtual const ITechnologySpecificAttributes & technologySpecificAttributes(long technology) const =0
Returns the object holding the technology specific attributes for a given technology domain.
void start()
redirect to init() for Gaudi FC
virtual bool start(Type type=READ)=0
Starts a new transaction. Returns the success of the operation.
bool setWriteModeForExisting(Mode mode)
Sets the opening mode when an existing database is opened for writing.
virtual StatusCode disconnectDb(const std::string &connection, unsigned int contextId=IPoolSvc::kInputStream) const override
Disconnect single Database.
void setWriteCatalog(const std::string &connect)
Access to the (first) writable file catalog.
virtual bool setTechnology(long technology)=0
Sets the technology identifier for this database.
virtual void disconnect()=0
Disconnects from the database.
const std::string & auxString() const
Access auxiliary string.
void removeCatalog(const std::string &connect)
Add new catalog identified by reference to the existing ones.
bool allGood
Loop over the SDOs & Digits.
BooleanProperty m_sortReplicas
Use DBReplicaSvc to sort database connections, default = true.
pool::IFileCatalog * m_catalog
std::map< unsigned int, unsigned int > m_contextMaxFile
StringArrayProperty m_readCatalog
ReadCatalog, the list of additional POOL input file catalogs to consult: default = empty vector.
IntegerProperty m_dbAgeLimit
MaxFilesOpen, option to have PoolSvc limit the number of open Input Files: default = 0 (No files are ...
virtual const std::string toString() const
Retrieve the string representation of the token.
void patchCatalog(const std::string &pfn, pool::IDatabase &dbH) const
virtual bool commit()=0
Commits the transaction.
std::string poolCondPath(const std::string &leaf)
Resolve a file using ATLAS_POOLCOND_PATH.
virtual IDatabase * databaseHandle(const std::string &dbName, DatabaseSpecification::NameType dbNameType)=0
Returns a pointer to a database object. The user acquires ownership of that object.
T attribute(const std::string &attributeName, const std::string &option="")
Templated method to retrieve an attribute.
void getFirstPFN(const std::string &fid, std::string &pfn, std::string &tech) const
Get the first PFN + filetype for the given FID.
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
std::string getenv(const std::string &variableName)
get an environment variable
#define ATH_MSG_WARNING(x)
std::vector< pool::IPersistencySvc * > m_persistencySvcVec
StatusCode setupPersistencySvc()
virtual ISession & session()=0
Returns the underlying global session.
virtual IContainer * containerHandle(const std::string &name)=0
Returns a pointer to a container object. The user acquires ownership of that object.
IntegerProperty m_retrialPeriod
ConnectionRetrialPeriod, retry period for CORAL Connection Service: default = 30 seconds.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
bool isNumber(const std::string &s)
pool::IFileCatalog * createCatalog()
static std::unique_ptr< IPersistencySvc > create(IFileCatalog &catalog)
Factory for PersistencySvc.
virtual unsigned int getInputContext(const std::string &label, unsigned int maxFile=0) override
BooleanProperty m_connClean
ConnectionCleanUp - whether to use CORAL connection management thread: default = false.
void addReadCatalog(const std::string &connect)
Add new catalog identified by name to the existing ones.
virtual Type type() const =0
Returns the transaction type.
BooleanProperty m_useROOTIMT
Use ROOT Implicit MultiThreading, default = true.
virtual bool isActive() const =0
Checks if the transaction is active.
std::map< std::string, unsigned int > m_outputContextLabel