CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Enumerations | Functions
cond::persistency Namespace Reference

Classes

struct  AttributeTypeName
 
struct  AttributeTypeName< boost::posix_time::ptime >
 
struct  AttributeTypeName< cond::Binary >
 
struct  AttributeTypeName< cond::SynchronizationType >
 
struct  AttributeTypeName< cond::TimeType >
 
class  BasePayloadProxy
 
class  BulkInserter
 
class  CondDBTransaction
 
class  CondGetter
 
class  ConnectionPool
 
struct  DefineQueryOutput
 
struct  DefineQueryOutput< boost::posix_time::ptime >
 
struct  DefineQueryOutput< cond::Binary >
 
struct  DefineQueryOutput< cond::SynchronizationType >
 
struct  DefineQueryOutput< cond::TimeType >
 
struct  DefineQueryOutput< std::array< char, n > >
 
class  DeleteBuffer
 
class  Exception
 Base exception class for the object to relational access. More...
 
struct  GetFromRow
 
struct  GetFromRow< boost::posix_time::ptime >
 
struct  GetFromRow< cond::Binary >
 
struct  GetFromRow< cond::SynchronizationType >
 
struct  GetFromRow< cond::TimeType >
 
struct  GetFromRow< std::array< char, n > >
 
class  GTEditor
 
class  GTEditorData
 
class  GTProxy
 
class  GTProxyData
 
class  GTSchema
 
class  IGTMapTable
 
class  IGTSchema
 
class  IGTTable
 
class  IIOVSchema
 
class  IIOVTable
 
class  IOVCache
 
struct  IOVComp
 
class  IOVEditor
 
class  IOVEditorData
 
class  IOVProxy
 
class  IOVProxyData
 
class  IOVSchema
 
class  IPayloadTable
 
class  ITagMigrationTable
 
class  ITagTable
 
class  ITransaction
 
class  KeyList
 
class  OraGTMapTable
 
class  OraGTSchema
 
class  OraGTTable
 
class  OraIOVSchema
 
class  OraIOVTable
 
class  OraPayloadTable
 
class  OraTagTable
 
class  OraTransaction
 
class  PayloadProxy
 
class  PayloadProxy< cond::persistency::KeyList >
 
class  Query
 
class  QueryIterator
 
class  RowBuffer
 
class  Session
 
class  SessionImpl
 
class  TableDescription
 
class  Transaction
 
class  TransactionScope
 
class  UpdateBuffer
 

Enumerations

enum  DbAuthenticationSystem { UndefinedAuthentication =0, CondDbKey, CoralXMLFile }
 
enum  UpdatePolicy { NEW =0, UPDATE, REPLACE }
 

Functions

BackendType checkBackendType (boost::shared_ptr< coral::ISessionProxy > &coralSession, const std::string &connectionString)
 
bool compareTags (const std::string &firstTag, Session &firstSession, const std::string &firstFileName, const std::string &secondTag, Session &secondSession, const std::string &secondFileName)
 
std::string convertoToOracleConnection (const std::string &input)
 
bool copyIov (Session &session, const std::string &sourceTag, const std::string &destTag, cond::Time_t souceSince, cond::Time_t destSince, bool log)
 
size_t copyTag (const std::string &sourceTag, Session &sourceSession, const std::string &destTag, Session &destSession, UpdatePolicy policy, bool log, bool forValidation)
 
unsigned int countslash (const std::string &input)
 
size_t exportTagToFile (const std::string &tag, const std::string &destTag, Session &session, const std::string fileName)
 
template<typename T >
void f_add_column_description (coral::TableDescription &table, const std::string &columnName, size_t size=0, bool notNull=true)
 
std::pair< std::string,
boost::shared_ptr< void > > 
fetch (const cond::Hash &payloadId, Session &session)
 
std::pair< std::string,
boost::shared_ptr< void > > 
fetchOne (const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr, bool is Ora)
 
std::pair< std::string,
boost::shared_ptr< void > > 
fetchOne (const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr, bool isOra)
 
std::pair< std::string,
std::string > 
getConnectionParams (const std::string &connectionString, const std::string &transactionId)
 
std::string getConnectionProtocol (const std::string &connectionString)
 
cond::Hash import (const std::string &inputTypeName, const void *inputPtr, Session &destination)
 
size_t importIovs (const std::string &sourceTag, Session &sourceSession, const std::string &destTag, Session &destSession, cond::Time_t begin, cond::Time_t end, bool log)
 
template<typename T , typename Arg1 >
constexpr bool is_same_any ()
 
template<typename T , typename Arg1 , typename Arg2 , typename... Args>
constexpr bool is_same_any ()
 
cond::Hash makeHash (const std::string &objectType, const cond::Binary &data)
 
static const std::string ORA_IOV_TABLE_1 ("ORA_C_COND_IOVSEQUENCE")
 
static const std::string ORA_IOV_TABLE_2 ("ORA_C_COND_IOVSEQU_A0")
 
static const std::string ORA_IOV_TABLE_3 ("ORA_C_COND_IOVSEQU_A1")
 
std::tuple< std::string,
std::string, std::string > 
parseConnectionString (const std::string &connectionString)
 
std::pair< std::string,
std::string > 
parseTag (const std::string &tag)
 
static const std::string POOL_IOV_TABLE_DATA ("IOV_DATA")
 
template<typename T >
std::vector< T >::const_iterator search (const cond::Time_t &val, const std::vector< T > &container)
 
template<typename T , typename P >
void static_assert_is_same_decayed ()
 
 table (GLOBAL_TAG)
 
 table (TAG)
 
 table (GLOBAL_TAG_MAP)
 
 table (PAYLOAD)
 
 table (IOV)
 
 table (TAG_MIGRATION)
 
void throwException (const std::string &message, const std::string &methodName)
 
bool validateTag (const std::string &refTag, Session &refSession, const std::string &candTag, Session &candSession)
 

Enumeration Type Documentation

Enumerator
UndefinedAuthentication 
CondDbKey 
CoralXMLFile 

Definition at line 27 of file ConnectionPool.h.

Enumerator
NEW 
UPDATE 
REPLACE 

Definition at line 14 of file CondDBTools.h.

#define NEW
Definition: KFUpdator.cc:24
#define UPDATE(type)

Function Documentation

BackendType cond::persistency::checkBackendType ( boost::shared_ptr< coral::ISessionProxy > &  coralSession,
const std::string &  connectionString 
)

Definition at line 60 of file SessionImpl.cc.

References cond::DbTransaction::commit(), cond::COND_DB, cond::DbSession::open(), cond::ORA_DB, run_regression::ret, cond::DbTransaction::start(), cond::DbSession::transaction(), and cond::UNKNOWN_DB.

Referenced by cond::persistency::ConnectionPool::createSession().

61  {
63  cond::DbSession oraSession;
64  oraSession.open( coralSession, connectionString );
65  oraSession.transaction().start( true );
66  std::unique_ptr<IIOVSchema> iovSchemaHandle( new OraIOVSchema( oraSession ) );
67  std::unique_ptr<IGTSchema> gtSchemaHandle( new OraGTSchema( oraSession ) );
68  if( !iovSchemaHandle->exists() && !gtSchemaHandle->exists() ){
69  iovSchemaHandle.reset( new IOVSchema( coralSession->nominalSchema() ) );
70  if( iovSchemaHandle->exists() ){
71  ret = COND_DB;
72  }
73  } else {
74  ret = ORA_DB;
75  }
76  oraSession.transaction().commit();
77  return ret;
78  }
DbTransaction & transaction()
Definition: DbSession.cc:208
void open(const std::string &connectionString, bool readOnly=false)
Definition: DbSession.cc:159
int commit()
commit transaction.
int start(bool readOnly=false)
start transaction
BackendType
Definition: Types.h:23
bool cond::persistency::compareTags ( const std::string &  firstTag,
Session firstSession,
const std::string &  firstFileName,
const std::string &  secondTag,
Session secondSession,
const std::string &  secondFileName 
)

