#include <DBReplicaSvc.h>
Definition at line 16 of file DBReplicaSvc.h.
◆ ServerMap
◆ ServerPair
◆ DBReplicaSvc()
DBReplicaSvc::DBReplicaSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
svc |
|
) |
| |
◆ ~DBReplicaSvc()
DBReplicaSvc::~DBReplicaSvc |
( |
| ) |
|
|
virtual |
◆ finalize()
StatusCode DBReplicaSvc::finalize |
( |
| ) |
|
|
virtual |
◆ initialize()
StatusCode DBReplicaSvc::initialize |
( |
| ) |
|
|
virtual |
Definition at line 51 of file DBReplicaSvc.cxx.
58 const char* chost=
getenv(
"ATLAS_CONDDB");
63 const char* chost=
getenv(
"HOSTNAME");
68 <<
" has no domain - try hostname --fqdn");
71 system(
"hostname --fqdn > hostnamelookup.tmp");
74 system(
"hostname > hostnamelookup.tmp");
77 infile.open(
"hostnamelookup.tmp");
87 const char* cfrontier=
getenv(
"FRONTIER_SERVER");
90 <<
" will be considered for COOL data");
97 ATH_MSG_INFO (
"COOL SQLite replicas will be excluded if matching pattern "
101 ATH_MSG_INFO (
"COOL Frontier replicas will be excluded");
103 ATH_MSG_INFO (
"Geometry SQLite replicas will be excluded");
105 ATH_MSG_INFO (
"Failover to secondary replicas disabled");
◆ interfaceID()
const InterfaceID & IDBReplicaSvc::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
Definition at line 20 of file IDBReplicaSvc.h.
21 static const InterfaceID IID_IDBReplicaSvc(
"IDBReplicaSvc",1,0);
22 return IID_IDBReplicaSvc;
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ queryInterface()
StatusCode DBReplicaSvc::queryInterface |
( |
const InterfaceID & |
riid, |
|
|
void ** |
ppvInterface |
|
) |
| |
|
virtual |
Definition at line 41 of file DBReplicaSvc.cxx.
46 return AthService::queryInterface(riid,ppvInterface);
48 return StatusCode::SUCCESS;
◆ readConfig()
StatusCode DBReplicaSvc::readConfig |
( |
| ) |
|
|
private |
Definition at line 113 of file DBReplicaSvc.cxx.
120 return StatusCode::FAILURE;
124 FILE* p_inp=fopen(
file.c_str(),
"r");
127 return StatusCode::FAILURE;
130 const unsigned int bufsize=999;
132 while (!feof(p_inp)) {
133 char* p_line=fgets(p_buf,bufsize,p_inp);
134 if (p_line!=NULL && p_line[0]!=
'#') {
135 std::string
buf=std::string(p_line);
136 std::string::size_type iofs1=0;
139 std::vector<std::string> domains;
140 std::vector<std::string> servers;
141 while (iofs1<
buf.size()) {
142 std::string::size_type iofs2=
buf.find(
' ',iofs1);
144 if (iofs2==std::string::npos) iofs2=
buf.size()-1;
145 std::string token=
buf.substr(iofs1,iofs2-iofs1);
147 if (token!=
"" && token!=
" ") {
150 }
else if (!sequal) {
152 domains.push_back(token);
155 if (!
m_nofailover || servers.size()==0 || token==
"atlas_dd")
156 servers.push_back(token);
164 unsigned int bestlen=0;
165 for (std::vector<std::string>::const_iterator itr=domains.begin();
166 itr!=domains.end();++itr) {
167 std::string::size_type len=(itr->size());
168 std::string::size_type hlen=
m_hostname.size();
169 if (hlen>=len && *itr==
m_hostname.substr(hlen-len,len)) {
178 ATH_MSG_INFO (
"No specific match for domain found - use default fallback");
186 for (
unsigned int i=0;
i<servers.size();++
i) {
203 " servers found for host " <<
m_hostname <<
" [";
204 for (ServerMap::const_iterator itr=
m_servermap.begin();
207 return StatusCode::SUCCESS;
◆ sort()
void DBReplicaSvc::sort |
( |
std::vector< const coral::IDatabaseServiceDescription * > & |
replicaSet | ) |
|
Definition at line 210 of file DBReplicaSvc.cxx.
215 if (replicaSet.size()<=1)
return;
218 std::map<int,const coral::IDatabaseServiceDescription*> primap;
219 for (std::vector<const coral::IDatabaseServiceDescription*>::const_iterator
220 itr=replicaSet.begin();itr!=replicaSet.end();++itr) {
221 const std::string
conn=(**itr).connectionString();
223 if (
conn.find(
"sqlite_file")!=std::string::npos) {
232 &&
conn.find(
"ALLP")!=std::string::npos)
236 &&
conn.find(
"geomDB")!=std::string::npos))) {
240 if (
conn.find(
"sqlite_file:/")!=std::string::npos ||
241 conn.find(
"DBRelease")!=std::string::npos) {
251 if (
conn.find(
"frontier:")!=std::string::npos) {
261 std::string::size_type ipos1=
conn.find(
"://");
262 std::string::size_type ipos2=
conn.find(
'/',ipos1+3);
265 std::string::size_type ipos3=
conn.find(
'(',ipos1+3);
266 if (ipos3!=std::string::npos && ipos3<ipos2) ipos2=ipos3;
267 if (ipos1!=std::string::npos && ipos2!=std::string::npos && !
veto) {
268 const std::string
server=
conn.substr(ipos1+3,ipos2-ipos1-3);
271 for (ServerMap::const_iterator sitr=
m_servermap.begin();
274 primap[sitr->second+spri]=*itr;
281 for (std::map<int,const coral::IDatabaseServiceDescription*>::const_iterator
282 itr=primap.begin();itr!=primap.end();++itr) {
283 replicaSet.push_back(itr->second);
284 ATH_MSG_DEBUG (
"Allowed replica to try (priority " << itr->first <<
285 ") : " << (itr->second)->connectionString());
287 if (replicaSet.empty())
289 ATH_MSG_DEBUG (
"Retained total of " << replicaSet.size() <<
" replicas");
◆ type()
const InterfaceID & DBReplicaSvc::type |
( |
| ) |
const |
|
virtual |
◆ m_configfile
std::string DBReplicaSvc::m_configfile |
|
private |
◆ m_coolsqlitepattern
std::string DBReplicaSvc::m_coolsqlitepattern |
|
private |
◆ m_frontiergen
bool DBReplicaSvc::m_frontiergen |
|
private |
◆ m_hostname
std::string DBReplicaSvc::m_hostname |
|
private |
◆ m_nofailover
bool DBReplicaSvc::m_nofailover |
|
private |
◆ m_servermap
◆ m_testhost
std::string DBReplicaSvc::m_testhost |
|
private |
◆ m_usecoolfrontier
bool DBReplicaSvc::m_usecoolfrontier |
|
private |
◆ m_usecoolsqlite
bool DBReplicaSvc::m_usecoolsqlite |
|
private |
◆ m_usegeomsqlite
bool DBReplicaSvc::m_usegeomsqlite |
|
private |
The documentation for this class was generated from the following files: