ATLAS Offline Software
Loading...
Searching...
No Matches
IOVDbSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// IOVDbSvc.cxx
6// Re-implementation of Athena IOVDbSvc
7// Richard Hawkijngs, started 23/11/08
8// based on earlier code by RD Schaffer, Antoine Perus and RH
9
10#include "IOVDbParser.h"
11#include "IOVDbSvc.h"
12#include "CoralCrestManager.h"
13
14#include "Gaudi/Interfaces/IOptionsSvc.h"
15#include "GaudiKernel/GaudiException.h"
16#include "GaudiKernel/Guards.h"
17#include "GaudiKernel/IIncidentSvc.h"
18#include "GaudiKernel/IIoComponentMgr.h"
19#include "GaudiKernel/IOpaqueAddress.h"
20#include "GaudiKernel/IProperty.h"
21
24#include "DBLock/DBLock.h"
29
30#include <algorithm>
31#include <list>
32#include <ranges>
33#include <utility>
34
35
36namespace {
37
38// Wrap a cool IDatabase with a DBLock.
39class LockedDatabase
40 : public cool::IDatabase
41{
42public:
43 LockedDatabase (cool::IDatabasePtr dbptr,
44 const Athena::DBLock& dblock)
45 : m_dbptr (std::move(dbptr)), m_dblock (dblock) {}
46
47 virtual ~LockedDatabase() = default;
48
49 virtual const cool::DatabaseId& databaseId() const override
50 { return m_dbptr->databaseId(); }
51
52 virtual const cool::IRecord& databaseAttributes() const override
53 { return m_dbptr->databaseAttributes(); }
54
55 virtual cool::IFolderSetPtr createFolderSet
56 ( const std::string& fullPath,
57 const std::string& description = "",
58 bool createParents = false ) override
59 { return m_dbptr->createFolderSet (fullPath, description, createParents); }
60
61 virtual bool existsFolderSet( const std::string& folderSetName ) override
62 { return m_dbptr->existsFolderSet (folderSetName); }
63
64 virtual cool::IFolderSetPtr getFolderSet( const std::string& fullPath ) override
65 { return m_dbptr->getFolderSet (fullPath); }
66
67 virtual cool::IFolderPtr createFolder
68 ( const std::string& fullPath,
69 const cool::IFolderSpecification& folderSpec,
70 const std::string& description = "",
71 bool createParents = false ) override
72 { return m_dbptr->createFolder (fullPath, folderSpec, description, createParents); }
73
74 virtual bool existsFolder( const std::string& fullPath ) override
75 { return m_dbptr->existsFolder (fullPath); }
76
77 virtual cool::IFolderPtr getFolder( const std::string& fullPath ) override
78 { return m_dbptr->getFolder (fullPath); }
79
80 virtual const std::vector<std::string> listAllNodes( bool ascending = true ) override
81 { return m_dbptr->listAllNodes (ascending); }
82
83 virtual bool dropNode( const std::string& fullPath ) override
84 { return m_dbptr->dropNode (fullPath); }
85
86 virtual bool existsTag( const std::string& tagName ) const override
87 { return m_dbptr->existsTag (tagName); }
88
89 virtual cool::IHvsNode::Type tagNameScope( const std::string& tagName ) const override
90 { return m_dbptr->tagNameScope (tagName); }
91
92 virtual const std::vector<std::string>
93 taggedNodes( const std::string& tagName ) const override
94 { return m_dbptr->taggedNodes (tagName); }
95
96 virtual bool isOpen() const override
97 { return m_dbptr->isOpen(); }
98
99 virtual void openDatabase() override
100 { return m_dbptr->openDatabase(); }
101
102 virtual void closeDatabase() override
103 { return m_dbptr->closeDatabase(); }
104
105 virtual const std::string& databaseName() const override
106 { return m_dbptr->databaseName(); }
107
108#ifdef COOL400TX
110 virtual ITransactionPtr startTransaction() override
111 { return m_dbptr->startTransaction(); }
112#endif
113
114
115private:
116 cool::IDatabasePtr m_dbptr;
117 Athena::DBLock m_dblock;
118};
119
120} // anonymous namespace
121
122
124{
125 if( m_poolSvcContext < 0 ) {
126 // Get context for POOL conditions files, and created an initial connection
128 m_poolSvcContext=m_h_poolSvc->getInputContext("Conditions", m_par_maxNumPoolFiles);
129 } else {
130 m_poolSvcContext=m_h_poolSvc->getInputContext("Conditions");
131 }
132 if( m_h_poolSvc->connect(Io::READ, m_poolSvcContext).isSuccess() ) {
133 ATH_MSG_INFO( "Opened read transaction for POOL PersistencySvc");
134 } else {
135 // We only emit info for failure to connect (for the moment? RDS 01/2008)
136 ATH_MSG_INFO( "Cannot connect to POOL PersistencySvc" );
137 }
138 }
139 return m_poolSvcContext;
140}
141
142
144 // subscribe to events
145 ServiceHandle<IIncidentSvc> incSvc("IncidentSvc",name());
146 ATH_CHECK( incSvc.retrieve() );
147 const long int pri = 100;
148 incSvc->addListener( this, IncidentType::BeginEvent, pri );
149 incSvc->addListener( this, "StoreCleared", pri ); // for SP Athena
150 incSvc->addListener( this, IncidentType::EndProcessing, pri ); // for MT Athena
151
152 // Register this service for 'I/O' events
153 ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", name());
154 ATH_CHECK( iomgr.retrieve() );
155 ATH_CHECK( iomgr->io_register(this) );
156
157 // print warnings/info depending on state of job options
159 ATH_MSG_INFO( "COOL connection management disabled - connections kept open throughout job" );
161 ATH_MSG_INFO( "POOL file connection management disabled - files kept open throught job" );
162 if (m_par_maxNumPoolFiles > 0)
163 ATH_MSG_INFO( "Only " << m_par_maxNumPoolFiles.value() << " POOL conditions files will be open at once" );
165 ATH_MSG_WARNING( "Global run/LB number forced to be [" <<
166 m_par_forceRunNumber.value() << "," << m_par_forceLumiblockNumber.value() << "]" );
167 if (m_par_forceTimestamp > 0)
168 ATH_MSG_WARNING( "Global timestamp forced to be " << m_par_forceTimestamp.value() );
169 if (m_par_cacheRun > 0)
170 ATH_MSG_INFO( "Run-LB data will be cached in groups of " << m_par_cacheRun.value() << " runs" );
171 if (m_par_cacheTime > 0)
172 ATH_MSG_INFO( "Timestamp data will be cached in groups of " << m_par_cacheTime.value() << " seconds" );
173 if (m_par_cacheAlign > 0)
174 ATH_MSG_INFO( "Cache alignment will be done in " << m_par_cacheAlign.value() << " slices" );
175 if (m_par_onlineMode)
176 ATH_MSG_INFO( "Online mode ignoring potential missing channels outside cache" );
177 if (m_par_checklock)
178 ATH_MSG_INFO( "Tags will be required to be locked");
179
180 // make sure iovTime is undefined
181 m_iovTime.reset();
182
183 // extract information from EventSelector for run/LB/time overrides
185
186 // initialise default connection
187 if (!m_par_defaultConnection.empty()) {
188 // default connection is readonly if no : in name (i.e. logical conn)
189 bool readonly=(m_par_defaultConnection.find(':')==std::string::npos);
190 m_connections.push_back(std::make_unique<IOVDbConn>(m_par_defaultConnection,readonly,msg()));
191 }
192
193 // set time of timestampslop in nanoseconds
194 m_iovslop=static_cast<cool::ValidityKey>(m_par_timeStampSlop*1.E9);
195
196 // check for global tag in jobopt, which will override anything in input file
197 if (!m_par_globalTag.empty()) {
199 ATH_MSG_INFO( "Global tag: " << m_par_globalTag.value() << " set from joboptions" );
200 }
201
202 // setup folders and process tag overrides
204
205 // Set state to initialize
207 ATH_MSG_INFO( "Initialised with " << m_connections.size() <<
208 " connections and " << m_foldermap.size() << " folders" );
209
210 if (m_outputToFile) ATH_MSG_INFO("Db dump to file activated");
211 if (m_crestCoolToFile) ATH_MSG_INFO("Crest or Cool dump to file activated");
212
213 ATH_MSG_INFO( "Service IOVDbSvc initialised successfully" );
214
216 return StatusCode::SUCCESS;
217}
218
219
221 ATH_MSG_DEBUG("I/O reinitialization...");
222 // PoolSvc clears all connections on IO_reinit - forget the stored contextId
223 m_poolSvcContext = -1;
224 return StatusCode::SUCCESS;
225}
226
227
229 ATH_MSG_DEBUG("I/O finalization...");
230 return StatusCode::SUCCESS;
231}
232
233
234StatusCode IOVDbSvc::finalize() {
235 // summarise and delete folders, adding total read from COOL
236 unsigned long long nread = 0;
237 float readtime = 0;
238
239 // accumulate a map of readtime by connection
240 std::map<IOVDbConn*, float> ctmap;
241 for (const auto & [name, folder] : m_foldermap) {
242 folder->summary();
243 nread += folder->bytesRead();
244 readtime += folder->readTime();
245 const auto& [citr, inserted] = ctmap.try_emplace(folder->conn(), 0);
246 citr->second += folder->readTime();
247 }
248 m_foldermap.clear();
249 ATH_MSG_INFO( "Total payload read from IOVDb: " << nread << " bytes in (( " << std::fixed << std::setw(9) << std::setprecision(2) <<
250 readtime << " ))s" );
251
252 // close and delete connections, printing time in each one
253 for (const auto & conn : m_connections) {
254 float fread = 0;
255 const auto citr = ctmap.find(conn.get());
256 if (citr != ctmap.end()) fread = citr->second;
257 conn->setInactive();
258 conn->summary(fread);
259 }
260 m_connections.clear();
261
262 return StatusCode::SUCCESS;
263}
264
265
266cool::IDatabasePtr IOVDbSvc::getDatabase(bool readOnly) {
267 // get default database connection
268 cool::IDatabasePtr dbconn;
269 if (m_par_defaultConnection.empty() || m_connections.empty()) {
270 ATH_MSG_INFO( "No default COOL database connection is available");
271 dbconn.reset();
272 } else {
273 Athena::DBLock dblock;
274 if (m_connections[0]->isReadOnly()!=readOnly) {
275 ATH_MSG_INFO("Changing state of default connection to readonly=" << readOnly );
276 m_connections[0]->setReadOnly(readOnly);
277 }
278 dbconn = std::make_shared<LockedDatabase> (m_connections[0]->getCoolDb(),
279 dblock);
280 }
281 return dbconn;
282}
283
284
286 // Read information for folders and setup TADs
287 if (storeID!=StoreID::DETECTOR_STORE) return StatusCode::SUCCESS;
288 // Preloading of addresses should be done ONLY for detector store
289 ATH_MSG_DEBUG( "preLoadAddress: storeID -> " << storeID );
290
291 Athena::DBLock dblock;
292
293 // check File Level Meta Data of input, see if any requested folders are available there
296 if (m_h_metaDataStore->retrieve(cont,contEnd).isSuccess()) {
297 unsigned int ncontainers=0;
298 unsigned int nused=0;
299 for (;cont!=contEnd; ++cont) {
300 ++ncontainers;
301 const std::string& fname=cont->folderName();
302 // check if this folder is in list requested by IOVDbSvc
303 for (const auto & [name, folder] : m_foldermap) {
304 // take data from FLMD only if tag override is NOT set
305 if (folder->folderName()==fname && !(folder->tagOverride())) {
306 ATH_MSG_INFO( "Folder " << fname << " will be taken from file metadata" );
307 folder->useFileMetaData();
308 folder->setFolderDescription( cont->folderDescription() );
309 ++nused;
310 break;
311 }
312 }
313 }
314 ATH_MSG_INFO( "Found " << ncontainers << " metadata containers in input file, " << nused << " will be used");
315 } else {
316 ATH_MSG_DEBUG( "Could not retrieve IOVMetaDataContainer objects from MetaDataStore" );
317 }
318
319 // Remove folders which should only be read from file meta data, but
320 // were not found in the MetaDataStore
321
322 // Note: we cannot iterate and perform erase within the iteration
323 // because the iterator becomes invalid. So first collect the keys
324 // to erase in a first pass and then erase them.
325 std::vector<std::string> keysToDelete;
326 for (const auto & [name, folder] : m_foldermap) {
327 if (folder->fromMetaDataOnly() && !folder->readMeta()) {
328 ATH_MSG_INFO( "preLoadAddresses: Removing folder " << folder->folderName() <<
329 ". It should only be in the file meta data and was not found." );
330 keysToDelete.push_back(name);
331 }
332 }
333
334 for (auto & thisKey : keysToDelete) {
335 const auto fitr = m_foldermap.find(thisKey);
336 if (fitr != m_foldermap.end()) {
337 fitr->second->conn()->decUsage();
338 m_foldermap.erase(fitr);
339 } else {
340 ATH_MSG_ERROR( "preLoadAddresses: Could not find folder " << thisKey << " for removal" );
341 }
342 }
343
344
345 // loop over all folders, grouped by connection
346 // do metadata folders on first connection (default connection)
347 bool doMeta=true;
348 // do not close COOL connection until next one has been opened, this enables
349 // connection sharing in CORAL, so all COOL connections will use the same
350 // CORAL one (althugh they will each be given a separate session)
351 IOVDbConn* oldconn=nullptr;
352 for (const auto & pThisConnection : m_connections) {
353 if (pThisConnection->nFolders()>0 || doMeta) {
354 // loop over all folders using this connection
355 for (const auto & [name, folder] : m_foldermap) {
356 if (folder->conn()==pThisConnection.get() || (folder->conn()==nullptr && doMeta)) {
357 std::unique_ptr<SG::TransientAddress> tad =
358 folder->preLoadFolder( &(*m_h_tagInfoMgr), m_par_cacheRun, m_par_cacheTime);
359 if (oldconn!=pThisConnection.get()) {
360 // close old connection if appropriate
361 if (m_par_manageConnections && oldconn!=nullptr) oldconn->setInactive();
362 oldconn=pThisConnection.get();
363 }
364 if (tad==nullptr) {
365 ATH_MSG_ERROR( "preLoadFolder failed for folder " << folder->folderName() );
366 return StatusCode::FAILURE;
367 }
368 // for write-metadata folder, request data preload
369 if (folder->writeMeta()) {
370 if (m_h_IOVSvc->preLoadDataTAD(tad.get(),folder->eventStore()).isFailure()) {
371 ATH_MSG_ERROR( "Could not request IOVSvc to preload metadata for " << folder->folderName() );
372 return StatusCode::FAILURE;
373 }
374 } else {
375 // for other folders, just preload TAD (not data)
376 if (m_h_IOVSvc->preLoadTAD(tad.get(), folder->eventStore()).isFailure()) {
377 ATH_MSG_ERROR( "Could not request IOVSvc to preload metadata for " << folder->folderName() );
378 return StatusCode::FAILURE;
379 }
380 }
381 // Add TAD to Storegate
382 tlist.push_back(tad.release());
383 // check for IOV override
385 }
386 }
387 }
388 doMeta=false;
389 }
390 // close last connection
391 if (oldconn!=nullptr and m_par_manageConnections) oldconn->setInactive();
392
393 // some folder keys may have changed during preloadFolder due to use of
394 // <key> specification in folder description string
395 // build a new foldermap with the updated keys
396 FolderMap newmap;
397 for (auto & [name, folder] : m_foldermap) {
398 newmap[folder->key()]=std::move(folder);
399 }
400 m_foldermap=std::move(newmap);
401
402 // fill global and explicit folder tags into TagInfo
403 if (fillTagInfo().isFailure())
404 ATH_MSG_ERROR("Could not fill TagInfo object from preLoadAddresses" );
405
406 return StatusCode::SUCCESS;
407}
408
409
410StatusCode IOVDbSvc::loadAddresses(StoreID::type /*storeID*/, tadList& /*list*/ ) {
411 // this method does nothing
412 return StatusCode::SUCCESS;
413}
414
415
417 const EventContext& /*ctx*/)
418{
419 // Provide TAD and associated range, actually reading the conditions data
420
421 // Read information for folders and setup TADs
422 if (storeID!=StoreID::DETECTOR_STORE) return StatusCode::FAILURE;
423 Gaudi::Guards::AuditorGuard auditor(std::string("UpdateAddr::")+(tad->name().empty() ? "anonymous" : tad->name()),
424 auditorSvc(), "preLoadProxy");
425
426 IOVTime iovTime{m_iovTime};
427 IOVRange range;
428 std::unique_ptr<IOpaqueAddress> address;
429
430 // first check if this key is managed by IOVDbSvc
431 // return FAILURE if not - this allows other AddressProviders to be
432 // asked for the TAD
433 const std::string& key=tad->name();
434 const auto fitr=m_foldermap.find(key);
435 if (fitr==m_foldermap.end()) {
437 "updateAddress cannot find description for TAD " << key );
438 return StatusCode::FAILURE;
439 }
440 const auto& folder=fitr->second;
441 if (folder->clid()!=tad->clID()) {
442 ATH_MSG_VERBOSE( "CLID for TAD " << key << " is " << tad->clID()
443 << " but expecting " << folder->clid() );
444
445 return StatusCode::FAILURE;
446 }
447
448 // IOVDbSvc will satisfy the request, using already found folder
449 // now determine the current IOVTime
450 if (m_state==IOVDbSvc::INITIALIZATION && !m_iovTime.isValid()) {
451 ATH_MSG_DEBUG( "updateAddress: in initialisation phase and no iovTime defined" );
452 return::StatusCode::SUCCESS;
453 }
455 // determine iovTime from eventID in the event context
456 const EventIDBase* evid = EventIDFromStore( m_h_sgSvc );
457 if( evid ) {
458 iovTime.setRunEvent( evid->run_number(), evid->lumi_block()) ;
459 // save both seconds and ns offset for timestamp
460 uint64_t nsTime = evid->time_stamp() *1000000000LL;
461 nsTime += evid->time_stamp_ns_offset();
462 iovTime.setTimestamp(nsTime);
463 m_iovTime = iovTime;
464 ATH_MSG_DEBUG( "updateAddress - using iovTime from EventInfo: " << iovTime);
465 } else {
466 // failed to get event info - just return success
467 ATH_MSG_DEBUG( "Could not get event - initialise phase");
468 return StatusCode::SUCCESS;
469 }
470 } else {
471 ATH_MSG_DEBUG("updateAddress: using iovTime from init/beginRun: " << iovTime);
472 }
473
474
475
476 // obtain the validity key for this folder (includes overrides)
477 cool::ValidityKey vkey=folder->iovTime(iovTime);
478 {
479 // The dblock is currently abused to also protect the cache in the IOVDbFolders.
480 // This global lock may give rise to deadlocks between the dblock and the internal lock
481 // of the SGImplSvc. The deadlock may arise if the order of the initial call to IOVDbSvc
482 // and SGImplSvc are different, because the two services call each other.
483 // A problem was observed when SG::DataProxy::isValidAddress first called IOVDbSvc::updateAddress
484 // which called IOVSvc::setRange then SGImplSvc::proxy, and at the same time
485 // StoreGateSvc::contains called first SGImplSvc::proxy which then called IOVDbSvc::updateAddress.
486 // This problem is mitigated by limiting the scope of the dblock here.
487 Athena::DBLock dblock;
488 ATH_MSG_DEBUG("Validity key "<<vkey);
489 if (folder->source() == "CREST") {
490 if (!folder->readMeta() && !folder->cacheValid((vkey))){
491 fitr->second->loadCache(vkey, m_par_cacheAlign,m_globalTag,m_par_onlineMode);
492 }
493 } else { //COOL reading
494 if (!folder->readMeta() && !folder->cacheValid(vkey)) {
495 // mark this folder as not-dropped so cache-read will succeed
496 folder->setDropped(false);
497 // reload cache for this folder (and all others sharing this DB connection)
498 ATH_MSG_DEBUG( "Triggering cache load for folder " << folder->folderName());
499 if (loadCaches(folder->conn()).isFailure()) {
500 ATH_MSG_ERROR( "Cache load failed for at least one folder from " << folder->conn()->name()
501 << ". You may see errors from other folders sharing the same connection." );
502 return StatusCode::FAILURE;
503 }
504 }
505 }//end cool part
506 // data should now be in cache
507 // setup address and range
508 {
509 Gaudi::Guards::AuditorGuard auditor(std::string("FldrSetup:")+(tad->name().empty() ? "anonymous" : tad->name()),
510 auditorSvc(), "preLoadProxy");
511 if (!folder->getAddress(vkey,&(*m_h_persSvc),poolSvcContext(),address,
512 range,m_poolPayloadRequested)) {
513 ATH_MSG_ERROR( "getAddress failed for folder " << folder->folderName() );
514 return StatusCode::FAILURE;
515 }
516 }
517 // reduce minimum IOV of timestamp folders to avoid 'thrashing'
518 // due to events slightly out of order in HLT
519 if (folder->timeStamp()) {
520 cool::ValidityKey start=range.start().timestamp();
521 if (start>m_iovslop) start-=m_iovslop;
522 range=IOVRange(IOVTime(start),range.stop());
523 }
524 }
525
526 // Pass range onto IOVSvc
527 if (m_h_IOVSvc->setRange(tad->clID(),tad->name(),
528 range,folder->eventStore()).isFailure()) {
529 ATH_MSG_ERROR( "setRange failed for folder " << folder->folderName() );
530 return StatusCode::FAILURE;
531 }
532 tad->setAddress(address.release());
533 return StatusCode::SUCCESS;
534}
535
536
537StatusCode IOVDbSvc::getRange( const CLID& clid,
538 const std::string& dbKey,
539 const IOVTime& time,
540 IOVRange& range,
541 std::string& tag,
542 std::unique_ptr<IOpaqueAddress>& address) {
543
544 Athena::DBLock dblock;
545
546 ATH_MSG_DEBUG( "getRange clid: " << clid << " key: \""<< dbKey << "\" t: " << time );
547
548 const auto fitr = m_foldermap.find(dbKey);
549 if (fitr==m_foldermap.end()) {
550 ATH_MSG_VERBOSE("getRange cannot find description for dbKey " << dbKey );
551 return StatusCode::FAILURE;
552 }
553 const auto& folder = fitr->second;
554 if (folder->clid()!=clid) {
555 ATH_MSG_VERBOSE( "supplied CLID for " << dbKey << " is "
556 << clid
557 << " but expecting " << folder->clid() );
558
559 return StatusCode::FAILURE;
560 }
561
562 tag = folder->key();
563
564 // obtain the validity key for this folder (includes overrides)
565 cool::ValidityKey vkey = folder->iovTime(time);
566 if (folder->source() == "CREST") {
567 if (!folder->readMeta() && !folder->cacheValid((vkey))){
568 fitr->second->loadCache(vkey, m_par_cacheAlign,m_globalTag,m_par_onlineMode);
569 }
570 } else {
571 if (!folder->readMeta() && !folder->cacheValid(vkey)) {
572 // mark this folder as not-dropped so cache-read will succeed
573 folder->setDropped(false);
574 // reload cache for this folder (and all others sharing this DB
575 // connection)
576 ATH_MSG_DEBUG("Triggering cache load for folder " << folder->folderName());
577 if (loadCaches(folder->conn(), &time).isFailure()) {
578 ATH_MSG_ERROR("Cache load failed for at least one folder from " << folder->conn()->name()
579 << ". You may see errors from other folders sharing the "
580 "same connection.");
581 return StatusCode::FAILURE;
582 }
583 }
584 }
585 // data should now be in cache
586 address.reset();
587 // setup address and range
588 {
589 Gaudi::Guards::AuditorGuard auditor(std::string("FldrSetup:")+(dbKey.empty() ? "anonymous" : dbKey),
590 auditorSvc(), "preLoadProxy");
591 if (!folder->getAddress(vkey,&(*m_h_persSvc),poolSvcContext(),address,
592 range,m_poolPayloadRequested)) {
593 ATH_MSG_ERROR("getAddress failed for folder " <<folder->folderName() );
594 return StatusCode::FAILURE;
595 }
596 }
597
598 // Special handling for extensible folders:
599 if (folder->extensible()) {
600 // Set the end time to just past the current event or lumiblock.
601 IOVTime extStop = range.stop();
602 if (folder->timeStamp()) {
603 extStop.setTimestamp (time.timestamp() + 1);
604 }
605 else {
606 extStop.setRETime (time.re_time() + 1);
607 }
608 range = IOVRange (range.start(), extStop);
609 }
610
611 // Special handling for IOV override: set the infinite validity range
612 if (folder->iovOverridden()) {
613 if (folder->timeStamp()) {
616 }
617 else {
620 }
621 }
622
623 return StatusCode::SUCCESS;
624}
625
626
627StatusCode IOVDbSvc::setRange( const CLID& /*clid*/,
628 const std::string& /*dbKey*/,
629 const IOVRange& /*range*/,
630 const std::string& /*storeName*/ ) {
631 // this method does nothing
632 return StatusCode::SUCCESS;
633}
634
635
636StatusCode IOVDbSvc::signalBeginRun(const IOVTime& beginRunTime,
637 const EventContext& ctx)
638{
639 Athena::DBLock dblock;
640
641 // Begin run - set state and save time for later use
643 // Is this a different run compared to the previous call?
644 bool newRun = m_iovTime.isValid() && (m_iovTime.run() != beginRunTime.run());
645 m_iovTime=beginRunTime;
646 // For a MC event, the run number we need to use to look up the conditions
647 // may be different from that of the event itself. Override the run
648 // number with the conditions run number from the event context,
649 // if it is defined.
650 EventIDBase::number_type conditionsRun =
652 if (conditionsRun != EventIDBase::UNDEFNUM) {
653 m_iovTime.setRunEvent (conditionsRun, m_iovTime.event());
654 }
655
656 ATH_MSG_DEBUG( "signalBeginRun> begin run time " << m_iovTime);
657 if (!m_par_onlineMode) {
658 return StatusCode::SUCCESS;
659 }
660
661 // ONLINE mode: allow adding of new calibration constants between runs
662 if (!newRun) {
663 ATH_MSG_DEBUG( "Same run as previous signalBeginRun call. Skipping re-loading of folders..." );
664 return StatusCode::SUCCESS;
665 }
666
667 // all other stuff is event based so happens after this.
668 // this is before first event of each run
669 ATH_MSG_DEBUG( "In online mode will recheck ... " );
670 ATH_MSG_DEBUG( "First reload PoolCataloge ... " );
671
672 pool::IFileCatalog* catalog ATLAS_THREAD_SAFE = // we are not within the event loop yet
673 const_cast<pool::IFileCatalog*>(m_h_poolSvc->catalog());
674 catalog->commit();
675 catalog->start();
676 static const std::string preLoadProxyStr{"preLoadProxy"};
677 for (const auto & pThisConnection : m_connections){
678 // only access connections which are actually in use - avoids waking up
679 // the default DB connection if it is not being used
680 if (pThisConnection->nFolders()>0) {
681 //request for database activates connection
682 cool::IDatabasePtr dbconn=pThisConnection->getCoolDb();
683 if (dbconn.get()==nullptr) {
684 ATH_MSG_FATAL( "Conditions database connection " << pThisConnection->name() << " cannot be opened - STOP" );
685 return StatusCode::FAILURE;
686 }
687 for (const auto & [name, folder]: m_foldermap) {
688 if (folder->conn()!=pThisConnection.get()) continue;
689 folder->printCache();
690 cool::ValidityKey vkey=folder->iovTime(m_iovTime);
691 {
692 Gaudi::Guards::AuditorGuard auditor(std::string("FldrCache:")+folder->folderName(), auditorSvc(), preLoadProxyStr);
693 if (!folder->loadCacheIfDbChanged(vkey, m_globalTag, dbconn, m_h_IOVSvc)) {
694 ATH_MSG_ERROR( "Problem RELOADING: " << folder->folderName());
695 return StatusCode::FAILURE;
696 }
697 }
698 folder->printCache();
699 }
700 }
701 if (m_par_manageConnections) pThisConnection->setInactive();
702 }
703 return StatusCode::SUCCESS;
704}
705
706
708 // this method does nothing
709}
710
711
713 // Close any open POOL files after loding Conditions
714 ATH_MSG_DEBUG( "postConditionsLoad: m_par_managePoolConnections=" << m_par_managePoolConnections
715 << " m_poolPayloadRequested=" << m_poolPayloadRequested );
716
718 // reset POOL connection to close all open conditions POOL files
721 if( m_poolSvcContext ) {
722 if (m_h_poolSvc->disconnect(m_poolSvcContext).isSuccess()) {
723 ATH_MSG_DEBUG( "Successfully closed input POOL connections");
724 } else {
725 ATH_MSG_WARNING( "Unable to close input POOL connections" );
726 }
727 // reopen transaction
728 if (m_h_poolSvc->connect(Io::READ, m_poolSvcContext).isSuccess()) {
729 ATH_MSG_DEBUG("Reopend read transaction for POOL conditions input files" );
730 } else {
731 ATH_MSG_WARNING("Cannot reopen read transaction for POOL conditions input files");
732 }
733 }
734 }
735}
736
737
738void IOVDbSvc::handle( const Incident& inc) {
739 // Handle incidents:
740 // BeginEvent to set IOVDbSvc state to EVENT_LOOP
741 // StoreCleared/EndProcessing to close any open POOL files
742 ATH_MSG_VERBOSE( "entering handle(), incident type " << inc.type() << " from " << inc.source() );
743 if (inc.type()=="BeginEvent") {
745 } else {
746 Athena::DBLock dblock;
747
748 const StoreClearedIncident* sinc = dynamic_cast<const StoreClearedIncident*>(&inc);
749 if( (inc.type()=="StoreCleared" && sinc!=nullptr && sinc->store()==&*m_h_sgSvc
751 or inc.type()==IncidentType::EndProcessing )
752 {
755 }
756 }
757}
758
759
761 // Processing of taginfo
762 // Set GlobalTag and any folder-specific overrides if given
763
764 // dump out contents of TagInfo
765 ATH_MSG_DEBUG( "Tags from input TagInfo:");
766 if( msg().level()>=MSG::DEBUG ) m_h_tagInfoMgr->printTags(msg());
767
768 // check IOVDbSvc GlobalTag, if not already set
769 if (m_globalTag.empty()) {
770 m_globalTag = m_h_tagInfoMgr->findTag("IOVDbGlobalTag");
771 if (!m_globalTag.empty()) ATH_MSG_INFO( "Global tag: " << m_globalTag<< " set from input file" );
773 }
774
775 // now check for tag overrides for specific folders
776 const ITagInfoMgr::NameTagPairVec& nameTagPairs = m_h_tagInfoMgr->getInputTags();
777 for (const auto & [theTagName, theTag]: nameTagPairs) {
778 // assume tags relating to conditions folders start with /
779 if (not theTagName.starts_with('/')) continue;
780 // check for folder(s) with this name in (key, ptr) pair
781 for (const auto & [name, folder]: m_foldermap) {
782 const std::string& ifname=folder->folderName();
783 if (ifname!=theTagName) continue;
784 // use an override from TagInfo only if there is not an explicit jo tag,
785 // and folder meta-data is not used, and there is no <noover/> spec,
786 // and no global tag set in job options
787 if (folder->joTag().empty() && !folder->readMeta() && !folder->noOverride() && m_par_globalTag.empty()) {
788 folder->setTagOverride(theTag,false);
789 ATH_MSG_INFO( "TagInfo override for tag " << theTag << " in folder " << ifname );
790 } else if (folder->joTag()!=theTag) {
791 const std::string_view tagTypeString=(folder->joTag().empty()) ? "hierarchical" : "jobOption";
792 ATH_MSG_INFO( "Ignoring inputfile TagInfo request for tag " << theTag << " in folder " << ifname<<" in favour of "<<tagTypeString);
793 }
794 }
795 }
796 return StatusCode::SUCCESS;
797}
798
799
800std::vector<std::string>
802 // return a list of all the StoreGate keys being managed by IOVDbSvc
803 auto keys = std::views::keys(m_foldermap);
804 return {keys.begin(), keys.end()};
805}
806
807
808bool IOVDbSvc::getKeyInfo(const std::string& key, IIOVDbSvc::KeyInfo& info) {
809 // return information about given SG key
810 // first attempt to find the folder object for this key
811 const auto itr = m_foldermap.find(key);
812 if (itr!=m_foldermap.end()) {
813 const IOVDbFolder* f = itr->second.get();
814 info.folderName = f->folderName();
815 info.tag = f->resolvedTag();
816 info.range = f->currentRange();
817 info.retrieved = f->retrieved();
818 info.bytesRead = f->bytesRead();
819 info.readTime = f->readTime();
820 info.extensible = f->extensible();
821 return true;
822 } else {
823 info.retrieved = false;
824 return false;
825 }
826}
827
828
829bool IOVDbSvc::dropObject(const std::string& key, const bool resetCache) {
830 // find the folder corresponding to this object
831 const auto itr = m_foldermap.find(key);
832 if (itr!=m_foldermap.end()) {
833 IOVDbFolder* folder=itr->second.get();
834 CLID clid=folder->clid();
835 SG::DataProxy* proxy=m_h_detStore->proxy(clid,key);
836 if (proxy!=nullptr) {
837 m_h_detStore->clearProxyPayload(proxy);
838 ATH_MSG_DEBUG("Dropped payload for key " << key );
839 folder->setDropped(true);
840 if (resetCache) {
841 folder->resetCache();
842 ATH_MSG_DEBUG( "Cache reset done for folder " << folder->folderName() );
843 }
844 return true;
845 } else {
846 return false;
847 }
848 } else {
849 return false;
850 }
851}
852
853
854/************************/
855// private methods of IOVDbSvc
856
858 // check if EventSelector is being used to override run numbers
859 // if so, we can set IOV time already to allow conditons retrieval
860 // in the initialise phase, needed for setting up simulation
861
862 ServiceHandle<Gaudi::Interfaces::IOptionsSvc> joSvc("JobOptionsSvc",name());
863 ATH_CHECK( joSvc.retrieve() );
864
865 if (!joSvc->has("EventSelector.OverrideRunNumber")) {
866 // do not return FAILURE if the EventSelector cannot be found, or it has
867 // no override property, can e.g. happen in online running
868 ATH_MSG_DEBUG( "No EventSelector.OverrideRunNumber property found" );
869 return StatusCode::SUCCESS;
870 }
871
872 BooleanProperty overrideRunNumber("OverrideRunNumber",false);
873 ATH_CHECK( overrideRunNumber.fromString(joSvc->get("EventSelector.OverrideRunNumber")) );
874 if (overrideRunNumber) {
875 // if flag is set, extract Run,LB and time
876 ATH_MSG_INFO( "Setting run/LB/time from EventSelector override in initialize" );
877 uint32_t run,lumib;
878 uint64_t time;
879 bool allGood=true;
881 ATH_MSG_WARNING( "forceRunNumber property also set" );
882 }
883 IntegerProperty iprop1("RunNumber",0);
884 if (iprop1.fromString(joSvc->get("EventSelector.RunNumber","INVALID"))) {
885 run=iprop1;
886 } else {
887 ATH_MSG_ERROR( "Unable to get RunNumber from EventSelector");
888 allGood=false;
889 }
890 IntegerProperty iprop2("FirstLB",0);
891 if (iprop2.fromString(joSvc->get("EventSelector.FirstLB","INVALID"))) {
892 lumib=iprop2;
893 } else {
894 ATH_MSG_ERROR( "Unable to get FirstLB from EventSelector");
895 allGood=false;
896 }
897 IntegerProperty iprop3("InitialTimeStamp",0);
898 if (iprop3.fromString(joSvc->get("EventSelector.InitialTimeStamp","INVALID"))) {
899 time=iprop3;
900 } else {
901 ATH_MSG_ERROR("Unable to get InitialTimeStamp from EventSelector" );
902 allGood=false;
903 }
904 if (allGood) {
905 m_iovTime.setRunEvent(run,lumib);
906 uint64_t nsTime=time*1000000000LL;
907 m_iovTime.setTimestamp(nsTime);
908 ATH_MSG_INFO( "run/LB/time set to [" << run << "," << lumib << " : " << nsTime << "]" );
909 } else {
910 ATH_MSG_ERROR( "run/LB/Time NOT changed" );
911 }
912 }
913
914 return StatusCode::SUCCESS;
915}
916
917
919 // read the Folders joboptions and setup the folder list
920 // no wildcards are allowed
921
922 // getting the pairs: folder name - CREST tag name:
923 if (m_par_source == "CREST"){
924 m_cresttagmap.clear();
926 }
927
928 //1. Loop through folders
929 std::list<IOVDbParser> allFolderdata;
930 for (const auto & thisFolder : m_par_folders) {
931 ATH_MSG_DEBUG( "Setup folder " << thisFolder );
932 IOVDbParser folderdata(thisFolder,msg());
933 if (!folderdata.isValid()) {
934 ATH_MSG_FATAL("setupFolders: Folder setup string is invalid: " <<thisFolder);
935 return StatusCode::FAILURE;
936 }
937
938 allFolderdata.push_back(std::move(folderdata));
939 }
940
941 //2. Loop through overwrites:
942 // syntax for entries is <prefix>folderpath</prefix> <tag>value</tag>
943 // folderpath matches from left of folderName
944 // but if partial match, next character must be / so override for /Fred/Ji
945 // matches /Fred/Ji/A and /Fred/Ji but not /Fred/Jim
946
947 for (const auto & thisOverrideTag : m_par_overrideTags) {
948 IOVDbParser keys(thisOverrideTag,msg());
949 if (not keys.isValid()){
950 ATH_MSG_ERROR("An override tag was invalid: " << thisOverrideTag);
951 return StatusCode::FAILURE;
952 }
953 std::string prefix;
954 if (!keys.getKey("prefix","",prefix)) { // || !keys.getKey("tag","",tag)) {
955 ATH_MSG_ERROR( "Problem in overrideTag specification " <<thisOverrideTag );
956 return StatusCode::FAILURE;
957 }
958
959 for (auto& folderdata : allFolderdata) {
960 const std::string& ifname=folderdata.folderName();
961 if (ifname.starts_with(prefix) &&
962 (ifname.size()==prefix.size() || ifname[prefix.size()]=='/')) {
963 //Match!
964 folderdata.applyOverrides(keys,msg());
965 }
966 }
967 }
968
969 //3. Remove any duplicates:
970 std::list<IOVDbParser>::iterator it1=allFolderdata.begin();
971 std::list<IOVDbParser>::iterator it_e=allFolderdata.end();
972 for (;it1!=it_e;++it1) {
973 const IOVDbParser& folder1=*it1;
974 std::list<IOVDbParser>::iterator it2=it1;
975 ++it2;
976 while(it2!=it_e) {
977 const IOVDbParser& folder2=*it2;
978 if (folder1==folder2) {
979 it2=allFolderdata.erase(it2); //FIXME: Smarter distinction/reporting about same folder but different keys.
980 ATH_MSG_DEBUG( "Removing duplicate folder " << folder1.folderName());
981 } else {
982 ++it2;
983 //Catch suspicous cases:
984 if (folder1.folderName()==folder2.folderName()) {
985 ATH_MSG_WARNING( "Folder name appears twice: " << folder1.folderName() );
986 ATH_MSG_WARNING( folder1 << " vs " << folder2 );
987 }
988 }
989 }//end inner loop
990 }//end outer loop
991
992 //4.Set up folder map with cleaned folder list
993
994 bool crestError=false;
995 for (const auto& folderdata : allFolderdata) {
996 // find the connection specification first - db or dbConnection
997 // default is to use the 'default' connection
998 IOVDbConn* conn=nullptr;
999 std::string connstr;
1000 if (folderdata.getKey("db","",connstr) ||
1001 folderdata.getKey("dbConnection","",connstr)) {
1002 // an explicit database name is specified
1003 // check if it is already present in the existing connections
1004 for (const auto & pThisConnection : m_connections) {
1005 if (pThisConnection->name()==connstr) {
1006 // found existing connection - use that
1007 conn=pThisConnection.get();
1008 break;
1009 }
1010 }
1011 if (conn==nullptr) {
1012 // create new read-onlyconnection
1013 conn = m_connections.emplace_back(std::make_unique<IOVDbConn>(connstr,true,msg())).get();
1014 }
1015 } else {
1016 // no connection specified - use default if available
1017 if (!m_par_defaultConnection.empty()) {
1018 conn=m_connections[0].get();
1019 } else {
1020 ATH_MSG_FATAL( "Folder request " << folderdata.folderName() <<
1021 " gives no DB connection information and no default set" );
1022 return StatusCode::FAILURE;
1023 }
1024 }
1025
1026 // create the new folder, but only if a folder for this SG key has not
1027 // already been requested
1028
1029 std::string crestTag;
1030 if (m_par_source == "CREST"){
1031 crestTag = m_cresttagmap[folderdata.folderName()];
1032 if(crestTag.empty() && folderdata.folderName() != "/TagInfo") {
1033 ATH_MSG_FATAL( "GlobalTag "<< m_par_globalTag << " does not contain folder "
1034 << folderdata.folderName());
1035 crestError=true;
1036 continue;
1037 }
1038 }
1039
1040 auto folder=std::make_unique<IOVDbFolder>(conn,folderdata,msg(),&(*m_h_clidSvc), &(*m_h_metaDataTool),
1043 const std::string& key=folder->key();
1044 if (m_foldermap.find(key)==m_foldermap.end()) { //This check is too weak. For POOL-based folders, the SG key is in the folder description (not known at this point).
1045 m_foldermap[key]=std::move(folder);
1046 conn->incUsage();
1047 } else {
1048 ATH_MSG_ERROR( "Duplicate request for folder " <<
1049 folder->folderName() <<
1050 " associated to already requested Storegate key " << key );
1051 // clean up this duplicate request
1052 }
1053 }// end loop over folders
1054
1055 if(crestError)
1056 return StatusCode::FAILURE;
1057
1058 // check for folders to be written to metadata
1059 for (const auto & folderToWrite : m_par_foldersToWrite) {
1060 // match wildcard * at end of string only (i.e. /A/* matches /A/B, /A/C/D)
1061 std::string_view match=folderToWrite;
1062 std::string::size_type idx=folderToWrite.find('*');
1063 if (idx!=std::string::npos) {
1064 match=std::string_view(folderToWrite).substr(0,idx);
1065 }
1066 for (const auto & [name, folder] : m_foldermap) {
1067 if (folder->folderName().starts_with(match)) {
1068 folder->setWriteMeta();
1069 ATH_MSG_INFO( "Folder " << folder->folderName() << " will be written to file metadata" );
1070 }
1071 }//end loop over FolderMap
1072 }//end loop over m_par_foldersToWrite
1073 return StatusCode::SUCCESS;
1074}
1075
1076
1078 if (!m_par_globalTag.empty()) {
1079 ATH_MSG_DEBUG( "Adding GlobalTag " << m_par_globalTag << " into TagInfo" );
1080 ATH_CHECK( m_h_tagInfoMgr->addTag("IOVDbGlobalTag",m_par_globalTag) );
1081 }
1082 // add all explicit tags specified in folders
1083 // can be from Folders or tagOverrides properties
1084 for (const auto & [name, folder] : m_foldermap) {
1085 if (!folder->joTag().empty()) {
1086 ATH_MSG_DEBUG( "Adding folder " << folder->folderName() <<" tag " << folder->joTag() << " into TagInfo" );
1087 if (m_h_tagInfoMgr->addTag(folder->folderName(),folder->joTag()).isFailure())
1088 return StatusCode::FAILURE;
1089 }
1090 // check to see if any input TagInfo folder overrides should be removed
1091 // this anticipates the decisions which will be made in processTagInfo
1092 // Here we do not have access to the TagInfo object, but can put remove
1093 // requests in for all folders if the global tag is set, or if there is
1094 // an explict joboption tag, nooverride spec, or data comes from metadata
1095 if (!m_par_globalTag.empty() || !folder->joTag().empty() || folder->noOverride() ||
1096 folder->readMeta()) {
1097 if (m_h_tagInfoMgr->removeTagFromInput(folder->folderName()).isFailure()) {
1098 ATH_MSG_WARNING( "Could not add TagInfo remove request for "
1099 << folder->folderName() );
1100 } else {
1101 ATH_MSG_INFO( "Added taginfo remove for " << folder->folderName() );
1102 }
1103 }
1104 }
1105 return StatusCode::SUCCESS;
1106}
1107
1108
1109StatusCode IOVDbSvc::loadCaches(IOVDbConn* conn, const IOVTime* time) {
1110 // load the caches for all folders using the given connection
1111 // so connection use is optimised
1112
1113 Gaudi::Guards::AuditorGuard auditor(std::string("loadCachesOverhead:")+conn->name(), auditorSvc(), "preLoadProxy");
1114
1115 ATH_MSG_DEBUG( "loadCaches: Begin for connection " << conn->name());
1116 // if global abort already set, load nothing
1117 if (m_abort) return StatusCode::FAILURE;
1118 bool access=false;
1119 StatusCode sc=StatusCode::SUCCESS;
1120 for (const auto & [name, folder] : m_foldermap) {
1121 if (folder->conn()!=conn) continue;
1122 cool::ValidityKey vkey=folder->iovTime(time==nullptr ? m_iovTime : *time);
1123 // protect against out of range times (timestamp -1 happened in FDR2)
1124 if (vkey>cool::ValidityKeyMax) {
1125 ATH_MSG_WARNING( "Requested validity key " << vkey << " is out of range, reset to 0" );
1126 vkey=0;
1127 }
1128 if (!folder->cacheValid(vkey) && !folder->dropped()) {
1129 access=true;
1130 {
1131 Gaudi::Guards::AuditorGuard auditor(std::string("FldrCache:")+folder->folderName(), auditorSvc(), "preLoadProxy");
1132 if (!folder->loadCache(vkey,m_par_cacheAlign,m_globalTag,m_par_onlineMode)) {
1133 ATH_MSG_ERROR( "Cache load (prefetch) failed for folder " << folder->folderName() );
1134 // remember the failure, but also load other folders on this connection
1135 // while it is open
1136 sc=StatusCode::FAILURE;
1137 }
1138 }
1139 }
1140 }
1141 // disconnect from database if we connected
1142 if (access && m_par_manageConnections) conn->setInactive();
1143 // if connection aborted, set overall abort so we do not waste time trying
1144 // to read data from other schema
1145 if (conn->aborted()) {
1146 m_abort=true;
1147 throw GaudiException("Connection " + conn->name() + " was aborted",
1148 "IOVDbSvc::loadCache()", StatusCode::FAILURE);
1149 }
1150 return sc;
1151}
1152
1153
1155 // check consistency of global tag and database instance, if set
1156 // catch most common user misconfigurations
1157 // this is only done here as need global tag to be set even if read from file
1158 // @TODO should this not be done during initialize
1159
1160 if (!m_par_dbinst.empty() && !m_globalTag.empty() && m_par_source!="CREST") {
1161 const std::string_view tagstub = std::string_view(m_globalTag).substr(0,7);
1162 ATH_MSG_DEBUG( "Checking " << m_par_dbinst << " against " <<tagstub );
1163
1164 if ( ((m_par_dbinst=="COMP200" || m_par_dbinst=="CONDBR2") &&
1165 (tagstub!="COMCOND" && tagstub!="CONDBR2")) ||
1166 (m_par_dbinst=="OFLP200" && (tagstub!="OFLCOND" && tagstub!="CMCCOND")) ) {
1167
1168 ATH_MSG_FATAL( "Likely incorrect conditions DB configuration! " <<
1169 "Attached to database instance " << m_par_dbinst <<
1170 " but global tag begins " << tagstub );
1171 ATH_MSG_FATAL( "See Atlas/CoolTroubles wiki for details,"
1172 " or set IOVDbSvc.DBInstance=\"\" to disable check" );
1173 return StatusCode::FAILURE;
1174 }
1175 }
1176 return StatusCode::SUCCESS;
1177}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Header for CoralCrestManager class.
Common database lock.
const EventIDBase * EventIDFromStore(IProxyDict *store)
Retrieve the EventID from EventContext saved in store STORE.
uint32_t CLID
The Class ID type.
Athena service for Interval Of Validity database.
This class is a container for conditions data.
Validity Range object.
static Double_t sc
Incident sent after a store is cleared.
static const Attributes_t empty
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
Common database lock.
Definition DBLock.h:46
EventIDBase::number_type conditionsRun() const
static std::map< std::string, std::string > getGlobalTagMap(const std::string &crest_path, const std::string &globaltag)
void setInactive()
bool isValid() const
Definition IOVDbParser.h:67
virtual StatusCode finalize() override
Service finalize.
Definition IOVDbSvc.cxx:234
BooleanProperty m_par_managePoolConnections
Definition IOVDbSvc.h:188
StatusCode loadCaches(IOVDbConn *conn, const IOVTime *time=nullptr)
PublicToolHandle< IIOVDbMetaDataTool > m_h_metaDataTool
Definition IOVDbSvc.h:230
ServiceHandle< StoreGateSvc > m_h_sgSvc
Definition IOVDbSvc.h:224
Gaudi::Property< std::vector< std::string > > m_par_overrideTags
Definition IOVDbSvc.h:182
virtual void handle(const Incident &incident) override
Incident service handle for EndEvent.
Definition IOVDbSvc.cxx:738
Gaudi::Property< std::vector< std::string > > m_par_folders
Definition IOVDbSvc.h:180
virtual cool::IDatabasePtr getDatabase(bool readOnly) override
Access to COOL database for a given folder.
Definition IOVDbSvc.cxx:266
BooleanProperty m_crestCoolToFile
Definition IOVDbSvc.h:220
virtual bool dropObject(const std::string &key, const bool resetCache=false) override
Definition IOVDbSvc.cxx:829
IAddressProvider::tadList tadList
Definition IOVDbSvc.h:91
BooleanProperty m_outputToFile
Definition IOVDbSvc.h:219
BooleanProperty m_par_checklock
Definition IOVDbSvc.h:209
IntegerProperty m_par_forceLumiblockNumber
Definition IOVDbSvc.h:192
BooleanProperty m_par_manageConnections
Definition IOVDbSvc.h:186
virtual StatusCode preLoadAddresses(StoreID::type storeID, tadList &list) override
Get all addresses that the provider wants to preload in SG maps.
Definition IOVDbSvc.cxx:285
StatusCode io_finalize() override final
Definition IOVDbSvc.cxx:228
ServiceHandle< IAddressCreator > m_h_persSvc
Definition IOVDbSvc.h:227
bool m_abort
Definition IOVDbSvc.h:272
std::map< std::string, std::string > m_cresttagmap
Definition IOVDbSvc.h:215
StatusCode checkConfigConsistency() const
IOVTime m_iovTime
Definition IOVDbSvc.h:257
IntegerProperty m_par_maxNumPoolFiles
Definition IOVDbSvc.h:196
UnsignedIntegerProperty m_par_cacheAlign
Definition IOVDbSvc.h:205
StatusCode io_reinit() override final
Definition IOVDbSvc.cxx:220
IntegerProperty m_par_forceTimestamp
Definition IOVDbSvc.h:194
virtual StatusCode setRange(const CLID &clid, const std::string &dbKey, const IOVRange &range, const std::string &tag) override
Set range for a particular data object.
Definition IOVDbSvc.cxx:627
IntegerProperty m_par_cacheRun
Definition IOVDbSvc.h:200
@ FINALIZE_ALG
Definition IOVDbSvc.h:252
@ BEGIN_RUN
Definition IOVDbSvc.h:250
@ INITIALIZATION
Definition IOVDbSvc.h:249
@ EVENT_LOOP
Definition IOVDbSvc.h:251
virtual StatusCode initialize() override
Service init.
Definition IOVDbSvc.cxx:143
StatusCode checkEventSel()
Definition IOVDbSvc.cxx:857
virtual void postConditionsLoad() override
May be called once conditions are loaded to let IOVDbSvc release resources.
Definition IOVDbSvc.cxx:712
BooleanProperty m_par_onlineMode
Definition IOVDbSvc.h:207
ServiceHandle< StoreGateSvc > m_h_metaDataStore
Definition IOVDbSvc.h:226
ServiceHandle< IClassIDSvc > m_h_clidSvc
Definition IOVDbSvc.h:228
ServiceHandle< ITagInfoMgr > m_h_tagInfoMgr
Definition IOVDbSvc.h:231
Gaudi::Property< std::string > m_par_dbinst
Definition IOVDbSvc.h:178
virtual StatusCode signalBeginRun(const IOVTime &beginRunTime, const EventContext &ctx) override
Set time for begin run.
Definition IOVDbSvc.cxx:636
int m_poolSvcContext
Definition IOVDbSvc.h:240
ServiceHandle< IPoolSvc > m_h_poolSvc
Definition IOVDbSvc.h:229
StatusCode fillTagInfo()
int poolSvcContext()
Definition IOVDbSvc.cxx:123
bool m_poolPayloadRequested
Definition IOVDbSvc.h:236
StatusCode setupFolders()
Definition IOVDbSvc.cxx:918
ServiceHandle< StoreGateSvc > m_h_detStore
Definition IOVDbSvc.h:225
virtual bool getKeyInfo(const std::string &key, IIOVDbSvc::KeyInfo &info) override
Return information about SG key return false if this key is not known to IOVDbSvc.
Definition IOVDbSvc.cxx:808
Gaudi::Property< std::string > m_par_defaultConnection
Definition IOVDbSvc.h:174
virtual StatusCode loadAddresses(StoreID::type storeID, tadList &list) override
Get all new addresses from Provider for this Event.
Definition IOVDbSvc.cxx:410
virtual StatusCode updateAddress(StoreID::type storeID, SG::TransientAddress *tad, const EventContext &ctx) override
Update a transient Address.
Definition IOVDbSvc.cxx:416
IOVDbSvc_state m_state
Definition IOVDbSvc.h:254
virtual std::vector< std::string > getKeyList() override
Definition IOVDbSvc.cxx:801
virtual void signalEndProxyPreload() override
Signal that callback has been fired.
Definition IOVDbSvc.cxx:707
IntegerProperty m_par_cacheTime
Definition IOVDbSvc.h:202
Gaudi::Property< std::vector< std::string > > m_par_foldersToWrite
Definition IOVDbSvc.h:184
Gaudi::Property< std::string > m_par_globalTag
Definition IOVDbSvc.h:176
IntegerProperty m_par_forceRunNumber
Definition IOVDbSvc.h:190
StringProperty m_par_crestServer
Definition IOVDbSvc.h:213
virtual StatusCode processTagInfo() override
Process TagInfo.
Definition IOVDbSvc.cxx:760
StringProperty m_par_source
Definition IOVDbSvc.h:211
virtual StatusCode getRange(const CLID &clid, const std::string &dbKey, const IOVTime &time, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa) override
Get range for a particular data object identified by its clid and key and a requested IOVTime.
Definition IOVDbSvc.cxx:537
FloatProperty m_par_timeStampSlop
Definition IOVDbSvc.h:198
std::string m_globalTag
Definition IOVDbSvc.h:260
FolderMap m_foldermap
Definition IOVDbSvc.h:270
cool::ValidityKey m_iovslop
Definition IOVDbSvc.h:263
std::vector< std::unique_ptr< IOVDbConn > > m_connections
Definition IOVDbSvc.h:266
std::map< std::string, std::unique_ptr< IOVDbFolder > > FolderMap
Definition IOVDbSvc.h:269
ServiceHandle< IIOVSvc > m_h_IOVSvc
Definition IOVDbSvc.h:223
Validity Range object.
Definition IOVRange.h:30
Basic time unit for IOVSvc.
Definition IOVTime.h:33
static constexpr uint64_t MAXTIMESTAMP
Definition IOVTime.h:58
static constexpr uint32_t MAXRUN
Definition IOVTime.h:48
void setRETime(uint64_t time) noexcept
Definition IOVTime.cxx:84
void setRunEvent(uint32_t run, uint32_t event) noexcept
Definition IOVTime.cxx:96
static constexpr uint32_t MINEVENT
Definition IOVTime.h:50
static constexpr uint64_t MINTIMESTAMP
Definition IOVTime.h:56
void setTimestamp(uint64_t timestamp) noexcept
Definition IOVTime.cxx:72
uint32_t run() const noexcept
Definition IOVTime.h:105
static constexpr uint32_t MAXEVENT
Definition IOVTime.h:51
static constexpr uint32_t MINRUN
Definition IOVTime.h:44
std::vector< NameTagPair > NameTagPairVec
Definition ITagInfoMgr.h:66
a const_iterator facade to DataHandle.
Definition SGIterator.h:164
CLID clID() const
Retrieve string key:
const std::string & name() const
Get the primary (hashed) SG key.
void setAddress(CxxUtils::RefCountedPtr< IOpaqueAddress > pAddress)
Retrieve primary clid.
Incident sent after a store is cleared.
const StoreGateSvc * store() const
Return the store that was cleared.
@ DETECTOR_STORE
Definition StoreID.h:27
void commit()
Save catalog to file.
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:93
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:359
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
openDatabase(dbstring)
Filled by IIOVDbSvc::getKeyInfo.
Definition IIOVDbSvc.h:44
MsgStream & msg
Definition testRead.cxx:32
int run(int argc, char *argv[])