Definition at line 202 of file CondDBTools.cc.

References cond::persistency::Session::connectionString(), gather_cfg::cout, exportTagToFile(), timingPdfMaker::file1, N, NULL, cmsHarvester::path, diffTwoXMLs::r1, diffTwoXMLs::r2, python.multivaluedict::remove(), and throwException().

Referenced by validateTag().

207  {
208  size_t n1 = exportTagToFile( firstTag, firstTag, firstSession, firstFileName );
209  if( ! n1 ){
210  std::cout <<"Can't compare empty tag "<<firstTag<<std::endl;
211  return false;
212  }
213  size_t n2 = exportTagToFile( secondTag, firstTag, secondSession, secondFileName );
214  if( ! n2 ){
215  std::cout <<"Can't compare empty tag "<<secondTag<<std::endl;
216  return false;
217  }
218  if( n1 != n2 ) {
219  std::cout <<" Tag size is different. "<<firstSession.connectionString()<<":"<<firstTag<<": "<<n1<<" "<<
220  secondSession.connectionString()<<":"<<secondTag<<": "<<n2<<std::endl;
221  }
222 
223  FILE* file1 = fopen( firstFileName.c_str(), "r" );
224  if( file1 == NULL ){
225  throwException("Can't open file "+firstFileName, "compareTags" );
226  }
227  FILE* file2 = fopen( secondFileName.c_str(), "r" );
228  if( file2 == NULL ){
229  throwException("Can't open file "+secondFileName, "compareTags" );
230  }
231  int N = 10000;
232  char buf1[N];
233  char buf2[N];
234 
235  bool cmpOk = true;
236  size_t totSize = 0;
237  do {
238  size_t r1 = fread( buf1, 1, N, file1 );
239  size_t r2 = fread( buf2, 1, N, file2 );
240 
241  if( r1 != r2 || memcmp( buf1, buf2, r1)) {
242  cmpOk = false;
243  break;
244  }
245  totSize += r1;
246  } while(!feof(file2) || !feof(file2));
247 
248  std::cout <<" "<<totSize<<" bytes compared."<<std::endl;
249  fclose( file1 );
250  fclose( file2 );
251 
252  if( cmpOk ){
253  boost::filesystem::path fp1( firstFileName );
255  boost::filesystem::path fp2( secondFileName );
257  }
258 
259  return cmpOk;
260  }
#define NULL
Definition: scimark2.h:8
tuple path
else: Piece not in the list, fine.
size_t exportTagToFile(const std::string &tag, const std::string &destTag, Session &session, const std::string fileName)
Definition: CondDBTools.cc:195
#define N
Definition: blowfish.cc:9
tuple cout
Definition: gather_cfg.py:121
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
std::string cond::persistency::convertoToOracleConnection ( const std::string &  input)
inline

Definition at line 66 of file Utils.h.

References dbtoconf::account, match(), fff_monitoring::service, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

66  {
67 
68  //static const boost::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)");
69  static const boost::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)");
70  static const boost::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)");
71  static const boost::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)");
72 
73  static const std::map<std::string, std::string> frontierMap = {
74  {"PromptProd", "cms_orcon_adg"},
75  {"FrontierProd", "cms_orcon_adg"},
76  {"FrontierArc", "cms_orcon_adg"},
77  {"FrontierOnProd", "cms_orcon_adg"},
78  {"FrontierPrep", "cms_orcoff_prep"},
79  };
80 
81  boost::smatch matches;
82 
83  static const std::string technology("oracle://");
84  std::string service("");
85  std::string account("");
86 
87  bool match = false;
88  if (boost::regex_match(input, matches, short_frontier)){
89  service = matches[1];
90  account = matches[2];
91  match = true;
92  }
93 
94  if (boost::regex_match(input, matches, long_frontier)) {
95  std::string frontier_config(matches[1]);
96  boost::smatch matches2;
97  if (not boost::regex_search(frontier_config, matches2, long_frontier_serverurl))
98  throwException("No serverurl in matched long frontier","convertoToOracleConnection");
99  service = matches2[1];
100  account = matches[3];
101  match = true;
102  }
103 
104  if( !match ) throwException("Connection string can't be converted.","convertoToOracleConnection");
105 
106  if( service == "FrontierArc" ){
107  size_t len = account.size()-5;
108  account = account.substr(0,len);
109  }
110 
111  auto it = frontierMap.find( service );
112  if( it == frontierMap.end() ) throwException("Connection string can't be converted.","convertoToOracleConnection");
113  service = it->second;
114 
115  return technology+service+"/"+account;
116  }
list account
Definition: dbtoconf.py:80
static std::string const input
Definition: EdmProvDump.cc:44
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
bool cond::persistency::copyIov ( Session session,
const std::string &  sourceTag,
const std::string &  destTag,
cond::Time_t  souceSince,
cond::Time_t  destSince,
bool  log 
)

Definition at line 152 of file CondDBTools.cc.

References cond::persistency::Session::connectionString(), gather_cfg::cout, cond::persistency::Session::createIov(), cond::persistency::Session::editIov(), idDealer::editor, cond::persistency::IOVProxy::end(), cond::persistency::Session::existsIov(), cond::persistency::IOVProxy::find(), cond::persistency::IOVEditor::flush(), cond::persistency::IOVEditor::insert(), cond::persistency::IOVProxy::loadedSize(), AlCaHLTBitMon_ParallelJobs::p, cond::persistency::IOVProxy::payloadObjectType(), cond::persistency::IOVEditor::payloadType(), cond::persistency::Session::readIov(), cond::persistency::IOVEditor::setDescription(), cond::persistency::TransactionScope::start(), cond::persistency::IOVProxy::synchronizationType(), throwException(), cond::persistency::IOVEditor::timeType(), cond::persistency::IOVProxy::timeType(), and cond::persistency::Session::transaction().

157  {
158  persistency::TransactionScope ssc( session.transaction() );
159  ssc.start( false );
160  if( log ) std::cout <<" Loading source iov..."<<std::endl;
161  persistency::IOVProxy p = session.readIov( sourceTag, true );
162  if( p.loadedSize()==0 ) {
163  if( log ) std::cout <<" Tag contains 0 iovs."<<std::endl;
164  return false;
165  } else {
166  if( log ) std::cout <<" Iov size:"<<p.loadedSize()<<" timeType:"<<p.timeType()<<" payloadObjectType=\""<<p.payloadObjectType()<<"\""<<std::endl;
167  }
168 
169  auto iiov = p.find( sourceSince );
170  if( iiov == p.end() ){
171  if( log ) std::cout <<"ERROR: No Iov valid found for target time "<<sourceSince<<std::endl;
172  return false;
173  }
174 
175  persistency::IOVEditor editor;
176  if( session.existsIov( destTag ) ){
177  editor = session.editIov( destTag );
178  if( editor.timeType() != p.timeType() )
179  throwException( "TimeType of the destination tag does not match with the source tag timeType.", "importIovs");
180  if( editor.payloadType() != p.payloadObjectType() )
181  throwException( "PayloadType of the destination tag does not match with the source tag payloadType.", "importIovs");
182  } else {
183  editor = session.createIov( p.payloadObjectType(), destTag, p.timeType(), p.synchronizationType() );
184  editor.setDescription( "Copied tag "+sourceTag+" from "+session.connectionString() );
185  }
186 
187  editor.insert( destSince, (*iiov).payloadId );
188 
189  if( log ) std::cout <<" Flushing changes..."<<std::endl;
190  editor.flush();
191  ssc.commit();
192  return true;
193  }
tuple editor
Definition: idDealer.py:73
tuple cout
Definition: gather_cfg.py:121
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
size_t cond::persistency::copyTag ( const std::string &  sourceTag,
Session sourceSession,
const std::string &  destTag,
Session destSession,
UpdatePolicy  policy,
bool  log,
bool  forValidation 
)

