ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
RDBAccessSvc Class Referencefinal

RDBAccessSvc is the implementation of IRDBAccessSvc interface. More...

#include <RDBAccessSvc.h>

Inheritance diagram for RDBAccessSvc:
Collaboration diagram for RDBAccessSvc:

Public Member Functions

 RDBAccessSvc (const std::string &name, ISvcLocator *svc)
 Standard Service Constructor. More...
 
StatusCode initialize () override
 
StatusCode finalize () override
 
StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface) override
 
bool connect (const std::string &connName) override
 Connect to the relational DB. More...
 
bool disconnect (const std::string &connName) override
 If the counnection counter==1 closes the connection. More...
 
bool shutdown (const std::string &connName) override
 Closes the connection regardless of the counter value. More...
 
IRDBRecordset_ptr getRecordsetPtr (const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD") override
 Provides access to the Recordset object containing HVS-tagged data. More...
 
std::string getChildTag (const std::string &childNode, const std::string &parentTag, const std::string &parentNode, const std::string &connName) override
 Gets the tag name for the node by giving its parent node tag. More...
 
std::string getChildTag (const std::string &childNode, const std::string &parentTag, const std::string &parentNode, const std::string &connName, bool force)
 
std::unique_ptr< IRDBQuerygetQuery (const std::string &node, const std::string &tag, const std::string &tag2node, const std::string &connName) override
 
void getTagDetails (RDBTagDetails &tagDetails, const std::string &tag, const std::string &connName="ATLASDD") override
 Returns AttributeList with tag details Attributes in the list: Locked (bool), Supported (bool) More...
 
void getAllLeafNodes (std::vector< std::string > &list, const std::string &connName="ATLASDD")
 
std::vector< std::string > getLockedSupportedTags (const std::string &supportedFlag, const std::string &connName="ATLASDD")
 
coral::ISessionProxy * getSession (const std::string &connName="ATLASDD")
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Retrieve interface ID. More...
 

Private Member Functions

bool shutdown_connection (const std::string &connName)
 

Private Attributes

SessionMap m_sessions
 
std::map< std::string, unsigned int > m_openConnections
 
RecordsetPtrsByConn m_recordsetptrs
 
GlobalTagLookupMap m_globalTagLookup
 
std::mutex m_recordsetMutex
 
std::mutex m_sessionMutex
 

Friends

class SvcFactory< RDBAccessSvc >
 

Detailed Description

RDBAccessSvc is the implementation of IRDBAccessSvc interface.

Definition at line 58 of file RDBAccessSvc.h.

Constructor & Destructor Documentation

◆ RDBAccessSvc()

RDBAccessSvc::RDBAccessSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Standard Service Constructor.

Definition at line 37 of file RDBAccessSvc.cxx.

39 {
40 }

Member Function Documentation

◆ connect()

bool RDBAccessSvc::connect ( const std::string &  connName)
overridevirtual

Connect to the relational DB.

If this method is called for already open connection the connection counter is incremented.

Returns
success/failure

Implements IRDBAccessSvc.

Definition at line 42 of file RDBAccessSvc.cxx.

43 {
44  std::scoped_lock<std::mutex> guard(m_sessionMutex);
45  // Check if it is the first attempt to open a connection connName
46  if(m_sessions.find(connName)==m_sessions.end()) {
47  ATH_MSG_DEBUG(" Trying to open the connection " << connName << " for the first time");
48  // Add initial entries for this connection to three maps
49  // 1. Sessions
50  // 2. open connections
51  // 3. Recordset by connection
52  m_sessions[connName] = nullptr;
53  m_openConnections[connName] = 0;
54  m_recordsetptrs.emplace(connName,RecordsetPtrMap());
55  }
56 
57  // Use existing Connection Proxy if available
58  if(m_openConnections[connName]++) {
59  ATH_MSG_DEBUG(" Connection " << connName << " already open, sessions = " << m_openConnections[connName]);
60  return true;
61  }
62 
63  // Request new connection proxy from the Connection Service
64  coral::ConnectionService conSvcH;
65  coral::ISessionProxy *proxy = nullptr;
66  try {
67  proxy = conSvcH.connect(connName,coral::ReadOnly);
68  proxy->transaction().start(true);
69  ATH_MSG_DEBUG("Proxy for connection " << connName << " obtained");
70  }
71  catch(std::exception& e) {
72  ATH_MSG_ERROR("Exception caught: " << e.what());
73  m_openConnections[connName]--;
74  return false;
75  }
76 
77  m_sessions[connName] = proxy;
78 
79  return true;
80 }

◆ disconnect()

bool RDBAccessSvc::disconnect ( const std::string &  connName)
overridevirtual

If the counnection counter==1 closes the connection.

Decrements the connection counter value otherwise.

Returns
success/failure

Implements IRDBAccessSvc.

Definition at line 82 of file RDBAccessSvc.cxx.

83 {
84  auto connection = m_openConnections.find(connName);
85  if(connection==m_openConnections.end()) {
86  ATH_MSG_ERROR("Wrong name for the connection: " << connName);
87  return false;
88  }
89 
90  std::scoped_lock<std::mutex> guard(m_sessionMutex);
91  if(connection->second>0) {
92  connection->second--;
93 
94  ATH_MSG_DEBUG("Connection " << connName << " Sessions = " << connection->second);
95 
96  if(connection->second==0) {
97  auto session = m_sessions.find(connName);
98  if(session!=m_sessions.end()) {
99  session->second->transaction().commit();
100  delete session->second;
101  session->second = nullptr;
102  }
103 
104  ATH_MSG_DEBUG(connName << " Disconnected!");
105  }
106  }
107  return true;
108 }

◆ finalize()

StatusCode RDBAccessSvc::finalize ( )
override

Definition at line 507 of file RDBAccessSvc.cxx.

508 {
509  m_recordsetptrs.clear();
510 
511  // Clear global tag lookup table
512  for(auto& [lookupName,lookup] : m_globalTagLookup) {
513  delete lookup;
514  }
515  m_globalTagLookup.clear();
516 
517  // Shut down all connections
518  for(auto& [sessionName,session] : m_sessions) {
519  shutdown(sessionName);
520  }
521 
522  return StatusCode::SUCCESS;
523 }

◆ getAllLeafNodes()

void RDBAccessSvc::getAllLeafNodes ( std::vector< std::string > &  list,
const std::string &  connName = "ATLASDD" 
)

Definition at line 415 of file RDBAccessSvc.cxx.

417 {
418  list.clear();
419  if(!connect(connName)) {
420  ATH_MSG_ERROR("Failed to open Connection " << connName);
421  return;
422  }
423 
424  coral::ISessionProxy* session = m_sessions[connName];
425  try {
426  coral::ITable& tableNode = session->nominalSchema().tableHandle("HVS_NODE");
427  coral::IQuery *queryNode = tableNode.newQuery();
428  queryNode->addToOutputList("NODE_NAME");
429  queryNode->setMemoryCacheSize(1);
431  queryNode->setCondition("BRANCH_FLAG=0", empty);
432  queryNode->addToOrderList("NODE_NAME");
433 
434  coral::ICursor& cursorNode = queryNode->execute();
435  while(cursorNode.next()) {
436  list.push_back(cursorNode.currentRow()["NODE_NAME"].data<std::string>());
437  }
438 
439  delete queryNode;
440  }
441  catch(coral::SchemaException& se) {
442  ATH_MSG_INFO("Schema Exception : " << se.what());
443  }
444  catch(std::exception& e) {
445  ATH_MSG_ERROR(e.what());
446  }
447  catch(...) {
448  ATH_MSG_ERROR("Exception caught(...)");
449  }
450 
451  disconnect(connName);
452 }

◆ getChildTag() [1/2]

std::string RDBAccessSvc::getChildTag ( const std::string &  childNode,
const std::string &  parentTag,
const std::string &  parentNode,
const std::string &  connName 
)
overridevirtual

Gets the tag name for the node by giving its parent node tag.

Parameters
childNode[IN] name of the child node
parentTag[IN] name of the parent tag
parentNode[IN] name of the parent node
fetchData[IN] if true fetch the corresponding data this parameter has no sence if child is the branch node

Implements IRDBAccessSvc.

Definition at line 271 of file RDBAccessSvc.cxx.

275 {
276  return getChildTag(childNode
277  , parentTag
278  , parentNode
279  , connName
280  , false);
281 }

◆ getChildTag() [2/2]

std::string RDBAccessSvc::getChildTag ( const std::string &  childNode,
const std::string &  parentTag,
const std::string &  parentNode,
const std::string &  connName,
bool  force 
)

Definition at line 283 of file RDBAccessSvc.cxx.

288 {
289  ATH_MSG_DEBUG("getChildTag for " << childNode << " " << parentTag << " " << parentNode);
290  Athena::DBLock dblock;
291  std::scoped_lock<std::mutex> guard(m_recordsetMutex);
292 
293  // Check lookup table first
294  std::string lookupMapKey = parentTag + "::" + connName;
295  GlobalTagLookupMap::const_iterator lookupmap = m_globalTagLookup.find(lookupMapKey);
296  if(lookupmap!=m_globalTagLookup.end()) {
297  TagNameIdByNode::const_iterator childtagdet = lookupmap->second->find(childNode);
298  if(childtagdet!=lookupmap->second->end()) {
299  return childtagdet->second.first;
300  }
301  else {
302  if(!force) {
303  return std::string("");
304  }
305  }
306  }
307 
308  if(!connect(connName)) {
309  ATH_MSG_ERROR("Unable to open connection " << connName << ". Returning empty string");
310  return std::string("");
311  }
312 
313  std::string childTag("");
314  try {
315  // We don't have lookup table for given parent tag. Go into slow mode through Version Accessor
316  coral::ISessionProxy* session = m_sessions[connName];
317  RDBVersionAccessor versionAccessor(childNode,parentNode,parentTag,session,msg());
318  versionAccessor.getChildTagData();
319 
320  childTag = versionAccessor.getTagName();
321  }
322  catch(coral::SchemaException& se) {
323  ATH_MSG_ERROR("Schema Exception : " << se.what());
324  }
325  catch(std::exception& e) {
326  ATH_MSG_ERROR(e.what());
327  }
328  catch(...) {
329  ATH_MSG_ERROR("Exception caught(...)");
330  }
331 
332  disconnect(connName);
333 
334  return childTag;
335 }

◆ getLockedSupportedTags()

std::vector< std::string > RDBAccessSvc::getLockedSupportedTags ( const std::string &  supportedFlag,
const std::string &  connName = "ATLASDD" 
)

Definition at line 454 of file RDBAccessSvc.cxx.

456 {
457  std::vector<std::string> taglist;
458  if(!connect(connName)) {
459  ATH_MSG_ERROR("Failed to open connection " << connName);
460  }
461  else {
462  try{
463  coral::ISessionProxy* session = m_sessions[connName];
464 
465  coral::ITable& tableTag2Node = session->nominalSchema().tableHandle("HVS_TAG2NODE");
466  coral::IQuery* queryTag2Node = tableTag2Node.newQuery();
467  queryTag2Node->addToOutputList("TAG_NAME");
468  queryTag2Node->setMemoryCacheSize(1);
470  std::string condString = std::string("NODE_ID=0 AND LOCKED=1 AND SUPPORTED>=")+supportedFlag;
471  queryTag2Node->setCondition(condString,empty);
472  queryTag2Node->addToOrderList("TAG_NAME");
473 
474  coral::ICursor& cursorTagName = queryTag2Node->execute();
475  while(cursorTagName.next()) {
476  const coral::AttributeList& row = cursorTagName.currentRow();
477  taglist.push_back(row["TAG_NAME"].data<std::string>());
478  }
479  delete queryTag2Node;
480 
481  }
482  catch(coral::SchemaException& se) {
483  ATH_MSG_ERROR("Schema Exception : " << se.what());
484  }
485  catch(std::exception& e) {
486  ATH_MSG_ERROR(e.what());
487  }
488  catch(...) {
489  ATH_MSG_ERROR("Exception caught(...)");
490  }
491  }
492  disconnect(connName);
493  return taglist;
494 }

◆ getQuery()

std::unique_ptr< IRDBQuery > RDBAccessSvc::getQuery ( const std::string &  node,
const std::string &  tag,
const std::string &  tag2node,
const std::string &  connName 
)
overridevirtual

Implements IRDBAccessSvc.

Definition at line 215 of file RDBAccessSvc.cxx.

219 {
220  ATH_MSG_DEBUG("getQuery (" << node << "," << tag << "," << tag2node << "," << connName << ")");
221  Athena::DBLock dblock;
222  std::scoped_lock<std::mutex> guard(m_recordsetMutex);
223 
224  std::unique_ptr<IRDBQuery> query;
225 
226  if(!connect(connName)) {
227  ATH_MSG_ERROR("Unable to open connection " << connName << ". Returning nullptr to IRDBQuery");
228  return query;
229  }
230 
231  coral::ISessionProxy* session = m_sessions[connName];
232 
233  try {
234  // Check lookup table first
235  std::string childTagId("");
236  std::string lookupMapKey = tag + "::" + connName;
237  GlobalTagLookupMap::const_iterator lookupmap = m_globalTagLookup.find(lookupMapKey);
238  if(lookupmap!=m_globalTagLookup.end()) {
239  TagNameIdByNode::const_iterator childtagdet = lookupmap->second->find(node);
240  if(childtagdet!=lookupmap->second->end()) {
241  childTagId = childtagdet->second.second;
242  }
243  }
244  else {
245  RDBVersionAccessor versionAccessor{node,(tag2node.empty()?node:tag2node),tag,session,msg()};
246  versionAccessor.getChildTagData();
247  childTagId = versionAccessor.getTagID();
248  }
249 
250  if(childTagId.empty()) {
251  ATH_MSG_WARNING("Could not get the tag for " << node << " node. Returning 0 pointer to IRDBQuery");
252  }
253  else {
254  query = std::unique_ptr<IRDBQuery>(new RDBQuery(dblock,this,node,childTagId,connName));
255  }
256  }
257  catch(coral::SchemaException& se) {
258  ATH_MSG_ERROR("Schema Exception : " << se.what());
259  }
260  catch(std::exception& e) {
261  ATH_MSG_ERROR(e.what());
262  }
263  catch(...) {
264  ATH_MSG_ERROR("Exception caught(...)");
265  }
266 
267  disconnect(connName);
268  return query;
269 }

◆ getRecordsetPtr()

IRDBRecordset_ptr RDBAccessSvc::getRecordsetPtr ( const std::string &  node,
const std::string &  tag,
const std::string &  tag2node = "",
const std::string &  connName = "ATLASDD" 
)
overridevirtual

Provides access to the Recordset object containing HVS-tagged data.

Parameters
node[IN] name of the leaf HVS node
tag[IN] tag of the HVS node specified by node parameter if tag2node is omitted, tag of the HVS branch node specified by tag2node otherwise
tag2node[IN] some parent of the HVS leaf node specified by node parameter
Returns
pointer to the recordset object

Implements IRDBAccessSvc.

Definition at line 150 of file RDBAccessSvc.cxx.

154 {
155  std::string key = node + "::" + tag;
156  if(tag2node!="")
157  key += ("::" + tag2node);
158 
159  ATH_MSG_DEBUG("Getting RecordsetPtr with key " << key);
160 
161  Athena::DBLock dblock;
162  std::scoped_lock<std::mutex> guard(m_recordsetMutex);
163 
164  RecordsetPtrMap& recordsets = m_recordsetptrs[connName];
165  RecordsetPtrMap::const_iterator it = recordsets.find(key);
166  if(it != recordsets.end()) {
167  ATH_MSG_DEBUG("Reusing existing recordset");
168  return it->second;
169  }
170 
171  if(!connect(connName)) {
172  ATH_MSG_ERROR("Unable to open connection " << connName << ". Returning empty recordset");
173  return IRDBRecordset_ptr(new RDBRecordset(this));
174  }
175 
176  RDBRecordset* recConcrete = new RDBRecordset(this);
177  IRDBRecordset_ptr rec(recConcrete);
178  coral::ISessionProxy* session = m_sessions[connName];
179 
180  try {
181  // Check lookup table first
182  std::string lookupMapKey = tag + "::" + connName;
183  GlobalTagLookupMap::const_iterator lookupmap = m_globalTagLookup.find(lookupMapKey);
184  if(lookupmap!=m_globalTagLookup.end()) {
185  TagNameIdByNode::const_iterator childtagdet = lookupmap->second->find(node);
186  if(childtagdet!=lookupmap->second->end()) {
187  recConcrete->getData(session,node,childtagdet->second.first,childtagdet->second.second);
188  }
189  else {
190  recConcrete->setNodeName(node);
191  ATH_MSG_DEBUG("Unable to find tag for the node " << node << " in the cache of global tag " << tag << ". Returning empty recordset");
192  }
193  }
194  else {
195  RDBVersionAccessor versionAccessor(node,(tag2node.empty()?node:tag2node),tag,session,msg());
196  versionAccessor.getChildTagData();
197  recConcrete->getData(session,versionAccessor.getNodeName(),versionAccessor.getTagName(),versionAccessor.getTagID());
198  }
199  }
200  catch(coral::SchemaException& se) {
201  ATH_MSG_ERROR("Schema Exception : " << se.what());
202  }
203  catch(std::exception& e) {
204  ATH_MSG_ERROR(e.what());
205  }
206  catch(...) {
207  ATH_MSG_ERROR("Exception caught(...)");
208  }
209 
210  recordsets.emplace(key,rec);
211  disconnect(connName);
212  return rec;
213 }

◆ getSession()

coral::ISessionProxy * RDBAccessSvc::getSession ( const std::string &  connName = "ATLASDD")

Definition at line 496 of file RDBAccessSvc.cxx.

497 {
498  auto sessionIt = m_sessions.find(connName);
499  return sessionIt == m_sessions.end() ? nullptr : sessionIt->second;
500 }

◆ getTagDetails()

void RDBAccessSvc::getTagDetails ( RDBTagDetails tagDetails,
const std::string &  tag,
const std::string &  connName = "ATLASDD" 
)
overridevirtual

Returns AttributeList with tag details Attributes in the list: Locked (bool), Supported (bool)

Parameters
tagDetails[OUT] attribute list with tag details
tag[IN] name of the tag

Implements IRDBAccessSvc.

Definition at line 337 of file RDBAccessSvc.cxx.

340 {
341  ATH_MSG_DEBUG("getTagDetails for tag: " << tag);
342  Athena::DBLock dblock;
343  std::scoped_lock<std::mutex> guard(m_recordsetMutex);
344 
345  if(!connect(connName)) {
346  ATH_MSG_ERROR("Failed to open connection " << connName);
347  }
348 
349  coral::ISessionProxy* session = m_sessions[connName];
350  try {
351  coral::ITable& tableTag2Node = session->nominalSchema().tableHandle("HVS_TAG2NODE");
352  coral::IQuery *queryTag2Node = tableTag2Node.newQuery();
353  queryTag2Node->addToOutputList("LOCKED");
354  queryTag2Node->addToOutputList("SUPPORTED");
355  queryTag2Node->setMemoryCacheSize(1);
357  bindsTag2Node.extend<std::string>("tagN");
358  queryTag2Node->setCondition("TAG_NAME=:tagN", bindsTag2Node);
359  bindsTag2Node[0].data<std::string>() = tag;
360 
361  coral::ICursor& cursorTag2Node = queryTag2Node->execute();
362  if(cursorTag2Node.next()) {
363  tagDetails = cursorTag2Node.currentRow();
364  }
365 
366  delete queryTag2Node;
367 
368  // Build lookup table for the given global tag if has not been built yet
369  std::string lookupMapKey = tag + "::" + connName;
370  if(m_globalTagLookup.find(lookupMapKey)==m_globalTagLookup.end()) {
371  // Get tag contents from the database
373 
374  coral::ITable& tableRootTag2Child = session->nominalSchema().tableHandle("HVS_TAGCACHE");
375  coral::IQuery* queryRootTag2Child = tableRootTag2Child.newQuery();
376  queryRootTag2Child->addToOutputList("CHILDNODE");
377  queryRootTag2Child->addToOutputList("CHILDTAG");
378  queryRootTag2Child->addToOutputList("CHILDTAGID");
379  queryRootTag2Child->setMemoryCacheSize(1);
380  coral::AttributeList bindsRootTag2Child ATLAS_THREAD_SAFE;
381  bindsRootTag2Child.extend<std::string>("tagN");
382  queryRootTag2Child->setCondition("ROOTTAG=:tagN", bindsRootTag2Child);
383  bindsRootTag2Child[0].data<std::string>() = tag;
384  queryRootTag2Child->addToOrderList("CHILDNODE");
385 
386  coral::ICursor& cursorRootTag2Child = queryRootTag2Child->execute();
387  while(cursorRootTag2Child.next()) {
388  const coral::AttributeList& row = cursorRootTag2Child.currentRow();
389  (*lookup)[row["CHILDNODE"].data<std::string>()]=std::make_pair(row["CHILDTAG"].data<std::string>(),std::to_string(row["CHILDTAGID"].data<long long>()));
390  }
391 
392  delete queryRootTag2Child;
393 
394  if(lookup->size()>0) {
395  m_globalTagLookup[lookupMapKey]=lookup;
396  }
397  else {
398  delete lookup;
399  }
400  }
401  }
402  catch(coral::SchemaException& se) {
403  ATH_MSG_INFO("Schema Exception : " << se.what());
404  }
405  catch(std::exception& e) {
406  ATH_MSG_ERROR(e.what());
407  }
408  catch(...) {
409  ATH_MSG_ERROR("Exception caught(...)");
410  }
411 
412  disconnect(connName);
413 }

◆ initialize()

StatusCode RDBAccessSvc::initialize ( )
override

Definition at line 502 of file RDBAccessSvc.cxx.

503 {
504  return StatusCode::SUCCESS;
505 }

◆ interfaceID()

static const InterfaceID& RDBAccessSvc::interfaceID ( )
inlinestatic

Retrieve interface ID.

Definition at line 71 of file RDBAccessSvc.h.

71 { return IID_IRDBAccessSvc; }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Service >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Service >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Service >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ queryInterface()

StatusCode RDBAccessSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
override

Definition at line 525 of file RDBAccessSvc.cxx.

526 {
527  if (IID_IRDBAccessSvc == riid) {
528  *ppvInterface = (IRDBAccessSvc*)this;
529  }
530  else {
531  return AthService::queryInterface(riid, ppvInterface);
532  }
533 
534  addRef();
535  return StatusCode::SUCCESS;
536 }

◆ shutdown()

bool RDBAccessSvc::shutdown ( const std::string &  connName)
overridevirtual

Closes the connection regardless of the counter value.

Returns
success/failure

Implements IRDBAccessSvc.

Definition at line 110 of file RDBAccessSvc.cxx.

111 {
112  if(connName=="*Everything*") {
113  for(const auto& ii : m_openConnections) {
114  if(ii.second != 0) {
115  ATH_MSG_INFO("Close everything: Connection: " << ii.first << " with reference count = " << ii.second << " will be closed.");
116  if(!shutdown_connection(ii.first)) {
117  return false;
118  }
119  }
120  }
121  return true;
122  }
123 
124  return shutdown_connection(connName);
125 }

◆ shutdown_connection()

bool RDBAccessSvc::shutdown_connection ( const std::string &  connName)
private

Definition at line 127 of file RDBAccessSvc.cxx.

128 {
129  auto connection = m_openConnections.find(connName);
130  if(connection==m_openConnections.end()) {
131  ATH_MSG_ERROR("Wrong name for the connection: " << connName);
132  return false;
133  }
134  std::scoped_lock<std::mutex> guard(m_sessionMutex);
135  connection->second = 0;
136 
137  auto session = m_sessions.find(connName);
138  if(session!=m_sessions.end()
139  && session->second) {
140  session->second->transaction().commit();
141  delete session->second;
142  session->second = nullptr;
143  }
144 
145  ATH_MSG_DEBUG(connName << " Disconnected!");
146 
147  return true;
148 }

Friends And Related Function Documentation

◆ SvcFactory< RDBAccessSvc >

friend class SvcFactory< RDBAccessSvc >
friend

Definition at line 66 of file RDBAccessSvc.h.

Member Data Documentation

◆ m_globalTagLookup

GlobalTagLookupMap RDBAccessSvc::m_globalTagLookup
private

Definition at line 138 of file RDBAccessSvc.h.

◆ m_openConnections

std::map<std::string, unsigned int> RDBAccessSvc::m_openConnections
private

Definition at line 135 of file RDBAccessSvc.h.

◆ m_recordsetMutex

std::mutex RDBAccessSvc::m_recordsetMutex
private

Definition at line 140 of file RDBAccessSvc.h.

◆ m_recordsetptrs

RecordsetPtrsByConn RDBAccessSvc::m_recordsetptrs
private

Definition at line 137 of file RDBAccessSvc.h.

◆ m_sessionMutex

std::mutex RDBAccessSvc::m_sessionMutex
private

Definition at line 141 of file RDBAccessSvc.h.

◆ m_sessions

SessionMap RDBAccessSvc::m_sessions
private

Definition at line 134 of file RDBAccessSvc.h.


The documentation for this class was generated from the following files:
AthService::AthService
AthService()
RDBAccessSvc::getChildTag
std::string getChildTag(const std::string &childNode, const std::string &parentTag, const std::string &parentNode, const std::string &connName) override
Gets the tag name for the node by giving its parent node tag.
Definition: RDBAccessSvc.cxx:271
query_example.row
row
Definition: query_example.py:24
RDBQuery
RDBQuery is an implementation of IRDBQuery interface.
Definition: RDBQuery.h:30
RDBAccessSvc::m_recordsetMutex
std::mutex m_recordsetMutex
Definition: RDBAccessSvc.h:140
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
TileRawChannelBuilderOpt2::lookup
const unsigned short lookup[2401]
Definition: TileRawChannelBuilderOpt2FilterLookup.h:21
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
calibdata.force
bool force
Definition: calibdata.py:19
RecordsetPtrMap
std::map< std::string, IRDBRecordset_ptr > RecordsetPtrMap
Definition: RDBAccessSvc.h:34
skel.it
it
Definition: skel.GENtoEVGEN.py:423
RDBAccessSvc::connect
bool connect(const std::string &connName) override
Connect to the relational DB.
Definition: RDBAccessSvc.cxx:42
CheckTagAssociation.taglist
taglist
Definition: CheckTagAssociation.py:103
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
keylayer_zslicemap.se
se
Definition: keylayer_zslicemap.py:194
TagNameIdByNode
std::map< std::string, TagNameId > TagNameIdByNode
Definition: RDBAccessSvc.h:48
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
RDBVersionAccessor
RDBVersionAccessor is a helper class navigating HVS tree and getting child node tag by the tag of one...
Definition: RDBVersionAccessor.h:37
query
Definition: query.py:1
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Athena::DBLock
Common database lock.
Definition: DBLock.h:46
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition: IRDBAccessSvc.h:45
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
RDBAccessSvc::m_globalTagLookup
GlobalTagLookupMap m_globalTagLookup
Definition: RDBAccessSvc.h:138
calibdata.exception
exception
Definition: calibdata.py:496
RDBAccessSvc::shutdown
bool shutdown(const std::string &connName) override
Closes the connection regardless of the counter value.
Definition: RDBAccessSvc.cxx:110
RDBAccessSvc::m_sessionMutex
std::mutex m_sessionMutex
Definition: RDBAccessSvc.h:141
RDBAccessSvc::m_sessions
SessionMap m_sessions
Definition: RDBAccessSvc.h:134
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
RDBAccessSvc::m_recordsetptrs
RecordsetPtrsByConn m_recordsetptrs
Definition: RDBAccessSvc.h:137
PyPoolBrowser.node
node
Definition: PyPoolBrowser.py:131
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
query_example.query
query
Definition: query_example.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
RDBRecordset::getData
void getData(coral::ISessionProxy *session, const std::string &nodeName, const std::string &tagName, const std::string &tagId)
Constructs SQL query and retrieves the data from DB.
Definition: RDBRecordset.cxx:39
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonMsg< Service >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
RDBRecordset::setNodeName
void setNodeName(const std::string &nodeName)
Definition: RDBRecordset.cxx:263
RDBAccessSvc::shutdown_connection
bool shutdown_connection(const std::string &connName)
Definition: RDBAccessSvc.cxx:127
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
RDBAccessSvc::m_openConnections
std::map< std::string, unsigned int > m_openConnections
Definition: RDBAccessSvc.h:135
node
Definition: memory_hooks-stdcmalloc.h:74
RDBAccessSvc::disconnect
bool disconnect(const std::string &connName) override
If the counnection counter==1 closes the connection.
Definition: RDBAccessSvc.cxx:82
RDBRecordset
RDBRecordset is an implementation of IRDBRecordset interface.
Definition: RDBRecordset.h:39
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37