32 #include <TObjString.h> 33 #include <TSAXParser.h> 64 fgInstance->InitFromCache(entryCache,run);
77 static int hltOnlineMode = getenv(
"HLT_ONLINE_MODE") && strcmp(getenv(
"HLT_ONLINE_MODE"),
"on") == 0;
78 if(!hltOnlineMode && !gSystem->Exec(
"root-config --has-alien 2>/dev/null |grep yes 2>&1 > /dev/null")){
79 AliInfo(
"AliEn classes enabled in Root. AliCDBGrid factory registered.");
94 TIter iter(entryCache->GetTable());
97 while((pair = dynamic_cast<TPair*> (iter.Next()))){
102 entryCache->SetOwnerKeyValue(kFALSE,kFALSE);
116 if (!f || f->IsZombie()){
117 AliError(Form(
"Cannot open file %s",snapshotFileName));
121 AliInfo(Form(
"Dumping entriesMap (entries'cache) with %d entries!\n",
fEntryCache.GetEntries()));
122 AliInfo(Form(
"Dumping entriesList with %d entries!\n",
fIds->GetEntries()));
128 f->WriteObject(
fIds,
"CDBidsList");
133 while((pair = dynamic_cast<TPair*> (iter.Next()))){
134 TObjString *os =
dynamic_cast<TObjString*
>(pair->Key());
136 TString
path = os->GetString();
138 if (!entry)
continue;
139 path.ReplaceAll(
"/",
"*");
140 entry->Write(path.Data());
143 f->WriteObject(
fStorageMap,
"CDBSnapshotEntriesMap");
144 f->WriteObject(
fIds,
"CDBSnapshotIdsList");
157 TFile *
f =
TFile::Open(lightSnapshotFileName,
"RECREATE");
158 if (!f || f->IsZombie()){
159 AliError(Form(
"Cannot open file %s",lightSnapshotFileName));
163 AliInfo(Form(
"Dumping map of storages with %d entries!\n",
fStorageMap->GetEntries()));
164 AliInfo(Form(
"Dumping entriesList with %d entries!\n",
fIds->GetEntries()));
166 f->WriteObject(
fIds,
"CDBidsList");
180 AliError(
"Being locked I cannot initialize from the snapshot!");
185 TString snapshotFile(snapshotFileName);
186 if(snapshotFile.BeginsWith(
"alien://")){
188 TGrid::Connect(
"alien://",
"");
190 AliError(
"Connection to alien failed!");
197 if (!f || f->IsZombie()){
198 AliError(Form(
"Cannot open file %s",snapshotFileName));
203 TMap *entriesMap = 0;
204 TIter next(f->GetListOfKeys());
206 while ((key = (TKey*)next())) {
207 if (strcmp(key->GetClassName(),
"TMap") != 0)
continue;
208 entriesMap = (TMap*)key->ReadObj();
211 if (!entriesMap || entriesMap->GetEntries()==0){
212 AliError(
"Cannot get valid map of CDB entries from snapshot file");
218 TIter nextKey(f->GetListOfKeys());
220 while ((keyN = (TKey*)nextKey())) {
221 if (strcmp(keyN->GetClassName(),
"TList") != 0)
continue;
222 idsList = (TList*)keyN->ReadObj();
225 if (!idsList || idsList->GetEntries()==0){
226 AliError(
"Cannot get valid list of CDB entries from snapshot file");
235 TIter iterObj(entriesMap->GetTable());
238 while((pair = dynamic_cast<TPair*> (iterObj.Next()))){
239 TObjString* os = (TObjString*) pair->Key();
240 TString
path = os->GetString();
241 TIter iterId(idsList);
244 while((
id = dynamic_cast<AliCDBId*> (iterId.Next()))){
251 if(!correspondingId){
252 AliError(Form(
"id for \"%s\" not found in the snapshot (while entry was). This entry is skipped!",path.Data()));
256 Bool_t registeredId = kFALSE;
259 while((idT = dynamic_cast<AliCDBId*> (iter.Next()))){
261 registeredId = kTRUE;
267 if(cached || registeredId){
268 AliWarning(Form(
"An entry was already cached for \"%s\". Removing it before caching from snapshot",path.Data()));
275 if(cached || registeredId){
276 AliWarning(Form(
"An entry was already cached for \"%s\". Not adding this object from snapshot",path.Data()));
287 entriesMap->SetOwnerKeyValue(kFALSE,kFALSE);
288 fIds->SetOwner(kTRUE);
289 idsList->SetOwner(kFALSE);
290 AliInfo(Form(
"%d new (entry,id) cached. Total number %d",nAdded,
fEntryCache.GetEntries()));
413 TString uriString(dbString);
415 if ( !
fCvmfsOcdb.IsNull() && uriString.BeginsWith(
"alien://")) {
424 if(param)
return param;
434 TObjArray *arr = uriString.Tokenize(
'?');
437 TString entryKey =
"";
438 TString entryValue =
"";
439 TString newUriString =
"";
440 while((str = (TObjString*) iter.Next())){
441 TString entry(str->String());
442 Int_t indeq = entry.Index(
'=');
443 entryKey = entry(0, indeq+1);
444 entryValue = entry(indeq+1, entry.Length()-indeq);
446 if ( entryKey.Contains(
"folder", TString::kIgnoreCase) )
448 TRegexp re_RawFolder(
"^/alice/data/20[0-9]+/OCDB");
449 TRegexp re_MCFolder(
"^/alice/simulation/2008/v4-15-Release");
450 TString rawFolder = entryValue(re_RawFolder);
451 TString mcFolder = entryValue(re_MCFolder);
453 gSystem->ExpandPathName(cvmfsUri);
454 cvmfsUri = cvmfsUri.Strip(TString::kTrailing,
'/');
455 cvmfsUri.Append(
"/calibration");
456 if ( !rawFolder.IsNull() ){
457 entryValue.Replace(0, 6, cvmfsUri);
459 }
else if ( !mcFolder.IsNull() ){
460 cvmfsUri.Append(
"/MC");
461 entryValue.Replace(0, 36, cvmfsUri);
463 AliFatal(Form(
"Environment variable for cvmfs OCDB folder set for an invalid OCDB storage:\n %s", entryValue.Data()));
466 newUriString += entryKey;
468 newUriString += entryValue;
471 newUriString.Prepend(
"local://");
472 newUriString.Remove(TString::kTrailing,
'?');
473 uriString = newUriString;
481 TString uriString(dbString);
482 if (uriString.EqualTo(
"raw://")) {
486 TString lhcPeriod(
"");
487 Int_t startRun = -1, endRun = -1;
488 TString cvmfsOcdb(gSystem->Getenv(
"OCDB_PATH"));
489 if (! cvmfsOcdb.IsNull()){
500 AliError(Form(
"Failed to activate requested storage! Check URI: %s", dbString));
524 AliFatal(
"Lock is ON, and default storage is already set: " 525 "cannot reset it or activate more storages!");
535 aStorage = factory->
Create(param);
540 if( aStorage->
GetType() ==
"alien" || aStorage->
GetType() ==
"local" )
548 AliError(Form(
"Failed to activate requested storage! Check URI: %s", param->
GetURI().Data()));
565 TList* result =
new TList();
569 while ((aPair = (TPair*) iter.Next())) {
570 result->Add(aPair->Value());
601 AliDebug(2,
"Draining into drain storage...");
611 TString cvmfsUploadExecutable(
"$HOME/bin/ocdb-cvmfs");
612 gSystem->ExpandPathName(cvmfsUploadExecutable);
613 if ( gSystem->AccessPathName(cvmfsUploadExecutable) )
625 TString cvmfsOcdb(gSystem->Getenv(
"OCDB_PATH"));
626 if (! cvmfsOcdb.IsNull()){
632 TString uriTemp(storageUri);
633 if (uriTemp ==
"raw://") {
635 AliInfo(
"Setting the run-number will set the corresponding OCDB for raw data reconstruction.");
646 AliWarning(
"Existing default storage replaced: clearing cache!");
667 AliWarning(
"Existing default storage replaced: clearing cache!");
684 AliFatal(
"Lock is ON, and default storage is already set: " 685 "cannot reset it or activate more storages!");
699 AliWarning(
"Existing default storage replaced: clearing cache!");
715 TString strmcString(mcString);
716 TString strsimType(simType);
718 if (strmcString !=
"MC"){
719 AliFatal(
"Method requires first string to be MC!");
722 if (strsimType ==
"Ideal"){
725 else if (strsimType ==
"Full"){
728 else if (strsimType ==
"Residual"){
732 AliFatal(
"Error in setting the storage for MC data, second argument MUST be either \"Ideal\" or \"Full\" or \"Residual\".");
745 gSystem->ExpandPathName(cvmfsPath);
746 if (gSystem->AccessPathName(cvmfsPath))
747 AliFatal(Form(
"OCDB_PATH set to an invalid path: %s", cvmfsPath.Data()));
749 AliDebug(3,
"OCDB_PATH envvar is set. Changing OCDB storage from alien:// to local:///cvmfs type.");
750 cvmfsPath = cvmfsPath.Strip(TString::kTrailing,
'/');
751 cvmfsPath.Append(
"/calibration/data/OCDBFoldervsRunRange.xml");
752 if (gSystem->AccessPathName(cvmfsPath))
753 AliFatal(Form(
"Cannot find valid file OCDBFoldervsRunRange.xml in: %s", cvmfsPath.Data()));
763 AliFatal(
"Lock is ON, and default storage is already set: " 764 "cannot activate default storage from run number");
768 TString lhcPeriod(
"");
769 Int_t startRun = 0, endRun = 0;
791 TGrid::Connect(
"alien://",
"");
793 AliError(
"Connection to alien failed!");
798 TString rndname = gSystem->TempDirectory();
800 rndname +=
"OCDBFolderXML.";
801 rndname += uuid.AsString();
805 AliFatal(Form(
"Cannot make a local copy of OCDBFolder xml file in %s",rndname.Data()));
809 TSAXParser *saxParser =
new TSAXParser();
810 saxParser->ConnectToHandler(
"AliCDBHandler", saxcdb);
811 saxParser->ParseFile(rndname.Data());
826 TSAXParser *saxParser =
new TSAXParser();
827 saxParser->ConnectToHandler(
"AliCDBHandler", saxcdb);
829 gSystem->ExpandPathName(cvmfsUri);
830 cvmfsUri = cvmfsUri.Strip(TString::kTrailing,
'/');
831 cvmfsUri.Append(
"/calibration/data/OCDBFoldervsRunRange.xml");
832 saxParser->ParseFile(cvmfsUri);
848 AliFatal(
"Lock is ON: cannot unset default storage!");
885 AliError(
"Please activate a default storage first!");
891 AliError(Form(
"Not a valid path: %s", calibType));
895 TObjString *objCalibType =
new TObjString(aPath.
GetPath());
897 AliWarning(Form(
"Storage \"%s\" already activated! It will be replaced by the new one",
900 if(checkPar)
delete checkPar;
904 if(!aStorage)
return;
907 UInt_t uId = ((subVersion+1)<<16) + (version+1);
909 specificParam->SetUniqueID(uId);
924 if(!calibPath.
IsValid())
return NULL;
928 AliError(Form(
"%s storage not found!", calibType));
941 if(!aPath.
IsValid())
return NULL;
944 TObjString *aCalibType=0;
947 while((aCalibType = (TObjString*) iter.Next())){
948 AliCDBPath calibTypePath(aCalibType->GetName());
949 if(calibTypePath.Comprises(aPath)) {
950 if(calibTypePath.Comprises(tmpPath))
continue;
952 tmpPath.
SetPath(calibTypePath.GetPath());
960 Int_t version, Int_t subVersion) {
966 AliError(
"Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
972 return Get(
AliCDBId(path, runNumber, runNumber, version, subVersion));
981 return Get(
AliCDBId(path, runRange, version, subVersion));
997 AliError(Form(
"Unspecified query: %s",
1003 AliFatal(
"Lock is ON: cannot use different run number than the internal one!");
1006 AliWarning(
"Run number explicitly set in query: CDB cache temporarily disabled!");
1014 AliDebug(2, Form(
"Object %s retrieved from PROMPT cache !!",queryId.
GetPath().Data()));
1022 AliDebug(2, Form(
"Object %s retrieved from cache !!",queryId.
GetPath().Data()));
1034 AliInfo(Form(
"Object \"%s\" retrieved from the snapshot.",queryId.
GetPath().Data()));
1053 Int_t version = -1, subVersion = -1;
1057 TString str = aPar->
GetURI();
1058 UInt_t uId = aPar->GetUniqueID();
1059 version = Int_t(uId&0xffff) - 1;
1060 subVersion = Int_t(uId>>16) - 1;
1061 AliDebug(2,Form(
"Looking into storage: %s",str.Data()));
1064 AliDebug(2,
"Looking into default storage");
1069 AliDebug(2,Form(
"Specific version set to: %d", version));
1072 if(subVersion >= 0) {
1073 AliDebug(2,Form(
"Specific subversion set to: %d", subVersion));
1076 entry = aStorage->
Get(finalQueryId);
1082 if(entry && !
fIds->Contains(&entry->
GetId())){
1094 return dynamic_cast<TMap*
>(
fSnapshotFile->Get(
"CDBSnapshotEntriesMap"));
1103 return dynamic_cast<TList*
>(
fSnapshotFile->Get(
"CDBSnapshotIdsList"));
1111 TString sPath(path);
1112 sPath.ReplaceAll(
"/",
"*");
1114 AliError(
"No snapshot file is open!");
1119 AliDebug(2,Form(
"Cannot get a CDB entry for \"%s\" from snapshot file",path));
1131 AliError(
"Cannot set the CDB manage in snapshot mode if the cache is not active!");
1136 TString snapshotFile(snapshotFileName);
1137 if(snapshotFile.BeginsWith(
"alien://")){
1139 TGrid::Connect(
"alien://",
"");
1141 AliError(
"Connection to alien failed!");
1149 AliError(Form(
"Cannot open file %s",snapshotFileName));
1153 AliInfo(
"The CDB manager is set in snapshot mode!");
1168 return aPar->
GetURI().Data();
1183 AliWarning(
"Run-range not yet set for the current LHC period.");
1193 AliWarning(
"Run-range not yet set for the current LHC period.");
1202 AliWarning(
"LHC period (OCDB folder) not yet set");
1208 Int_t version, Int_t subVersion) {
1215 AliError(
"Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
1221 return GetId(
AliCDBId(path, runNumber, runNumber, version, subVersion));
1231 return GetId(
AliCDBId(path, runRange, version, subVersion));
1253 AliError(Form(
"Unspecified query: %s",
1259 AliWarning(
"Run number explicitly set in query: CDB cache temporarily disabled!");
1268 AliDebug(2, Form(
"Object %s retrieved from cache !!",query.
GetPath().Data()));
1278 TString str = aPar->
GetURI();
1279 AliDebug(2,Form(
"Looking into storage: %s",str.Data()));
1283 AliDebug(2,
"Looking into default storage");
1286 return aStorage->
GetId(query);
1292 Int_t version, Int_t subVersion) {
1298 AliError(
"Run number neither specified in query nor set in AliCDBManager! Use AliCDBManager::SetRun.");
1310 const AliCDBRunRange& runRange, Int_t version, Int_t subVersion) {
1336 AliError(
"Query too generic in this context!");
1341 AliError(Form(
"Unspecified run or runrange: %s",
1347 AliFatal(
"Lock is ON: cannot use different run number than the internal one!");
1354 AliDebug(2,Form(
"Looking into storage: %s", aPar->
GetURI().Data()));
1358 AliDebug(2,Form(
"Looking into default storage: %s", aStorage->GetURI().Data()));
1362 if(aStorage) result = aStorage->GetAll(query);
1363 if(!result)
return 0;
1367 AliInfo(
"Now look into all other specific storages...");
1372 while((chkEntry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
1376 if (!chkPar || aPar == chkPar)
continue;
1378 AliDebug(2, Form(
"Found specific storage! %s", chkPar->
GetURI().Data()));
1381 UInt_t uId = chkPar->GetUniqueID();
1382 Int_t version = -1, subVersion = -1;
1383 version = Int_t(uId&0xffff) - 1;
1384 subVersion = Int_t(uId>>16) - 1;
1397 if(chkStorage) newEntry = chkStorage->
Get(chkId);
1398 if(!newEntry)
continue;
1402 delete result->Remove(chkEntry);
1403 result->AddFirst(newEntry);
1406 Int_t nEntries = result->GetEntries();
1407 AliInfo(
"After look into other specific storages, result list is:");
1408 for(
int i=0; i<nEntries;i++){
1417 while((entry = dynamic_cast<AliCDBEntry*> (iter.Next()))){
1436 AliError(
"Null Entry! No storage will be done!");
1441 return Put(&anEntry, mirrors, type);
1461 AliError(
"No valid object in CDB entry!");
1466 AliError(Form(
"Invalid entry ID: %s",
1472 AliError(Form(
"Unspecified entry ID: %s",
1498 AliDebug(2,Form(
"Storing object into storage: %s", aStorage->
GetURI().Data()));
1500 TString strMirrors(mirrors);
1501 Bool_t result = kFALSE;
1502 if(!strMirrors.IsNull() && !strMirrors.IsWhitespace())
1503 result = aStorage->
Put(entry, mirrors, type);
1505 result = aStorage->
Put(entry,
"", type);
1518 AliInfo(
"The default storage is not of type \"alien\". Settings for Storage Elements are not taken into account!");
1528 AliInfo(
"The default storage is not of type \"alien\". Settings for Storage Elements are not taken into account!");
1541 AliDebug(2, Form(
"Object %s already in cache !!", path));
1544 AliDebug(2,Form(
"Caching entry %s", path));
1556 TString output=Form(
"Run number = %d; ",
fRun);
1557 output +=
"Cache is ";
1558 if(!
fCache) output +=
"NOT ";
1559 output += Form(
"ACTIVE; Number of active storages: %d\n",
fActiveStorages.GetEntries());
1569 while((aPair = (TPair*) iter.Next())){
1570 output += Form(
"\t*** Specific storage %d: Path \"%s\" -> URI \"%s\"\n",
1571 i++, ((TObjString*) aPair->Key())->GetName(),
1590 AliFatal(
"Lock is ON, cannot reset run number!");
1597 if (fStartRunLHCPeriod <= run && fEndRunLHCPeriod >= run){
1598 AliInfo(
"LHCPeriod alien folder for current run already in memory");
1612 if (
fRun > -1)
AliFatal(
"Cannot call AliCDBManager::SetMaxDate() after run was set!");
1656 AliDebug(2, Form(
"No active storages. Object \"%s\" is not unloaded from cache", path));
1661 if(!queryPath.
IsValid())
return;
1665 AliDebug(2, Form(
"Unloading object \"%s\" from cache and from list of ids", path));
1666 TObjString pathStr(path);
1678 AliWarning(Form(
"Cache does not contain object \"%s\"!", path));
1689 while((pair = dynamic_cast<TPair*> (iter.Next()))){
1690 AliCDBPath entryPath = pair->Key()->GetName();
1692 AliDebug(2, Form(
"Unloading object \"%s\" from cache and from list of ids", entryPath.
GetPath().Data()));
1693 TObjString pathStr(entryPath.
GetPath());
1711 AliDebug(2,Form(
"Cache entries and ids removed: %d Remaining: %d",removed,
fEntryCache.GetEntries()));
1743 AliError(
"Run number not yet set! Use AliCDBManager::SetRun.");
1747 AliError(
"Default storage is not set! Use AliCDBManager::SetDefaultStorage");
1758 TObjString *aCalibType=0;
1760 while((aCalibType = dynamic_cast<TObjString*> (iter.Next()))){
1763 AliDebug(2,Form(
"Querying specific storage %s",aCalibType->GetName()));
1765 if(aStorage->
GetType() ==
"alien" || aStorage->
GetType() ==
"local"){
1770 "Skipping query for valid files, it is used only in grid...");
1797 TString f1Str(cdbFile1);
1798 TString f2Str(cdbFile2);
1799 if (!gGrid && ( f1Str.BeginsWith(
"alien://") || f2Str.BeginsWith(
"alien://") ))
1800 TGrid::Connect(
"alien://");
1804 Printf(
"Cannot open file \"%s\"",cdbFile1);
1809 Printf(
"Cannot open file \"%s\"",cdbFile2);
1815 Printf(
"Cannot get CDB entry from file \"%s\"",cdbFile1);
1820 Printf(
"Cannot get CDB entry from file \"%s\"",cdbFile2);
1827 TMessage * file1 =
new TMessage(TBuffer::kWrite);
1828 file1->WriteObject(object1);
1829 Int_t size1 = file1->Length();
1830 TMessage * file2 =
new TMessage(TBuffer::kWrite);
1831 file2->WriteObject(object2);
1832 Int_t size2 = file2->Length();
1834 Printf(
"Problem 2: OCDB entry of different size (%d,%d)",size1,size2);
1840 char* buf1 = file1->Buffer();
1841 char* buf2 = file2->Buffer();
1843 for(Int_t i=0; i<size1; i++)
1844 if (buf1[i]!=buf2[i]) countDiff++;
1847 Printf(
"The CDB objects differ by %d bytes.", countDiff);
1851 Printf(
"The CDB objects are the same in the two files.");
1900 AliError(Form(
"Not a valid path: %s", path));
1913 ULong64_t msk=0x0000000ffffffff;
1914 if (
fLock == lock)
return 0;
1920 AliFatal(
"Wrong key provided to lock CDB. Please remove CDB lock access from your code !");
1925 fKey = gSystem->Now();
1928 SetUniqueID(UInt_t(
fKey&msk));
1933 AliFatal(
"Lock is ON: wrong key provided");
1968 if (!(sbs=url(
"\\?User=[^?]*")).IsNull()) url.ReplaceAll(sbs,
"");
1969 if (!(sbs=url(
"\\?DBFolder=[^?]*")).IsNull()) url.ReplaceAll(
"?DB",
"");
1970 if (!(sbs=url(
"\\?SE=[^?]*")).IsNull()) url.ReplaceAll(sbs,
"");
1971 if (!(sbs=url(
"\\?CacheFolder=[^?]*")).IsNull()) url.ReplaceAll(sbs,
"");
1972 if (!(sbs=url(
"\\?OperateDisconnected=[^?]*")).IsNull()) url.ReplaceAll(sbs,
"");
1973 if (!(sbs=url(
"\\?CacheSize=[^?]*")).IsNull()) url.ReplaceAll(sbs,
"");
1974 if (!(sbs=url(
"\\?CleanupInterval=[^?]*")).IsNull()) url.ReplaceAll(sbs,
"");
1975 Bool_t slash=kFALSE,space=kFALSE;
1976 while ( (slash=url.EndsWith(
"/")) || (space=url.EndsWith(
" ")) ) {
1977 if (slash) url = url.Strip(TString::kTrailing,
'/');
1978 if (space) url = url.Strip(TString::kTrailing,
' ');
1990 TPair* pair =
static_cast<TPair*
>(fEntryCache.FindObject(path));
1993 AliDebug(2, Form(
"Object %s already in cache, replacing!!", path));
1994 TObject* key = pair->Key();
1995 TObject* value = pair->Value();
1996 fEntryCache.Remove(key);
2000 AliDebug(2,Form(
"Caching entry %s", path));
2001 fPromptEntryCache.Add(
new TObjString(path), entry);
2002 SetPromptCacheFlag(kTRUE);
2011 cdbListCopy.Clear();
2012 cdbMapCopy.SetOwner(1);
2013 cdbListCopy.SetOwner(1);
2014 const TMap* mapCDB = GetStorageMap(), *mapSNP = GetSnapshotMap();
2015 const TList* lstCDB = GetRetrievedIds(), *lstSNP = GetSnapshotRetrievedIds();
2017 if (!mapCDB || !lstCDB)
return;
2021 TString defSNP,defCDB;
2024 TIter iterCDBMap(mapCDB->GetTable());
2025 while((pair = dynamic_cast<TPair*> (iterCDBMap.Next()))) {
2026 TObjString* keyStr =
dynamic_cast<TObjString*
> (pair->Key());
2027 TObjString* valStr =
dynamic_cast<TObjString*
> (pair->Value());
2028 if (!keyStr || !valStr)
continue;
2029 TString nms = keyStr->String();
2030 if (nms==
"default") {
2031 defCDB = valStr->String();
2032 if (mapSNP)
continue;
2034 cdbMapCopy.Add(
new TObjString(keyStr->GetName()),
new TObjString(valStr->GetName()));
2039 TIter iterSNPMap(mapSNP->GetTable());
2040 while((pair = dynamic_cast<TPair*> (iterSNPMap.Next()))) {
2041 TObjString* keyStr =
dynamic_cast<TObjString*
> (pair->Key());
2042 TObjString* valStr =
dynamic_cast<TObjString*
> (pair->Value());
2043 if (!keyStr || !valStr)
continue;
2044 TString nms = keyStr->String();
2045 if (nms==
"default") {
2046 defSNP = valStr->String();
2049 if (mapCDB->FindObject(nms.Data()))
continue;
2051 cdbMapCopy.Add(
new TObjString(keyStr->GetName()),
new TObjString(valStr->GetName()));
2058 TIter iterCDBLst(lstCDB);
2060 while( (
id = dynamic_cast<AliCDBId*>(iterCDBLst.Next())) ) {
2061 TString
path =
id->GetPath();
2062 if (!mapCDB->FindObject(path.Data()) && (lstSNP && !lstSNP->FindObject(path.Data())) ) {
2063 cdbMapCopy.Add(
new TObjString(path.Data()),
new TObjString(defCDB.Data()));
2066 cdbListCopy.Add(
new TObjString(id->
ToString().Data()));
Bool_t IsAnyRange() const
AliCDBEntry * Get(const AliCDBId &query)
const TString & GetURI() const
TFile * Open(const char *filename, Long64_t &nevents)
AliCDBEntry * GetEntryFromSnapshot(const char *path)
void SetDefaultStorageFromRun(Int_t run)
static TString fgkCondUri
const TString & GetPath() const
void SetPath(const char *path)
Bool_t Comprises(const AliCDBPath &other) const
Bool_t Put(TObject *object, AliCDBId &id, AliCDBMetaData *metaData, const char *mirrors="", AliCDBManager::DataType type=AliCDBManager::kPrivate)
void RegisterFactory(AliCDBStorageFactory *factory)
AliCDBStorage * GetSpecificStorage(const char *calibType)
ULong64_t fKey
max UNIX timestamp for OCDB objects
void CreateMapListCopy(TMap &mapCopy, TList &listCopy) const
static AliCDBManager * fgInstance
virtual AliCDBParam * CloneParam() const =0
void ExtractBaseFolder(TString &url)
time_t GetMaxDate() const
Bool_t fCache
The run number.
void SetRunRange(Int_t firstRun, Int_t lastRun)
Bool_t fPromptCache
The cache flag.
Int_t GetEndRunRange() const
const TString & GetType() const
Bool_t fSnapshotMode
Lock flag, if ON default storage and run number cannot be reset.
const char * GetMirrorSEs() const
AliCDBParam * CreateParameter(const char *dbString) const
void DumpToSnapshotFile(const char *snapshotFileName, Bool_t singleKeys) const
void SetMaxDate(time_t maxDate)
void PutActiveStorage(AliCDBParam *param, AliCDBStorage *storage)
AliCDBParam * fCondParam
pointer to drain storage
void SetSubVersion(Int_t subVersion)
void SetURI(const TString &uri)
static TString fgkMCFullStorage
AliCDBStorage * fDrainStorage
pointer to default storage
TString GetOCDBFolder() const
Int_t GetEndRunLHCPeriod()
virtual AliCDBStorage * Create(const AliCDBParam *param)=0
const TString & GetURI() const
AliCDBId * GetId(const AliCDBId &query)
virtual const char * GetMirrorSEs() const
void InitFromCache(TMap *entryCache, Int_t run)
TList * fShortLived
list of storages (to be streamed to file)
void PromptCacheEntry(const char *calibType, AliCDBEntry *entry)
void DestroyActiveStorages()
#define AliWarning(message)
Bool_t Drain(AliCDBEntry *entry)
Bool_t IsShortLived(const char *path)
void CacheEntry(const char *path, AliCDBEntry *entry)
AliCDBEntry * Get(const AliCDBId &query, Bool_t forceCaching=kFALSE)
static TString fgkMCResidualStorage
static const char * GetDataTypeName(DataType type)
TMap fActiveStorages
list of registered storage factories
TList * GetActiveStorages()
void SetMaxDate(time_t maxDate)
void SetVersion(Int_t version)
AliCDBStorage * GetStorage(const char *dbString)
void SetSpecificStorage(const char *calibType, const char *dbString, Int_t version=-1, Int_t subVersion=-1)
TMap * fStorageMap
List of the retrieved object Id's (to be streamed to file)
TFile * fSnapshotFile
flag saying if we are in snapshot mode
void UnsetDefaultStorage()
TList * GetAll(const AliCDBId &query)
Bool_t HasStorage(const char *dbString) const
TList * fIds
cache for in-memory objects to override objects on storage (to be used online)
TMap fSpecificStorages
list of active storages
Bool_t SetOCDBUploadMode()
AliCDBId * GetId(const AliCDBId &query)
Bool_t fRaw
flag for uploads to Official CDBs (upload to cvmfs must follow upload to AliEn)
Bool_t Put(TObject *object, const AliCDBId &id, AliCDBMetaData *metaData, const char *mirrors="", DataType type=kPrivate)
void QueryCDB(Int_t run, const char *pathFilter="*", Int_t version=-1, AliCDBMetaData *mdFilter=0)
void GetLHCPeriodAgainstAlienFile(Int_t run, TString &lhcPeriod, Int_t &startRun, Int_t &endRun)
virtual void SetMirrorSEs(const char *mirrors)
void SetDrain(const char *dbString)
#define AliFatal(message)
void SetDefaultStorage(const char *dbString)
void UnloadFromCache(const char *path)
void Print(Option_t *option="") const
Bool_t DiffObjects(const char *cdbFile1, const char *cdbFile2) const
virtual AliCDBParam * CreateParameter(const char *dbString)=0
#define AliDebug(logLevel, message)
Int_t GetStartRunLHCPeriod()
void DumpToLightSnapshotFile(const char *lightSnapshotFileName) const
void AlienToCvmfsUri(TString &uriString) const
Int_t GetStartRunRange() const
void DestroyActiveStorage(AliCDBStorage *storage)
const TMap * GetSnapshotMap() const
const TString & GetPath() const
AliCDBStorage * GetDefaultStorage() const
static TString fgkMCIdealStorage
Bool_t InitFromSnapshot(const char *snapshotFileName, Bool_t overwrite=kTRUE)
ULong64_t SetLock(Bool_t lockFlag=kTRUE, ULong64_t key=0)
Bool_t IsSpecified() const
Bool_t IsWildcard() const
void SetOwner(Bool_t owner)
#define AliError(message)
virtual Bool_t Validate(const char *dbString)=0
const char * GetURI(const char *path)
Bool_t IsDefaultStorageSet() const
void SetMirrorSEs(const char *mirrors)
AliCDBStorage * GetActiveStorage(const AliCDBParam *param)
TMap fEntryCache
list of detector-specific storages
Int_t GetFirstRun() const
TMap fPromptEntryCache
cache of the retrieved objects
Bool_t SetSnapshotMode(const char *snapshotFileName="OCDB.root")
AliCDBParam * SelectSpecificStorage(const TString &path)
void GetLHCPeriodAgainstCvmfsFile(Int_t run, TString &lhcPeriod, Int_t &startRun, Int_t &endRun)
void ValidateCvmfsCase() const
Bool_t fLock
The prompt cache flag.
static TString fgkOCDBFolderXMLfile
AliCDBStorage * fDefaultStorage
List of short lived objects.
const TList * GetSnapshotRetrievedIds() const
Int_t GetSubVersion() const