Definition at line 11 of file CondDBTools.cc.

References cond::persistency::Session::clearIov(), cond::persistency::Session::connectionString(), gather_cfg::cout, cond::persistency::Session::createDatabase(), cond::persistency::Session::createIov(), cond::persistency::Session::editIov(), idDealer::editor, cond::persistency::Session::existsDatabase(), cond::persistency::Session::existsIov(), fetch(), cond::persistency::IOVEditor::flush(), cond::persistency::IOVEditor::insert(), o2o::iov, cond::persistency::IOVProxy::loadedSize(), NEW, AlCaHLTBitMon_ParallelJobs::p, cond::persistency::IOVProxy::payloadObjectType(), cond::persistency::Session::readIov(), REPLACE, cond::persistency::Transaction::rollback(), cond::persistency::IOVEditor::setDescription(), cond::persistency::IOVEditor::setValidationMode(), EcalCondDB::sinces, cond::persistency::TransactionScope::start(), cond::persistency::IOVProxy::synchronizationType(), throwException(), cond::persistency::IOVProxy::timeType(), and cond::persistency::Session::transaction().

Referenced by exportTagToFile().

17  {
18  persistency::TransactionScope ssc( sourceSession.transaction() );
19  ssc.start();
20  if( log && !forValidation ) std::cout <<" Loading source iov..."<<std::endl;
21  persistency::IOVProxy p = sourceSession.readIov( sourceTag, true );
22  if( p.loadedSize()==0 ) {
23  if( log ) std::cout <<" Tag contains 0 iovs."<<std::endl;
24  return 0;
25  }
26  if( log && !forValidation ) std::cout <<" Copying tag. Iov size:"<<p.loadedSize()<<" timeType:"<<p.timeType()<<" payloadObjectType=\""<<p.payloadObjectType()<<"\""<<std::endl;
27 
28  persistency::IOVEditor editor;
29  persistency::TransactionScope dsc( destSession.transaction() );
30  dsc.start( false );
31  bool exists = false;
32  if( !destSession.existsDatabase() ) {
33  destSession.createDatabase();
34  } else {
35  exists = destSession.existsIov( destTag );
36  }
37  if( exists ){
38  if( policy == REPLACE ){
39  destSession.clearIov( destTag );
40  } else if( policy == NEW ){
41  destSession.transaction().rollback();
42  throwException(" Tag \""+destTag+"\" already exists.","copyTag");
43  }
44  editor = destSession.editIov( destTag );
45  } else {
46  editor = destSession.createIov( p.payloadObjectType(), destTag, p.timeType(), p.synchronizationType() );
47  }
48  if( forValidation ) {
49  editor.setValidationMode();
50  editor.setDescription("Validation");
51  } else {
52  editor.setDescription("Tag "+sourceTag+" migrated from "+sourceSession.connectionString());
53  }
54  size_t niovs = 0;
55  std::set<cond::Hash> pids;
56  std::set<cond::Time_t> sinces;
57  for( auto iov : p ){
58  // skip duplicated sinces
59  if( sinces.find( iov.since ) != sinces.end() ){
60  if( log && !forValidation ) std::cout <<" WARNING. Skipping duplicated since="<<iov.since<<std::endl;
61  continue;
62  }
63  sinces.insert( iov.since );
64  // make sure that we import the payload _IN_USE_
65  auto usedIov = p.getInterval( iov.since );
66  std::pair<std::string,boost::shared_ptr<void> > readBackPayload = fetch( usedIov.payloadId, sourceSession );
67  cond::Hash ph = import( readBackPayload.first, readBackPayload.second.get(), destSession );
68  editor.insert( iov.since, ph );
69  pids.insert( ph );
70  niovs++;
71  if( log && !forValidation && niovs && (niovs%1000==0) ) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
72  }
73  if( log && !forValidation) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
74  if( log && !forValidation) std::cout <<" Flushing changes..."<<std::endl;
75  editor.flush();
76  dsc.commit();
77  ssc.commit();
78  return niovs;
79  }
list sinces
Definition: EcalCondDB.py:80
tuple iov
Definition: o2o.py:307
#define NEW
Definition: KFUpdator.cc:24
std::string Hash
Definition: Types.h:43
std::pair< std::string, boost::shared_ptr< void > > fetch(const cond::Hash &payloadId, Session &session)
tuple editor
Definition: idDealer.py:73
tuple cout
Definition: gather_cfg.py:121
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
unsigned int cond::persistency::countslash ( const std::string &  input)

Definition at line 15 of file DbConnectionString.cc.

References prof2calltree::count.

Referenced by getConnectionParams().

15  {
16  unsigned int count=0;
17  std::string::size_type slashpos( 0 );
18  while( slashpos!=std::string::npos){
19  slashpos = input.find('/', slashpos );
20  if ( slashpos != std::string::npos ){
21  ++count;
22  // start next search after this word
23  slashpos += 1;
24  }
25  }
26  return count;
27  }
uint16_t size_type
static std::string const input
Definition: EdmProvDump.cc:44
size_t cond::persistency::exportTagToFile ( const std::string &  tag,
const std::string &  destTag,
Session session,
const std::string  fileName 
)

Definition at line 195 of file CondDBTools.cc.

References copyTag(), cond::persistency::ConnectionPool::createSession(), NEW, and run_regression::ret.

Referenced by compareTags().

195  {
196  ConnectionPool localPool;
197  Session writeSession = localPool.createSession( "sqlite:"+fileName, true );
198  size_t ret = copyTag( tag, session, destTag, writeSession, NEW, false,true );
199  return ret;
200  }
size_t copyTag(const std::string &sourceTag, Session &sourceSession, const std::string &destTag, Session &destSession, UpdatePolicy policy, bool log, bool forValidation)
Definition: CondDBTools.cc:11
#define NEW
Definition: KFUpdator.cc:24
template<typename T >
void cond::persistency::f_add_column_description ( coral::TableDescription &  table,
const std::string &  columnName,
size_t  size = 0,
bool  notNull = true 
)

Definition at line 205 of file DbCore.h.

References findQualityFiles::size.

205  {
206  table.insertColumn( columnName, AttributeTypeName<T>()(), size );
207  if( notNull ) table.setNotNullConstraint( columnName );
208  }
#define table(NAME)
Definition: DbCore.h:49
tuple size
Write out results.
std::pair< std::string, boost::shared_ptr< void > > cond::persistency::fetch ( const cond::Hash payloadId,
Session session 
)

Definition at line 315 of file CondDBImport.cc.

References data, fetchOne(), cond::persistency::Session::fetchPayloadData(), newFWLiteAna::found, cond::persistency::Session::isOraSession(), AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by copyTag(), LMFDat::fetch(), and importIovs().

