diff --git a/CondCore/DBOutputService/interface/OnlineDBOutputService.h b/CondCore/DBOutputService/interface/OnlineDBOutputService.h index e72dbed396b21..b65829cd42685 100644 --- a/CondCore/DBOutputService/interface/OnlineDBOutputService.h +++ b/CondCore/DBOutputService/interface/OnlineDBOutputService.h @@ -84,6 +84,7 @@ namespace cond { std::string m_omsServiceUrl; std::string m_lastLumiFile; std::string m_preLoadConnectionString; + std::string m_frontierKey; bool m_debug; }; //OnlineDBOutputService diff --git a/CondCore/DBOutputService/src/OnlineDBOutputService.cc b/CondCore/DBOutputService/src/OnlineDBOutputService.cc index babbf7d2a7731..0136c1fc6748b 100644 --- a/CondCore/DBOutputService/src/OnlineDBOutputService.cc +++ b/CondCore/DBOutputService/src/OnlineDBOutputService.cc @@ -84,10 +84,18 @@ cond::service::OnlineDBOutputService::OnlineDBOutputService(const edm::Parameter m_latencyInLumisections(iConfig.getUntrackedParameter("latency", 1)), m_omsServiceUrl(iConfig.getUntrackedParameter("omsServiceUrl", "")), m_preLoadConnectionString(iConfig.getUntrackedParameter("preLoadConnectionString", "")), + m_frontierKey(""), m_debug(iConfig.getUntrackedParameter("debugLogging", false)) { if (m_omsServiceUrl.empty()) { m_lastLumiFile = iConfig.getUntrackedParameter("lastLumiFile", ""); } + std::string frontierKeyFilePath(iConfig.getUntrackedParameter("frontierKeyFilePath", "")); + if (!frontierKeyFilePath.empty()) { + std::ifstream frontierKeyFile(frontierKeyFilePath); + if (!frontierKeyFile) + throw Exception(std::string("Can't access frontierKey file ") + frontierKeyFilePath); + frontierKeyFile >> m_frontierKey; + } } cond::service::OnlineDBOutputService::~OnlineDBOutputService() {} @@ -124,5 +132,10 @@ cond::Iov_t cond::service::OnlineDBOutputService::preLoadIov(const std::string& } cond::persistency::Session cond::service::OnlineDBOutputService::getReadOnlyCache(cond::Time_t targetTime) { - return PoolDBOutputService::newReadOnlySession(m_preLoadConnectionString, std::to_string(targetTime)); + std::stringstream transId; + transId << targetTime; + if (!m_frontierKey.empty()) { + transId << "_" << m_frontierKey; + } + return PoolDBOutputService::newReadOnlySession(m_preLoadConnectionString, transId.str()); } diff --git a/CondCore/DBOutputService/test/python/testLumiBasedUpdateAnalyzer_oracle.cfg.py b/CondCore/DBOutputService/test/python/testLumiBasedUpdateAnalyzer_oracle.cfg.py index 5276120555a44..586a1cc8c1498 100644 --- a/CondCore/DBOutputService/test/python/testLumiBasedUpdateAnalyzer_oracle.cfg.py +++ b/CondCore/DBOutputService/test/python/testLumiBasedUpdateAnalyzer_oracle.cfg.py @@ -32,12 +32,12 @@ messageLevel = cms.untracked.int32(1), authenticationPath = cms.untracked.string('.') ), - #timetype = cms.untracked.string('runnumber'), jobName = cms.untracked.string("TestLumiBasedUpdate"), connect = cms.string('oracle://cms_orcoff_prep/CMS_CONDITIONS'), preLoadConnectionString = cms.untracked.string('frontier://FrontierPrep/CMS_CONDITIONS'), runNumber = cms.untracked.uint64(options.runNumber), #lastLumiFile = cms.untracked.string('last_lumi.txt'), + #frontierKeyFilePath = cms.untracked.string('frontier.key'), writeTransactionDelay = cms.untracked.uint32(options.transDelay), autoCommit = cms.untracked.bool(True), saveLogsOnDB = cms.untracked.bool(True), diff --git a/CondCore/ESSources/plugins/CondDBESSource.cc b/CondCore/ESSources/plugins/CondDBESSource.cc index e54bfacd7c356..c6968fdee0217 100644 --- a/CondCore/ESSources/plugins/CondDBESSource.cc +++ b/CondCore/ESSources/plugins/CondDBESSource.cc @@ -98,6 +98,7 @@ namespace { CondDBESSource::CondDBESSource(const edm::ParameterSet& iConfig) : m_connection(), m_connectionString(""), + m_frontierKey(""), m_lastRun(0), // for the stat m_lastLumi(0), // for the stat m_policy(NOREFRESH), @@ -139,6 +140,11 @@ CondDBESSource::CondDBESSource(const edm::ParameterSet& iConfig) } else if (iConfig.exists("connect")) // default connection string m_connectionString = iConfig.getParameter("connect"); + // frontier key + if (iConfig.exists("frontierKey")) { + m_frontierKey = iConfig.getParameter("frontierKey"); + } + // snapshot boost::posix_time::ptime snapshotTime; if (iConfig.exists("snapshotTime")) { @@ -453,8 +459,10 @@ void CondDBESSource::setIntervalFor(const EventSetupRecordKey& iKey, << "Checking if the session must be closed and re-opened for getting correct conditions" << "; from CondDBESSource::setIntervalFor"; std::stringstream transId; - //transId << "long" << m_lastRun; transId << lastTime; + if (!m_frontierKey.empty()) { + transId << "_" << m_frontierKey; + } std::string connStr = m_connectionString; std::pair tagParams = cond::persistency::parseTag(tcIter->second.tagName()); if (!tagParams.second.empty()) diff --git a/CondCore/ESSources/plugins/CondDBESSource.h b/CondCore/ESSources/plugins/CondDBESSource.h index 7c6673e5421da..8635688c28bfc 100644 --- a/CondCore/ESSources/plugins/CondDBESSource.h +++ b/CondCore/ESSources/plugins/CondDBESSource.h @@ -110,6 +110,7 @@ class CondDBESSource : public edm::eventsetup::DataProxyProvider, public edm::Ev cond::persistency::ConnectionPool m_connection; std::string m_connectionString; + std::string m_frontierKey; // Container of DataProxy, implemented as multi-map keyed by records ProxyMap m_proxies; diff --git a/CondCore/ESSources/test/python/loadall_from_one_record_empty_source_cfg.py b/CondCore/ESSources/test/python/loadall_from_one_record_empty_source_cfg.py index f8674b986b057..efc00d3a582be 100644 --- a/CondCore/ESSources/test/python/loadall_from_one_record_empty_source_cfg.py +++ b/CondCore/ESSources/test/python/loadall_from_one_record_empty_source_cfg.py @@ -107,6 +107,7 @@ DBParameters = CondDBParameters, connect = cms.string( options.connectionString ), snapshotTime = cms.string( options.snapshotTime ), + frontierKey = cms.string('abcdefghijklmnopqrstuvwxyz0123456789'), toGet = cms.VPSet(cms.PSet( record = cms.string('BeamSpotObjectsRcd'), tag = cms.string( options.tag ),