315  {
316  boost::shared_ptr<void> payloadPtr;
318  cond::Binary streamerInfo;
319  std::string payloadTypeName;
320  bool found = session.fetchPayloadData( payloadId, payloadTypeName, data, streamerInfo );
321  if( !found ) throwException( "Payload with id "+boost::lexical_cast<std::string>(payloadId)+" has not been found in the database.","fetchAndCompare" );
322  //std::cout <<"--> payload type "<<payloadTypeName<<" has blob size "<<data.size()<<std::endl;
323  bool isOra = session.isOraSession();
324  return fetchOne(payloadTypeName, data, streamerInfo, payloadPtr, isOra);
325  }
std::pair< std::string, boost::shared_ptr< void > > fetchOne(const std::string &payloadTypeName, const cond::Binary &data, const cond::Binary &streamerInfo, boost::shared_ptr< void > payloadPtr, bool is Ora)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
std::pair<std::string, boost::shared_ptr<void> > cond::persistency::fetchOne ( const std::string &  payloadTypeName,
const cond::Binary data,
const cond::Binary streamerInfo,
boost::shared_ptr< void >  payloadPtr,
bool is  Ora 
)

Referenced by fetch().

std::pair<std::string, boost::shared_ptr<void> > cond::persistency::fetchOne ( const std::string &  payloadTypeName,
const cond::Binary data,
const cond::Binary streamerInfo,
boost::shared_ptr< void >  payloadPtr,
bool  isOra 
)

Definition at line 326 of file CondDBImport.cc.

References data, FETCH_PAYLOAD_CASE, match(), AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

326  {
327 
328  bool match = false;
330  FETCH_PAYLOAD_CASE( std::vector<unsigned long long> )
491  FETCH_PAYLOAD_CASE( lumi::LumiSectionData )
494  FETCH_PAYLOAD_CASE( PhysicsTools::Calibration::MVAComputerContainer )
498  //FETCH_PAYLOAD_CASE( PerformancePayload )
541  FETCH_PAYLOAD_CASE( cond::BaseKeyed )
550 
551  //
552  if( payloadTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
553  auto payload = deserialize<PhysicsTools::Calibration::Histogram3D<double,double,double,double> >(payloadTypeName, data, streamerInfo, isOra );
554  payloadPtr = payload;
555  match = true;
556  }
557  if( payloadTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
558  auto payload = deserialize<PhysicsTools::Calibration::Histogram2D<double,double,double> >(payloadTypeName, data, streamerInfo, isOra );
559  payloadPtr = payload;
560  match = true;
561  }
562  if( payloadTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
563  auto payload = deserialize<std::vector<unsigned long long> >( payloadTypeName, data, streamerInfo, isOra );
564  payloadPtr = payload;
565  match = true;
566  }
567 
568  if( ! match ) throwException( "Payload type \""+payloadTypeName+"\" is unknown.","fetch" );
569  return std::make_pair( payloadTypeName, payloadPtr );
570  }
Definition: ESGain.h:7
tuple lumi
Definition: fjr2json.py:35
#define FETCH_PAYLOAD_CASE(TYPENAME)
Definition: CondDBImport.cc:19
Definition: DTT0.h:53
Histogram3D< double > HistogramD3D
Definition: Histogram3D.h:187
QGLikelihoodObject containing valid range and entries with category, histogram and mean...
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
if(dp >Float(M_PI)) dp-
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
std::pair< std::string, std::string > cond::persistency::getConnectionParams ( const std::string &  connectionString,
const std::string &  transactionId 
)

Definition at line 29 of file DbConnectionString.cc.

References countslash(), getConnectionProtocol(), cond::FipProtocolParser::getRealConnect(), edm::Service< T >::isAvailable(), ConfigFiles::l, edm::SiteLocalConfig::lookupCalibConnect(), geometryXMLtoCSV::parser, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by cond::persistency::ConnectionPool::createSession().

30  {
31  if( connectionString.empty() ) throwException( "The connection string is empty.","getConnectionParams");
32  std::string protocol = getConnectionProtocol( connectionString );
33  std::string finalConn = connectionString;
34  std::string refreshConn("");
35  if( protocol == "frontier" ){
36  std::string protocol("frontier://");
37  std::string::size_type fpos=connectionString.find(protocol);
38  unsigned int nslash=countslash(connectionString.substr(protocol.size(),connectionString.size()-fpos));
39  if(nslash==1){
40  edm::Service<edm::SiteLocalConfig> localconfservice;
41  if( !localconfservice.isAvailable() ){
42  throwException("edm::SiteLocalConfigService is not available","getConnectionParams");
43  }
44  finalConn=localconfservice->lookupCalibConnect(connectionString);
45  }
46  if (!transactionId.empty()) {
47  size_t l = finalConn.rfind('/');
48  finalConn.insert(l,"(freshkey="+transactionId+')');
49  }
50 
51  std::string::size_type startRefresh = finalConn.find("://");
52  if (startRefresh != std::string::npos){
53  startRefresh += 3;
54  }
55  std::string::size_type endRefresh=finalConn.rfind("/", std::string::npos);
56  if (endRefresh == std::string::npos){
57  refreshConn = finalConn;
58  } else{
59  refreshConn = finalConn.substr(startRefresh, endRefresh-startRefresh);
60  if(refreshConn.substr(0,1) != "("){
61  //if the connect string is not a complicated parenthesized string,
62  // an http:// needs to be at the beginning of it
63  refreshConn.insert(0, "http://");
64  }
65  }
66  } else if ( protocol == "sqlite_fip" ){
68  finalConn = parser.getRealConnect( connectionString );
69  }
70  return std::make_pair( finalConn, refreshConn );
71  }
std::string getConnectionProtocol(const std::string &connectionString)
Definition: Utils.h:35
std::string getRealConnect(const std::string &fipConnect) const
virtual std::string const lookupCalibConnect(std::string const &input) const =0
uint16_t size_type
bool isAvailable() const
Definition: Service.h:46
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
unsigned int countslash(const std::string &input)
std::string cond::persistency::getConnectionProtocol ( const std::string &  connectionString)
inline

Definition at line 35 of file Utils.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by getConnectionParams(), and parseConnectionString().

35  {
36  size_t techEnd = connectionString.find( ':' );
37  if( techEnd == std::string::npos ) throwException( "Could not resolve the connection protocol on "+connectionString+".",
38  "getConnectionProtocol" );
39  std::string technology = connectionString.substr(0,techEnd);
40  return technology;
41  }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
cond::Hash cond::persistency::import ( const std::string &  inputTypeName,
const void *  inputPtr,
Session destination 
)

if( inputTypeName == "PhysicsTools::Calibration::MVAComputerContainer" ){ \ std::cout <<"@@@@@ MVAComputer!"<<std::endl;\ match = true;\ const PhysicsTools::Calibration::MVAComputerContainer& obj = static_cast<const PhysicsTools::Calibration::MVAComputerContainer>( inputPtr ); \ PhysicsTools::Calibration::MVAComputerContainer tmp; \ for( auto entry : obj.entries ) { \ std::cout <<"#Adding new entry label="<<entry.first<<std::endl; \ PhysicsTools::Calibration::MVAComputer& c = tmp.add( entry.first ); \ c.inputSet = entry.second.inputSet; \ c.output = entry.second.output; \ auto ps = entry.second.getProcessors(); \ for( size_t i=0;i<ps.size();i++ ){ \ std::cout <<"PRocess type="<<demangledName( typeid(*ps[i] ) )<<std::endl; \ c.addProcessor( ps[i] ); \ } \ } \ std::pair<std::string,bool> st = destination.storePayload( tmp, boost::posix_time::microsec_clock::universal_time() ); \ payloadId = st.first; \ newInsert = st.second; \ }

if( inputTypeName == "PhysicsTools::Calibration::MVAComputerContainer" ){ \ std::cout <<"@@@@@ MVAComputer!"<<std::endl;\ match = true;\ const PhysicsTools::Calibration::MVAComputerContainer& obj = static_cast<const PhysicsTools::Calibration::MVAComputerContainer>( inputPtr ); \ PhysicsTools::Calibration::MVAComputerContainer tmp; \ for( auto entry : obj.entries ) { \ std::cout <<"#Adding new entry label="<<entry.first<<std::endl; \ PhysicsTools::Calibration::MVAComputer& c = tmp.add( entry.first ); \ c.inputSet = entry.second.inputSet; \ c.output = entry.second.output; \ auto ps = entry.second.getProcessors(); \ for( size_t i=0;i<ps.size();i++ ){ \ std::cout <<"PRocess type="<<demangledName( typeid(*ps[i] ) )<<std::endl; \ c.addProcessor( ps[i] ); \ } \ } \ std::pair<std::string,bool> st = destination.storePayload( tmp, boost::posix_time::microsec_clock::universal_time() ); \ payloadId = st.first; \ newInsert = st.second; \ }

Definition at line 45 of file CondDBImport.cc.

References roll_playback::destination, IMPORT_PAYLOAD_CASE, match(), getGTfromDQMFile::obj, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

45  {
46  cond::Hash payloadId("");
47  bool newInsert = false;
48  bool match = false;
49  if( inputPtr ){
51  IMPORT_PAYLOAD_CASE( std::vector<unsigned long long> )
212  IMPORT_PAYLOAD_CASE( lumi::LumiSectionData )
238  IMPORT_PAYLOAD_CASE( PhysicsTools::Calibration::MVAComputerContainer )
242  //IMPORT_PAYLOAD_CASE( PerformancePayload )
285  IMPORT_PAYLOAD_CASE( cond::BaseKeyed )
294  if( inputTypeName == "PhysicsTools::Calibration::Histogram3D<double,double,double,double>" ){
295  match = true;
297  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
298  }
299  if( inputTypeName == "PhysicsTools::Calibration::Histogram2D<double,double,double>" ){
300  match = true;
302  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
303  }
304  if( inputTypeName == "std::vector<unsignedlonglong,std::allocator<unsignedlonglong>>" ){
305  match = true;
306  const std::vector<unsigned long long>& obj = *static_cast<const std::vector<unsigned long long>*>( inputPtr );
307  payloadId = destination.storePayload( obj, boost::posix_time::microsec_clock::universal_time() );
308  }
309 
310  if( ! match ) throwException( "Payload type \""+inputTypeName+"\" is unknown.","import" );
311  }
312  return payloadId;
313  }
Definition: ESGain.h:7
tuple lumi
Definition: fjr2json.py:35
Definition: DTT0.h:53
Histogram3D< double > HistogramD3D
Definition: Histogram3D.h:187
QGLikelihoodObject containing valid range and entries with category, histogram and mean...
#define IMPORT_PAYLOAD_CASE(TYPENAME)
Definition: CondDBImport.cc:4
std::string Hash
Definition: Types.h:43
Category structure: ranges associated with QGLikelihood histograms.
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
if(dp >Float(M_PI)) dp-
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
QGLikelihoodSystematicsObject containing the parameters for the systematic smearing.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
size_t cond::persistency::importIovs ( const std::string &  sourceTag,
Session sourceSession,
const std::string &  destTag,
Session destSession,
cond::Time_t  begin,
cond::Time_t  end,
bool  log 
)

Definition at line 81 of file CondDBTools.cc.

References begin, cond::persistency::Session::connectionString(), gather_cfg::cout, cond::persistency::Session::createDatabase(), cond::persistency::Session::createIov(), cond::persistency::Session::editIov(), idDealer::editor, end, cond::persistency::IOVProxy::end(), cond::persistency::Session::existsDatabase(), cond::persistency::Session::existsIov(), fetch(), cond::persistency::IOVProxy::find(), cond::persistency::IOVEditor::flush(), cond::persistency::IOVProxy::getInterval(), cond::persistency::IOVEditor::insert(), cond::persistency::IOVProxy::loadedSize(), AlCaHLTBitMon_ParallelJobs::p, cond::persistency::IOVProxy::payloadObjectType(), cond::persistency::IOVEditor::payloadType(), cond::persistency::Session::readIov(), cond::persistency::IOVEditor::setDescription(), EcalCondDB::sinces, cond::persistency::TransactionScope::start(), cond::persistency::IOVProxy::synchronizationType(), throwException(), cond::persistency::IOVEditor::timeType(), cond::persistency::IOVProxy::timeType(), and cond::persistency::Session::transaction().

87  {
88  persistency::TransactionScope ssc( sourceSession.transaction() );
89  ssc.start();
90  if( log ) std::cout <<" Loading source iov..."<<std::endl;
91  persistency::IOVProxy p = sourceSession.readIov( sourceTag, true );
92  if( p.loadedSize()==0 ) {
93  if( log ) std::cout <<" Tag contains 0 iovs."<<std::endl;
94  return 0;
95  } else {
96  if( log ) std::cout <<" Iov size:"<<p.loadedSize()<<" timeType:"<<p.timeType()<<" payloadObjectType=\""<<p.payloadObjectType()<<"\""<<std::endl;
97  }
98  persistency::IOVEditor editor;
99  persistency::TransactionScope dsc( destSession.transaction() );
100  dsc.start( false );
101  bool exists = false;
102  if( !destSession.existsDatabase() ) {
103  destSession.createDatabase();
104  } else {
105  exists = destSession.existsIov( destTag );
106  }
107  if( exists ){
108  editor = destSession.editIov( destTag );
109  if( editor.timeType() != p.timeType() )
110  throwException( "TimeType of the destination tag does not match with the source tag timeType.", "importIovs");
111  if( editor.payloadType() != p.payloadObjectType() )
112  throwException( "PayloadType of the destination tag does not match with the source tag payloadType.", "importIovs");
113  } else {
114  editor = destSession.createIov( p.payloadObjectType(), destTag, p.timeType(), p.synchronizationType() );
115  editor.setDescription( "Copied tag "+sourceTag+" from "+sourceSession.connectionString() );
116  }
117  size_t niovs = 0;
118  std::set<cond::Hash> pids;
119  std::set<cond::Time_t> sinces;
120  auto iiov = p.find( begin );
121  cond::Time_t newSince = begin;
122  while( iiov != p.end() ){
123  // skip duplicated sinces
124  if( sinces.find( newSince ) != sinces.end() ){
125  if( log ) std::cout <<" WARNING. Skipping duplicated since="<<newSince<<std::endl;
126  continue;
127  }
128  sinces.insert( newSince );
129  // make sure that we import the payload _IN_USE_
130  auto usedIov = p.getInterval( newSince );
131  std::pair<std::string,boost::shared_ptr<void> > readBackPayload = fetch( usedIov.payloadId, sourceSession );
132  cond::Hash ph = import( readBackPayload.first, readBackPayload.second.get(), destSession );
133  editor.insert( newSince, ph );
134  pids.insert( ph );
135  niovs++;
136  if( log && niovs && (niovs%1000==0) ) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
137  iiov++;
138  if( iiov == p.end() || (*iiov).since > end ){
139  break;
140  } else {
141  newSince = (*iiov).since;
142  }
143  }
144  if( log ) std::cout <<" Total of iov inserted: "<<niovs<<" payloads: "<<pids.size()<<std::endl;
145  if( log ) std::cout <<" Flushing changes..."<<std::endl;
146  editor.flush();
147  dsc.commit();
148  ssc.commit();
149  return niovs;
150  }
list sinces
Definition: EcalCondDB.py:80
unsigned long long Time_t
Definition: Time.h:16
std::string Hash
Definition: Types.h:43
#define end
Definition: vmac.h:37
std::pair< std::string, boost::shared_ptr< void > > fetch(const cond::Hash &payloadId, Session &session)
tuple editor
Definition: idDealer.py:73
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:121
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
template<typename T , typename Arg1 >
constexpr bool cond::persistency::is_same_any ( )

Definition at line 210 of file DbCore.h.

References relativeConstraints::value.

210  {
212  };
template<typename T , typename Arg1 , typename Arg2 , typename... Args>
constexpr bool cond::persistency::is_same_any ( )

Definition at line 214 of file DbCore.h.

214  {
215  return is_same_any<T, Arg1>() || is_same_any<T, Arg2, Args...>();
216  };
cond::Hash cond::persistency::makeHash ( const std::string &  objectType,
const cond::Binary data 
)

Definition at line 10 of file IOVSchema.cc.

References cond::Binary::data(), cond::hash, i, cond::Binary::size(), throwException(), and tmp.

10  {
11  SHA_CTX ctx;
12  if( !SHA1_Init( &ctx ) ){
13  throwException( "SHA1 initialization error.","IOVSchema::makeHash");
14  }
15  if( !SHA1_Update( &ctx, objectType.c_str(), objectType.size() ) ){
16  throwException( "SHA1 processing error (1).","IOVSchema::makeHash");
17  }
18  if( !SHA1_Update( &ctx, data.data(), data.size() ) ){
19  throwException( "SHA1 processing error (2).","IOVSchema::makeHash");
20  }
21  unsigned char hash[SHA_DIGEST_LENGTH];
22  if( !SHA1_Final(hash, &ctx) ){
23  throwException( "SHA1 finalization error.","IOVSchema::makeHash");
24  }
25 
26  char tmp[SHA_DIGEST_LENGTH*2+1];
27  // re-write bytes in hex
28  for (unsigned int i = 0; i < 20; i++) {
29  ::sprintf(&tmp[i * 2], "%02x", hash[i]);
30  }
31  tmp[20*2] = 0;
32  return tmp;
33  }
int i
Definition: DBlmapReader.cc:9
size_t size() const
Definition: Binary.cc:57
const void * data() const
Definition: Binary.cc:48
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
static const std::string cond::persistency::ORA_IOV_TABLE_1 ( "ORA_C_COND_IOVSEQUENCE"  )
static
static const std::string cond::persistency::ORA_IOV_TABLE_2 ( "ORA_C_COND_IOVSEQU_A0"  )
static
static const std::string cond::persistency::ORA_IOV_TABLE_3 ( "ORA_C_COND_IOVSEQU_A1"  )
static
std::tuple<std::string,std::string,std::string> cond::persistency::parseConnectionString ( const std::string &  connectionString)
inline

Definition at line 43 of file Utils.h.

References getConnectionProtocol(), serviceName, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by validateTag().

43  {
44  std::string protocol = getConnectionProtocol( connectionString );
46  std::string databaseName("");
47  if( protocol == "sqlite" || protocol == "sqlite_file" || protocol == "sqlite_fip" ){
48  databaseName = connectionString.substr( protocol.size()+1 );
49  } else if ( protocol == "oracle" || protocol == "frontier" ){
50  size_t ptr = protocol.size()+1;
51  if( connectionString.substr( ptr,2 )!="//" ) throwException( "Connection string "+connectionString+
52  " is invalid format for technology \""+
53  protocol+"\".","parseConnectionString" );
54  ptr += 2;
55  size_t serviceEnd = connectionString.find( '/', ptr );
56  if( serviceEnd == std::string::npos ) throwException( "Connection string "+connectionString+" is invalid.",
57  "parseConnectionString" );
58  serviceName = connectionString.substr( ptr, serviceEnd-ptr );
59  ptr = serviceEnd+1;
60  databaseName = connectionString.substr( ptr );
61  } else throwException( "Technology "+protocol+" is not known.","parseConnectionString" );
62 
63  return std::make_tuple( protocol, serviceName, databaseName );
64  }
std::string getConnectionProtocol(const std::string &connectionString)
Definition: Utils.h:35
static const std::string serviceName
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:11
std::pair< std::string, std::string > cond::persistency::parseTag ( const std::string &  tag)

Definition at line 8 of file GTProxy.cc.

References dbtoconf::pfn, AlCaHLTBitMon_QueryRunRegistry::string, and edmStreamStallGrapher::t.

Referenced by CondDBESSource::CondDBESSource(), and CondDBESSource::setIntervalFor().

8  {
9  std::string pfn("");
10  std::string t(tag);
11  size_t pos = tag.rfind('@');
12  if( pos != std::string::npos && tag.size() >= pos+3 ){
13  if( tag[pos+1]=='[' && tag[tag.size()-1]==']' ) {
14  pfn = tag.substr( pos+2,tag.size()-pos-3 );
15  t = tag.substr( 0, pos );
16  }
17  }
18  return std::make_pair( t, pfn );
19  }
list pfn
Definition: dbtoconf.py:76
static const std::string cond::persistency::POOL_IOV_TABLE_DATA ( "IOV_DATA"  )
static
template<typename T >
std::vector<T>::const_iterator cond::persistency::search ( const cond::Time_t val,
const std::vector< T > &  container 
)

Definition at line 229 of file IOVProxy.cc.

References AlCaHLTBitMon_ParallelJobs::p.

Referenced by dqm_interfaces.DirID::__eq__(), ValidationMatrix::add_to_blacklist(), ValidationMatrix::do_comparisons_threaded(), AlignmentMonitorTemplate::event(), cond::persistency::IOVProxy::find(), FileNamesHelper::getJobID_fromFileName(), ValidationMatrix::guess_blacklists(), ValidationMatrix::guess_params(), and duplicateReflexLibrarySearch::searchClassDefXml().

229  {
230  if( !container.size() ) return container.end();
231  auto p = std::upper_bound( container.begin(), container.end(), val, IOVComp() );
232  return (p!= container.begin()) ? p-1 : container.end();
233  }
template<typename T , typename P >
void cond::persistency::static_assert_is_same_decayed ( )
inline

Definition at line 82 of file DbCore.h.

References relativeConstraints::value.

82  {
83  static_assert( std::is_same<typename std::decay<T>::type, typename std::decay<P>::type>::value, "Parameter types don't match with the RowBuffer types" );
84  };
type
Definition: HCALResponse.h:21
cond::persistency::table ( GLOBAL_TAG  )

Definition at line 13 of file GTSchema.h.

References column, idDealer::description, edm::eventsetup::heterocontainer::insert(), mergeVDriftHistosByStation::name, fetchall_from_DQM_v2::release, run_regression::RELEASE, python.IdGenerator::schema, benchmark_cfg::select, AlCaHLTBitMon_QueryRunRegistry::string, and update.

13  {
14 
15  column( NAME, std::string );
16  column( VALIDITY, cond::Time_t );
17  column( DESCRIPTION, std::string );
19  column( SNAPSHOT_TIME, boost::posix_time::ptime );
20  column( INSERTION_TIME, boost::posix_time::ptime );
21 
22  class Table : public IGTTable {
23  public:
24  explicit Table( coral::ISchema& schema );
25  virtual ~Table(){}
26  bool exists();
27  bool select( const std::string& name);
28  bool select( const std::string& name, cond::Time_t& validity, boost::posix_time::ptime& snapshotTime );
29  bool select( const std::string& name, cond::Time_t& validity, std::string& description,
30  std::string& release, boost::posix_time::ptime& snapshotTime );
31  void insert( const std::string& name, cond::Time_t validity, const std::string& description, const std::string& release,
32  const boost::posix_time::ptime& snapshotTime, const boost::posix_time::ptime& insertionTime );
33  void update( const std::string& name, cond::Time_t validity, const std::string& description, const std::string& release,
34  const boost::posix_time::ptime& snapshotTime, const boost::posix_time::ptime& insertionTime );
35  private:
36  coral::ISchema& m_schema;
37  };
38  }
unsigned long long Time_t
Definition: Time.h:16
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
tuple description
Definition: idDealer.py:66
#define column(...)
Definition: DbCore.h:74
#define update(a, b)
cond::persistency::table ( TAG  )

Definition at line 13 of file IOVSchema.h.

References column, SurfaceDeformationFactory::create(), idDealer::description, edm::eventsetup::heterocontainer::insert(), mergeVDriftHistosByStation::name, python.IdGenerator::schema, benchmark_cfg::select, AlCaHLTBitMon_QueryRunRegistry::string, and update.

13  {
14 
15  column( NAME, std::string );
16  column( TIME_TYPE, cond::TimeType );
17  column( OBJECT_TYPE, std::string );
18  column( SYNCHRONIZATION, cond::SynchronizationType );
19  column( END_OF_VALIDITY, cond::Time_t );
20  column( DESCRIPTION, std::string );
21  column( LAST_VALIDATED_TIME, cond::Time_t );
22  column( INSERTION_TIME, boost::posix_time::ptime );
23  column( MODIFICATION_TIME, boost::posix_time::ptime );
24 
25  class Table : public ITagTable {
26  public:
27  explicit Table( coral::ISchema& schema );
28  virtual ~Table(){}
29  bool exists();
30  void create();
31  bool select( const std::string& name );
32  bool select( const std::string& name, cond::TimeType& timeType, std::string& objectType, cond::SynchronizationType& synchronizationType,
33  cond::Time_t& endOfValidity, std::string& description, cond::Time_t& lastValidatedTime );
34  bool getMetadata( const std::string& name, std::string& description,
35  boost::posix_time::ptime& insertionTime, boost::posix_time::ptime& modificationTime );
36  void insert( const std::string& name, cond::TimeType timeType, const std::string& objectType,
37  cond::SynchronizationType synchronizationType, cond::Time_t endOfValidity, const std::string& description,
38  cond::Time_t lastValidatedTime, const boost::posix_time::ptime& insertionTime );
39  void update( const std::string& name, cond::Time_t& endOfValidity, const std::string& description,
40  cond::Time_t lastValidatedTime, const boost::posix_time::ptime& updateTime );
41  void updateValidity( const std::string& name, cond::Time_t lastValidatedTime, const boost::posix_time::ptime& updateTime );
42  void setValidationMode(){}
43  private:
44  coral::ISchema& m_schema;
45  };
46  }
TimeType
Definition: Time.h:21
unsigned long long Time_t
Definition: Time.h:16
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
tuple description
Definition: idDealer.py:66
#define column(...)
Definition: DbCore.h:74
#define update(a, b)
SynchronizationType
Definition: Types.h:31
SurfaceDeformation * create(int type, const std::vector< double > &params)
cond::persistency::table ( GLOBAL_TAG_MAP  )

Definition at line 40 of file GTSchema.h.

References column, constexpr, edm::eventsetup::heterocontainer::insert(), run_regression::LABEL, python.IdGenerator::schema, benchmark_cfg::select, AlCaHLTBitMon_QueryRunRegistry::string, and o2o::tags.

40  {
41 
42  static constexpr unsigned int PAYLOAD_HASH_SIZE = 40;
43 
44  column( GLOBAL_TAG_NAME, std::string );
45  // to be changed to RECORD_NAME!
46  column( RECORD, std::string );
47  // to be changed to RECORD_LABEL!
49  column( TAG_NAME, std::string );
50 
51  class Table : public IGTMapTable {
52  public:
53  explicit Table( coral::ISchema& schema );
54  virtual ~Table(){}
55  bool exists();
56  bool select( const std::string& gtName, std::vector<std::tuple<std::string,std::string,std::string> >& tags );
57  bool select( const std::string& gtName, const std::string& preFix, const std::string& postFix,
58  std::vector<std::tuple<std::string,std::string,std::string> >& tags );
59  void insert( const std::string& gtName, const std::vector<std::tuple<std::string,std::string,std::string> >& tags );
60  private:
61  coral::ISchema& m_schema;
62  };
63  }
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
tuple tags
Definition: o2o.py:248
#define column(...)
Definition: DbCore.h:74
#define constexpr
cond::persistency::table ( PAYLOAD  )

Definition at line 48 of file IOVSchema.h.

References column, constexpr, SurfaceDeformationFactory::create(), cscdqm::DATA, cond::time::HASH, edm::eventsetup::heterocontainer::insert(), python.IdGenerator::schema, benchmark_cfg::select, AlCaHLTBitMon_QueryRunRegistry::string, and VERSION.

48  {
49 
50  static constexpr unsigned int PAYLOAD_HASH_SIZE = 40;
51 
52  column( HASH, std::string, PAYLOAD_HASH_SIZE );
53  column( OBJECT_TYPE, std::string );
55  column( STREAMER_INFO, cond::Binary );
57  column( INSERTION_TIME, boost::posix_time::ptime );
58 
59  class Table : public IPayloadTable {
60  public:
61  explicit Table( coral::ISchema& schema );
62  virtual ~Table(){}
63  bool exists();
64  void create();
65  bool select( const cond::Hash& payloadHash);
66  bool select( const cond::Hash& payloadHash, std::string& objectType,
67  cond::Binary& payloadData, cond::Binary& streamerInfoData);
68  bool getType( const cond::Hash& payloadHash, std::string& objectType );
69  bool insert( const cond::Hash& payloadHash, const std::string& objectType,
70  const cond::Binary& payloadData, const cond::Binary& streamerInfoData,
71  const boost::posix_time::ptime& insertionTime);
72  cond::Hash insertIfNew( const std::string& objectType, const cond::Binary& payloadData,
73  const cond::Binary& streamerInfoData, const boost::posix_time::ptime& insertionTime );
74  private:
75  coral::ISchema& m_schema;
76  };
77  }
std::string Hash
Definition: Types.h:43
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
#define column(...)
Definition: DbCore.h:74
#define VERSION
Definition: scimark2.h:5
SurfaceDeformation * create(int type, const std::vector< double > &params)
#define constexpr
cond::persistency::table ( IOV  )

Definition at line 79 of file IOVSchema.h.

References column, constexpr, SurfaceDeformationFactory::create(), cond::hash, python.IdGenerator::schema, cond::time::SINCE_GROUP_SIZE, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

79  {
80 
81  column( TAG_NAME, std::string );
82  column( SINCE, cond::Time_t );
83  column( PAYLOAD_HASH, std::string, PAYLOAD::PAYLOAD_HASH_SIZE );
84  column( INSERTION_TIME, boost::posix_time::ptime );
85 
86  struct MAX_SINCE {
87  typedef cond::Time_t type;
88  static constexpr size_t size = 0;
89  static std::string tableName(){ return SINCE::tableName(); }
90  static std::string fullyQualifiedName(){
91  return std::string("MAX(")+SINCE::fullyQualifiedName()+")";
92  }
93  };
94  struct SINCE_GROUP {
95  typedef cond::Time_t type;
96  static constexpr size_t size = 0;
97  static std::string tableName(){ return SINCE::tableName(); }
98  static std::string fullyQualifiedName(){
99  std::string sgroupSize = boost::lexical_cast<std::string>(cond::time::SINCE_GROUP_SIZE);
100  return "("+SINCE::fullyQualifiedName()+"/"+sgroupSize+")*"+sgroupSize;
101  }
102  };
103 
104  struct SEQUENCE_SIZE {
105  typedef unsigned int type;
106  static constexpr size_t size = 0;
107  static std::string tableName(){ return SINCE::tableName(); }
108  static std::string fullyQualifiedName(){
109  return "COUNT(*)";
110  }
111  };
112 
113  class Table : public IIOVTable {
114  public:
115  explicit Table( coral::ISchema& schema );
116  virtual ~Table(){}
117  bool exists();
118  void create();
119  size_t selectGroups( const std::string& tag, std::vector<cond::Time_t>& groups );
120  size_t selectSnapshotGroups( const std::string& tag, const boost::posix_time::ptime& snapshotTime,
121  std::vector<cond::Time_t>& groups );
122  size_t selectLatestByGroup( const std::string& tag, cond::Time_t lowerGroup, cond::Time_t upperGroup,
123  std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs);
124  size_t selectSnapshotByGroup( const std::string& tag, cond::Time_t lowerGroup, cond::Time_t upperGroup,
125  const boost::posix_time::ptime& snapshotTime,
126  std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs);
127  size_t selectLatest( const std::string& tag, std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs);
128  bool getLastIov( const std::string& tag, cond::Time_t& since, cond::Hash& hash );
129  bool getSize( const std::string& tag, size_t& size );
130  bool getSnapshotSize( const std::string& tag, const boost::posix_time::ptime& snapshotTime, size_t& size );
131  void insertOne( const std::string& tag, cond::Time_t since, cond::Hash payloadHash, const boost::posix_time::ptime& insertTime);
132  void insertMany( const std::string& tag, const std::vector<std::tuple<cond::Time_t,cond::Hash,boost::posix_time::ptime> >& iovs );
133  void erase( const std::string& tag );
134  private:
135  coral::ISchema& m_schema;
136  };
137  }
type
Definition: HCALResponse.h:21
static constexpr unsigned int SINCE_GROUP_SIZE
Definition: Time.h:35
unsigned long long Time_t
Definition: Time.h:16
std::string Hash
Definition: Types.h:43
#define column(...)
Definition: DbCore.h:74
SurfaceDeformation * create(int type, const std::vector< double > &params)
tuple size
Write out results.
#define constexpr
cond::persistency::table ( TAG_MIGRATION  )

Definition at line 140 of file IOVSchema.h.

References column, SurfaceDeformationFactory::create(), edm::eventsetup::heterocontainer::insert(), python.IdGenerator::schema, benchmark_cfg::select, and AlCaHLTBitMon_QueryRunRegistry::string.

140  {
141 
142  column( SOURCE_ACCOUNT, std::string );
143  column( SOURCE_TAG, std::string );
144  column( TAG_NAME, std::string );
145  column( STATUS_CODE, int );
146  column( INSERTION_TIME, boost::posix_time::ptime );
147 
148  class Table : public ITagMigrationTable {
149  public:
150  explicit Table( coral::ISchema& schema );
151  virtual ~Table(){}
152  bool exists();
153  void create();
154  bool select( const std::string& sourceAccount, const std::string& sourceTag, std::string& tagName, int& statusCode);
155  void insert( const std::string& sourceAccount, const std::string& sourceTag, const std::string& tagName,
156  int statusCode, const boost::posix_time::ptime& insertionTime);
157  void updateValidationCode( const std::string& sourceAccount, const std::string& sourceTag, int statusCode );
158  private:
159  coral::ISchema& m_schema;
160  };
161  }
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
#define column(...)
Definition: DbCore.h:74
SurfaceDeformation * create(int type, const std::vector< double > &params)
void cond::persistency::throwException ( const std::string &  message,
const std::string &  methodName 
)

Definition at line 11 of file Exception.cc.

References edm::hlt::Exception.

Referenced by L1CondDBIOVWriter::analyze(), L1CondDBPayloadWriter::analyze(), cond::persistency::GTEditor::checkTransaction(), cond::persistency::IOVEditor::checkTransaction(), cond::persistency::GTProxy::checkTransaction(), cond::persistency::IOVProxy::checkTransaction(), compareTags(), convertoToOracleConnection(), copyIov(), copyTag(), cond::persistency::Session::coralSession(), cond::persistency::Session::createGlobalTag(), cond::persistency::Session::createIov(), cond::persistency::Session::createIovForPayload(), cond::persistency::Query< Types...>::currentRow(), cond::persistency::OraIOVTable::erase(), fetch(), fetchOne(), cond::persistency::Session::fetchPayload(), cond::persistency::GTEditor::flush(), cond::persistency::IOVEditor::flush(), cond::persistency::KeyList::get(), getConnectionParams(), getConnectionProtocol(), cond::persistency::IOVProxy::getInterval(), import(), importIovs(), cond::persistency::OraIOVTable::insertMany(), cond::persistency::OraIOVTable::insertOne(), cond::persistency::SessionImpl::isOra(), cond::persistency::GTEditor::load(), cond::persistency::IOVProxy::load(), cond::persistency::GTProxy::load(), cond::persistency::PayloadProxy< std::vector< cond::Time_t > >::loadPayload(), makeHash(), cond::persistency::Query< Types...>::next(), cond::persistency::SessionImpl::openGTDb(), cond::persistency::SessionImpl::openIovDb(), cond::persistency::PayloadProxy< std::vector< cond::Time_t > >::operator()(), cond::persistency::GetFromRow< std::array< char, n > >::operator()(), parseConnectionString(), cond::CredentialStore::startSession(), cond::persistency::SessionImpl::startTransaction(), cond::persistency::OraIOVSchema::tagMigrationTable(), cond::persistency::OraTagTable::update(), cond::CredentialStore::updateConnection(), and cond::persistency::Session::updateMigrationLog().

12  {
13  throw Exception( message, methodName );
14  }
bool cond::persistency::validateTag ( const std::string &  refTag,
Session refSession,
const std::string &  candTag,
Session candSession 
)

Definition at line 262 of file CondDBTools.cc.

References compareTags(), cond::persistency::Session::connectionString(), gather_cfg::cout, dtTTrigAnalyzer_cfg::dbLabel, parseConnectionString(), cmsHarvester::path, python.multivaluedict::remove(), run_regression::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

265  {
266  std::cout <<" Validating..."<<std::endl;
267  std::tuple<std::string,std::string,std::string> connPars = persistency::parseConnectionString( refSession.connectionString() );
268  std::string dbLabel = std::get<2>( connPars );
269  std::string tagLabel = dbLabel+"_"+refTag;
270  std::string refFile = tagLabel+"_ref.db";
271  std::string candFile = tagLabel+"_cand.db";
272  bool ret = compareTags( refTag, refSession, refFile, candTag, candSession, candFile );
273  if( ret ) {
274  boost::filesystem::path refF( refFile );
275  if( boost::filesystem::exists(refF) ) boost::filesystem::remove( refF );
276  boost::filesystem::path candF( candFile );
277  if( boost::filesystem::exists(candF) ) boost::filesystem::remove( candF );
278  }
279  return ret;
280  }
std::tuple< std::string, std::string, std::string > parseConnectionString(const std::string &connectionString)
Definition: Utils.h:43
tuple path
else: Piece not in the list, fine.
tuple cout
Definition: gather_cfg.py:121
bool compareTags(const std::string &firstTag, Session &firstSession, const std::string &firstFileName, const std::string &secondTag, Session &secondSession, const std::string &secondFileName)
Definition: CondDBTools.cc:202