1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /////////////////////////////////////////////////////////////////////////////////////////////////
19 // access class to a DataBase in an AliEn storage //
21 /////////////////////////////////////////////////////////////////////////////////////////////////
25 #include <TGridResult.h>
30 #include <TObjArray.h>
31 #include <TObjString.h>
36 #include "AliCDBEntry.h"
37 #include "AliCDBGrid.h"
38 #include "AliCDBManager.h"
43 //_____________________________________________________________________________
44 AliCDBGrid::AliCDBGrid(const char *gridUrl, const char *user, const char *dbFolder,
45 const char *se, const char* cacheFolder, Bool_t operateDisconnected,
46 Long64_t cacheSize, Long_t cleanupInterval) :
53 fCacheFolder(cacheFolder),
54 fOperateDisconnected(operateDisconnected),
55 fCacheSize(cacheSize),
56 fCleanupInterval(cleanupInterval)
60 // if the same Grid is alreay active, skip connection
61 if (!gGrid || fGridUrl != gGrid->GridUrl()
62 || (( fUser != "" ) && ( fUser != gGrid->GetUser() )) ) {
63 // connection to the Grid
64 AliInfo("Connection to the Grid...");
66 AliInfo(Form("gGrid = %p; fGridUrl = %s; gGrid->GridUrl() = %s",gGrid,fGridUrl.Data(), gGrid->GridUrl()));
67 AliInfo(Form("fUser = %s; gGrid->GetUser() = %s",fUser.Data(), gGrid->GetUser()));
69 TGrid::Connect(fGridUrl.Data(),fUser.Data());
73 AliError("Connection failed!");
77 TString initDir(gGrid->Pwd(0));
78 if (fDBFolder[0] != '/') {
79 fDBFolder.Prepend(initDir);
82 // check DBFolder: trying to cd to DBFolder; if it does not exist, create it
83 if(!gGrid->Cd(fDBFolder.Data(),0)){
84 AliDebug(2,Form("Creating new folder <%s> ...",fDBFolder.Data()));
85 TGridResult* res = gGrid->Command(Form("mkdir -p %s",fDBFolder.Data()));
86 TString result = res->GetKey(0,"__result__");
88 AliFatal(Form("Cannot create folder <%s> !",fDBFolder.Data()));
92 AliDebug(2,Form("Folder <%s> found",fDBFolder.Data()));
95 // removes any '/' at the end of path, then append one '/'
96 while(fDBFolder.EndsWith("/")) fDBFolder.Remove(fDBFolder.Last('/'));
100 fBaseFolder = fDBFolder;
104 // Check if local cache folder is already defined
105 TString origCache(TFile::GetCacheFileDir());
106 if(fCacheFolder.Length() > 0) {
107 if(origCache.Length() == 0) {
108 AliInfo(Form("Setting local cache to: %s", fCacheFolder.Data()));
109 } else if(fCacheFolder != origCache) {
110 AliWarning(Form("Local cache folder was already defined, changing it to: %s",
111 fCacheFolder.Data()));
114 // default settings are: operateDisconnected=kTRUE, forceCacheread = kFALSE
115 if(!TFile::SetCacheFileDir(fCacheFolder.Data(), fOperateDisconnected)) {
116 AliError(Form("Could not set cache folder %s !", fCacheFolder.Data()));
119 // reset fCacheFolder because the function may have
120 // slightly changed the folder name (e.g. '/' added)
121 fCacheFolder = TFile::GetCacheFileDir();
124 // default settings are: cacheSize=1GB, cleanupInterval = 0
125 if(!TFile::ShrinkCacheFileDir(fCacheSize, fCleanupInterval)) {
126 AliError(Form("Could not set following values "
127 "to ShrinkCacheFileDir: cacheSize = %lld, cleanupInterval = %ld !",
128 fCacheSize, fCleanupInterval));
132 // return to the initial directory
133 gGrid->Cd(initDir.Data(),0);
135 fNretry = 3; // default
136 fInitRetrySeconds = 5; // default
139 //_____________________________________________________________________________
140 AliCDBGrid::~AliCDBGrid()
143 delete gGrid; gGrid=0;
147 //_____________________________________________________________________________
148 Bool_t AliCDBGrid::FilenameToId(TString& filename, AliCDBId& id) {
149 // build AliCDBId from full path filename (fDBFolder/path/Run#x_#y_v#z_s0.root)
151 if(filename.Contains(fDBFolder)){
152 filename = filename(fDBFolder.Length(),filename.Length()-fDBFolder.Length());
155 TString idPath = filename(0,filename.Last('/'));
157 if(!id.IsValid()) return kFALSE;
159 filename=filename(idPath.Length()+1,filename.Length()-idPath.Length());
162 // valid filename: Run#firstRun_#lastRun_v#version_s0.root
163 TRegexp keyPattern("^Run[0-9]+_[0-9]+_v[0-9]+_s0.root$");
164 keyPattern.Index(filename, &mSize);
167 // TODO backward compatibility ... maybe remove later!
169 TRegexp oldKeyPattern("^Run[0-9]+_[0-9]+_v[0-9]+.root$");
170 oldKeyPattern.Index(filename, &oldmSize);
172 AliDebug(2,Form("Bad filename <%s>.", filename.Data()));
175 AliDebug(2,Form("Old filename format <%s>.", filename.Data()));
176 id.SetSubVersion(-11); // TODO trick to ensure backward compatibility
180 id.SetSubVersion(-1); // TODO trick to ensure backward compatibility
183 filename.Resize(filename.Length() - sizeof(".root") + 1);
185 TObjArray* strArray = (TObjArray*) filename.Tokenize("_");
187 TString firstRunString(((TObjString*) strArray->At(0))->GetString());
188 id.SetFirstRun(atoi(firstRunString.Data() + 3));
189 id.SetLastRun(atoi(((TObjString*) strArray->At(1))->GetString()));
191 TString verString(((TObjString*) strArray->At(2))->GetString());
192 id.SetVersion(atoi(verString.Data() + 1));
199 //_____________________________________________________________________________
200 Bool_t AliCDBGrid::IdToFilename(const AliCDBId& id, TString& filename) const {
201 // build file name from AliCDBId (path, run range, version) and fDBFolder
203 if (!id.GetAliCDBRunRange().IsValid()) {
204 AliDebug(2,Form("Invalid run range <%d, %d>.",
205 id.GetFirstRun(), id.GetLastRun()));
209 if (id.GetVersion() < 0) {
210 AliDebug(2,Form("Invalid version <%d>.", id.GetVersion()));
214 filename = Form("Run%d_%d_v%d",
219 if (id.GetSubVersion() != -11) filename += "_s0"; // TODO to ensure backward compatibility
222 filename.Prepend(fDBFolder + id.GetPath() + '/');
227 //_____________________________________________________________________________
228 void AliCDBGrid::SetRetry(Int_t nretry, Int_t initsec) {
230 // Function to set the exponential retry for putting entries in the OCDB
232 AliWarning("WARNING!!! You are changing the exponential retry times and delay: this function should be used by experts!");
234 fInitRetrySeconds = initsec;
235 AliDebug(2,Form("fNretry = %d, fInitRetrySeconds = %d", fNretry, fInitRetrySeconds));
239 //_____________________________________________________________________________
240 Bool_t AliCDBGrid::PrepareId(AliCDBId& id) {
241 // prepare id (version) of the object that will be stored (called by PutEntry)
243 TString initDir(gGrid->Pwd(0));
245 TString dirName(fDBFolder);
247 Bool_t dirExist=kFALSE;
251 // go to the path; if directory does not exist, create it
252 for(int i=0;i<3;i++){
253 //TString cmd("find -d ");
254 //cmd += Form("%s ",dirName);
256 //gGrid->Command(cmd.Data());
257 dirName+=Form("%s/",id.GetPathLevel(i).Data());
258 dirExist=gGrid->Cd(dirName,0);
260 AliDebug(2,Form("Creating new folder <%s> ...",dirName.Data()));
261 if(!gGrid->Mkdir(dirName,"",0)){
262 AliError(Form("Cannot create directory <%s> !",dirName.Data()));
263 gGrid->Cd(initDir.Data());
267 // if folders are new add tags to them
269 // TODO Currently disabled
270 // add short lived tag!
271 // AliInfo("Tagging level 1 folder with \"ShortLived\" tag");
272 // if(!AddTag(dirName,"ShortLived_try")){
273 // AliError(Form("Could not tag folder %s !", dirName.Data()));
274 // if(!gGrid->Rmdir(dirName.Data())){
275 // AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
281 AliDebug(2,"Tagging level 2 folder with \"CDB\" and \"CDB_MD\" tag");
282 if(!AddTag(dirName,"CDB")){
283 AliError(Form("Could not tag folder %s !", dirName.Data()));
284 if(!gGrid->Rmdir(dirName.Data())){
285 AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
289 if(!AddTag(dirName,"CDB_MD")){
290 AliError(Form("Could not tag folder %s !", dirName.Data()));
291 if(!gGrid->Rmdir(dirName.Data())){
292 AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
297 // TODO Currently disabled
298 // add short lived tag!
299 // TString path=id.GetPath();
300 // if(AliCDBManager::Instance()->IsShortLived(path.Data())) {
301 // AliInfo(Form("Tagging %s as short lived", dirName.Data()));
302 // if(!TagShortLived(dirName, kTRUE)){
303 // AliError(Form("Could not tag folder %s !", dirName.Data()));
304 // if(!gGrid->Rmdir(dirName.Data())){
305 // AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
310 // AliInfo(Form("Tagging %s as long lived", dirName.Data()));
311 // if(!TagShortLived(dirName, kFALSE)){
312 // AliError(Form("Could not tag folder %s !", dirName.Data()));
313 // if(!gGrid->Rmdir(dirName.Data())){
314 // AliError(Form("Unexpected: could not remove %s directory!", dirName.Data()));
322 gGrid->Cd(initDir,0);
325 AliCDBId anId; // the id got from filename
326 AliCDBRunRange lastRunRange(-1,-1); // highest runRange found
327 Int_t lastVersion=0; // highest version found
329 TGridResult *res = gGrid->Ls(dirName);
331 //loop on the files in the directory, look for highest version
332 for(int i=0; i < res->GetEntries(); i++){
333 filename=res->GetFileNamePath(i);
334 if (!FilenameToId(filename, anId)) continue;
335 if (anId.GetAliCDBRunRange().Overlaps(id.GetAliCDBRunRange()) && anId.GetVersion() > lastVersion) {
336 lastVersion = anId.GetVersion();
337 lastRunRange = anId.GetAliCDBRunRange();
343 // GRP entries with explicitly set version escape default incremental versioning
344 if(id.GetPath().Contains("GRP") && id.HasVersion() && lastVersion!=0)
346 AliDebug(5,Form("Entry %s won't be put in the destination OCDB", id.ToString().Data()));
350 id.SetVersion(lastVersion + 1);
353 TString lastStorage = id.GetLastStorage();
354 if(lastStorage.Contains(TString("new"), TString::kIgnoreCase) && id.GetVersion() > 1 ){
355 AliDebug(2, Form("A NEW object is being stored with version %d",
357 AliDebug(2, Form("and it will hide previously stored object with version %d!",
361 if(!lastRunRange.IsAnyRange() && !(lastRunRange.IsEqual(&id.GetAliCDBRunRange())))
362 AliWarning(Form("Run range modified w.r.t. previous version (Run%d_%d_v%d)",
363 lastRunRange.GetFirstRun(), lastRunRange.GetLastRun(), id.GetVersion()));
368 //_____________________________________________________________________________
369 AliCDBId* AliCDBGrid::GetId(const TObjArray& validFileIds, const AliCDBId& query) {
370 // look for the Id that matches query's requests (highest or exact version)
372 if(validFileIds.GetEntriesFast() < 1)
375 TIter iter(&validFileIds);
380 while((anIdPtr = dynamic_cast<AliCDBId*> (iter.Next()))){
381 if(anIdPtr->GetPath() != query.GetPath()) continue;
383 //if(!CheckVersion(query, anIdPtr, result)) return NULL;
385 if (!query.HasVersion()){ // look for highest version
386 if(result && result->GetVersion() > anIdPtr->GetVersion()) continue;
387 if(result && result->GetVersion() == anIdPtr->GetVersion()) {
388 AliError(Form("More than one object valid for run %d, version %d!",
389 query.GetFirstRun(), anIdPtr->GetVersion()));
393 } else { // look for specified version
394 if(query.GetVersion() != anIdPtr->GetVersion()) continue;
395 if(result && result->GetVersion() == anIdPtr->GetVersion()){
396 AliError(Form("More than one object valid for run %d, version %d!",
397 query.GetFirstRun(), anIdPtr->GetVersion()));
405 if (!result) return NULL;
407 return dynamic_cast<AliCDBId*> (result->Clone());
410 //_____________________________________________________________________________
411 AliCDBId* AliCDBGrid::GetEntryId(const AliCDBId& queryId) {
412 // get AliCDBId from the database
413 // User must delete returned object
417 AliCDBId selectedId(queryId);
418 if (!selectedId.HasVersion()) {
419 // if version is not specified, first check the selection criteria list
420 GetSelection(&selectedId);
423 TObjArray validFileIds;
424 validFileIds.SetOwner(1);
426 // look for file matching query requests (path, runRange, version)
427 if(selectedId.GetFirstRun() == fRun && fPathFilter.Comprises(selectedId.GetAliCDBPath()) &&
428 fVersion == selectedId.GetVersion() && !fMetaDataFilter){
429 // look into list of valid files previously loaded with AliCDBStorage::FillValidFileIds()
430 AliDebug(2, Form("List of files valid for run %d was loaded. Looking there for fileids valid for path %s!",
431 selectedId.GetFirstRun(), selectedId.GetPath().Data()));
432 dataId = GetId(fValidFileIds, selectedId);
435 // List of files valid for reqested run was not loaded. Looking directly into CDB
436 AliDebug(2, Form("List of files valid for run %d and version %d was not loaded. Looking directly into CDB for fileids valid for path %s!",
437 selectedId.GetFirstRun(), selectedId.GetVersion(), selectedId.GetPath().Data()));
440 MakeQueryFilter(selectedId.GetFirstRun(), selectedId.GetLastRun(), 0, filter);
442 TString pattern = ".root";
443 TString optionQuery = "-y -m";
444 if(selectedId.GetVersion() >= 0) {
445 pattern.Prepend(Form("_v%d_s0",selectedId.GetVersion()));
449 TString folderCopy(Form("%s%s/Run",fDBFolder.Data(),selectedId.GetPath().Data()));
451 if (optionQuery.Contains("-y")){
452 AliInfo("Only latest version will be returned");
455 AliDebug(2,Form("** fDBFolder = %s, pattern = %s, filter = %s",folderCopy.Data(), pattern.Data(), filter.Data()));
456 TGridResult *res = gGrid->Query(folderCopy, pattern, filter, optionQuery.Data());
458 AliCDBId validFileId;
459 for(int i=0; i<res->GetEntries(); i++){
460 TString filename = res->GetKey(i, "lfn");
461 if(filename == "") continue;
462 if(FilenameToId(filename, validFileId))
463 validFileIds.AddLast(validFileId.Clone());
467 dataId = GetId(validFileIds, selectedId);
473 //_____________________________________________________________________________
474 AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) {
475 // get AliCDBEntry from the database
477 AliCDBId* dataId = GetEntryId(queryId);
479 if (!dataId) return NULL;
482 if (!IdToFilename(*dataId, filename)) {
483 AliDebug(2,Form("Bad data ID encountered! Subnormal error!"));
488 AliCDBEntry* anEntry = GetEntryFromFile(filename, dataId);
494 //_____________________________________________________________________________
495 AliCDBEntry* AliCDBGrid::GetEntryFromFile(TString& filename, AliCDBId* dataId){
496 // Get AliCBEntry object from file "filename"
498 AliDebug(2,Form("Opening file: %s",filename.Data()));
500 filename.Prepend("/alien");
502 // if option="CACHEREAD" TFile will use the local caching facility!
503 TString option="READ";
504 if(fCacheFolder != ""){
506 // Check if local cache folder was changed in the meanwhile
507 TString origCache(TFile::GetCacheFileDir());
508 if(fCacheFolder != origCache) {
509 AliWarning(Form("Local cache folder has been overwritten!! fCacheFolder = %s origCache = %s",
510 fCacheFolder.Data(), origCache.Data()));
511 TFile::SetCacheFileDir(fCacheFolder.Data(), fOperateDisconnected);
512 TFile::ShrinkCacheFileDir(fCacheSize, fCleanupInterval);
515 option.Prepend("CACHE");
518 AliDebug(2, Form("Option: %s", option.Data()));
520 TFile *file = TFile::Open(filename, option);
522 AliDebug(2,Form("Can't open file <%s>!", filename.Data()));
526 // get the only AliCDBEntry object from the file
527 // the object in the file is an AliCDBEntry entry named "AliCDBEntry"
529 AliCDBEntry* anEntry = dynamic_cast<AliCDBEntry*> (file->Get("AliCDBEntry"));
532 AliDebug(2,Form("Bad storage data: file does not contain an AliCDBEntry object!"));
537 // The object's Id is not reset during storage
538 // If object's Id runRange or version do not match with filename,
539 // it means that someone renamed file by hand. In this case a warning msg is issued.
542 AliCDBId entryId = anEntry->GetId();
543 Int_t tmpSubVersion = dataId->GetSubVersion();
544 dataId->SetSubVersion(entryId.GetSubVersion()); // otherwise filename and id may mismatch
545 if(!entryId.IsEqual(dataId)){
546 AliWarning(Form("Mismatch between file name and object's Id!"));
547 AliWarning(Form("File name: %s", dataId->ToString().Data()));
548 AliWarning(Form("Object's Id: %s", entryId.ToString().Data()));
550 dataId->SetSubVersion(tmpSubVersion);
553 anEntry->SetLastStorage("grid");
555 // Check whether entry contains a TTree. In case load the tree in memory!
556 LoadTreeFromFile(anEntry);
558 // close file, return retieved entry
559 file->Close(); delete file; file=0;
564 //_____________________________________________________________________________
565 TList* AliCDBGrid::GetEntries(const AliCDBId& queryId) {
566 // multiple request (AliCDBStorage::GetAll)
568 TList* result = new TList();
571 TObjArray validFileIds;
572 validFileIds.SetOwner(1);
574 Bool_t alreadyLoaded = kFALSE;
576 // look for file matching query requests (path, runRange)
577 if(queryId.GetFirstRun() == fRun &&
578 fPathFilter.Comprises(queryId.GetAliCDBPath()) && fVersion < 0 && !fMetaDataFilter){
579 // look into list of valid files previously loaded with AliCDBStorage::FillValidFileIds()
580 AliDebug(2,Form("List of files valid for run %d and for path %s was loaded. Looking there!",
581 queryId.GetFirstRun(), queryId.GetPath().Data()));
583 alreadyLoaded = kTRUE;
586 // List of files valid for reqested run was not loaded. Looking directly into CDB
587 AliDebug(2,Form("List of files valid for run %d and for path %s was not loaded. Looking directly into CDB!",
588 queryId.GetFirstRun(), queryId.GetPath().Data()));
591 MakeQueryFilter(queryId.GetFirstRun(), queryId.GetLastRun(), 0, filter);
593 TString path = queryId.GetPath();
595 TString pattern = "Run*.root";
596 TString optionQuery = "-y";
598 TString addFolder = "";
599 if (!path.Contains("*")){
600 if (!path.BeginsWith("/")) addFolder += "/";
604 if (path.BeginsWith("/")) path.Remove(0,1);
605 if (path.EndsWith("/")) path.Remove(path.Length()-1,1);
606 TObjArray* tokenArr = path.Tokenize("/");
607 if (tokenArr->GetEntries() != 3) {
608 AliError("Not a 3 level path! Keeping old query...");
609 pattern.Prepend(path+"/");
612 TString str0 = ((TObjString*)tokenArr->At(0))->String();
613 TString str1 = ((TObjString*)tokenArr->At(1))->String();
614 TString str2 = ((TObjString*)tokenArr->At(2))->String();
615 if (str0 != "*" && str1 != "*" && str2 == "*"){
616 // e.g. "ITS/Calib/*"
617 addFolder = "/"+str0+"/"+str1;
619 else if (str0 != "*" && str1 == "*" && str2 == "*"){
621 addFolder = "/"+str0;
623 else if (str0 == "*" && str1 == "*" && str2 == "*"){
625 // do nothing: addFolder is already an empty string;
628 // e.g. "ITS/*/RecoParam"
629 pattern.Prepend(path+"/");
632 delete tokenArr; tokenArr=0;
635 TString folderCopy(Form("%s%s",fDBFolder.Data(),addFolder.Data()));
637 AliDebug(2,Form("fDBFolder = %s, pattern = %s, filter = %s",folderCopy.Data(), pattern.Data(), filter.Data()));
639 TGridResult *res = gGrid->Query(folderCopy, pattern, filter, optionQuery.Data());
642 AliError("Grid query failed");
646 AliCDBId validFileId;
647 for(int i=0; i<res->GetEntries(); i++){
648 TString filename = res->GetKey(i, "lfn");
649 if(filename == "") continue;
650 if(FilenameToId(filename, validFileId))
651 validFileIds.AddLast(validFileId.Clone());
658 iter = new TIter(&fValidFileIds);
660 iter = new TIter(&validFileIds);
663 TObjArray selectedIds;
664 selectedIds.SetOwner(1);
666 // loop on list of valid Ids to select the right version to get.
667 // According to query and to the selection criteria list, version can be the highest or exact
671 AliCDBPath queryPath = queryId.GetAliCDBPath();
672 while((anIdPtr = dynamic_cast<AliCDBId*> (iter->Next()))){
673 AliCDBPath thisCDBPath = anIdPtr->GetAliCDBPath();
674 if(!(queryPath.Comprises(thisCDBPath)) || pathCopy.GetPath() == thisCDBPath.GetPath()) continue;
675 pathCopy = thisCDBPath;
677 // check the selection criteria list for this query
678 AliCDBId thisId(*anIdPtr);
679 thisId.SetVersion(queryId.GetVersion());
680 if(!thisId.HasVersion()) GetSelection(&thisId);
683 dataId = GetId(fValidFileIds, thisId);
685 dataId = GetId(validFileIds, thisId);
687 if(dataId) selectedIds.Add(dataId);
692 // selectedIds contains the Ids of the files matching all requests of query!
693 // All the objects are now ready to be retrieved
694 iter = new TIter(&selectedIds);
695 while((anIdPtr = dynamic_cast<AliCDBId*> (iter->Next()))){
697 if (!IdToFilename(*anIdPtr, filename)) {
698 AliDebug(2,Form("Bad data ID encountered! Subnormal error!"));
702 AliCDBEntry* anEntry = GetEntryFromFile(filename, anIdPtr);
704 if(anEntry) result->Add(anEntry);
712 //_____________________________________________________________________________
713 Bool_t AliCDBGrid::PutEntry(AliCDBEntry* entry, const char* mirrors) {
714 // put an AliCDBEntry object into the database
716 AliCDBId& id = entry->GetId();
718 // set version for the entry to be stored
719 if (!PrepareId(id)) return kFALSE;
721 // build filename from entry's id
723 if (!IdToFilename(id, filename)) {
724 AliError("Bad ID encountered! Subnormal error!");
728 TString folderToTag = Form("%s%s",
730 id.GetPath().Data());
732 TDirectory* saveDir = gDirectory;
734 TString fullFilename = Form("/alien%s", filename.Data());
735 TString seMirrors(mirrors);
736 if(seMirrors.IsNull() || seMirrors.IsWhitespace()) seMirrors=GetMirrorSEs();
737 // specify SE to filename
738 // if a list of SEs was passed to this method or set via SetMirrorSEs, set the first as SE for opening the file.
739 // The other SEs will be used in cascade in case of failure in opening the file.
740 // The remaining SEs will be used to create replicas.
741 TObjArray *arraySEs = seMirrors.Tokenize(',');
742 Int_t nSEs = arraySEs->GetEntries();
743 Int_t remainingSEs = 1;
745 if (fSE != "default") fullFilename += Form("?se=%s",fSE.Data());
752 AliDebug(2, Form("fNretry = %d, fInitRetrySeconds = %d",fNretry,fInitRetrySeconds));
753 TString targetSE("");
755 Bool_t result = kFALSE;
756 Bool_t reOpenResult = kFALSE;
757 Int_t reOpenAttempts=0;
758 while( !reOpenResult && reOpenAttempts<2){ //loop to check the file after closing it, to catch the unlikely but possible case when the file
759 // is cleaned up by alien just before closing as a consequence of a network disconnection while writing
761 while( !file && remainingSEs>0){
763 TObjString *target = (TObjString*) arraySEs->At(nSEs-remainingSEs);
764 targetSE=target->String();
765 if ( !(targetSE.BeginsWith("ALICE::") && targetSE.CountChar(':')==4) ) {
766 AliError(Form("\"%s\" is an invalid storage element identifier.",targetSE.Data()));
769 if(fullFilename.Contains('?')) fullFilename.Remove(fullFilename.Last('?'));
770 fullFilename += Form("?se=%s",targetSE.Data());
772 Int_t remainingAttempts=fNretry;
773 Int_t nsleep = fInitRetrySeconds; // number of seconds between attempts. We let it increase exponentially
774 AliDebug(2, Form("Uploading file into SE #%d: %s",nSEs-remainingSEs+1,targetSE.Data()));
775 while(remainingAttempts > 0) {
776 AliDebug(2, Form("Uploading file into OCDB at %s - Attempt #%d",targetSE.Data(),fNretry-remainingAttempts+1));
778 file = TFile::Open(fullFilename,"CREATE");
779 if(!file || !file->IsWritable()){
780 if(file) file->Close(); delete file; file=0; // file is not writable
781 TString message(TString::Format("Attempt %d failed.",fNretry-remainingAttempts));
782 if(remainingAttempts>0) {
783 message += " Sleeping for "; message += nsleep; message += " seconds";
785 if(remainingSEs>0) message += " Trying to upload at next SE";
787 AliDebug(2, message.Data());
788 if(remainingAttempts>0) sleep(nsleep);
792 nsleep*=fInitRetrySeconds;
797 AliError(Form("All %d attempts have failed on all %d SEs. Returning...",fNretry,nSEs));
803 //SetTreeToFile(entry, file);
804 entry->SetVersion(id.GetVersion());
806 // write object (key name: "AliCDBEntry")
807 result = (file->WriteTObject(entry, "AliCDBEntry") != 0);
808 if (!result) AliError(Form("Can't write entry to file <%s>!", filename.Data()));
813 AliDebug(2, Form("Reopening file %s for checking its correctness",fullFilename.Data()));
814 TFile* ffile = TFile::Open(fullFilename.Data(),"READ");
816 reOpenResult = kFALSE;
817 AliInfo(Form("The file %s was closed successfully but cannot be reopened. Trying now to regenerate it (regeneration attempt number %d)",
818 fullFilename.Data(),++reOpenAttempts));
820 AliDebug(2, Form("Removing file %s", filename.Data()));
821 if(!gGrid->Rm(filename.Data()))
822 AliError("Can't delete file!");
825 reOpenResult = kTRUE;
828 delete ffile; ffile=0;
832 if (saveDir) saveDir->cd(); else gROOT->cd();
835 if(result && reOpenResult) {
837 if(!TagFileId(filename, &id)){
838 AliInfo(Form("CDB tagging failed. Deleting file %s!",filename.Data()));
839 if(!gGrid->Rm(filename.Data()))
840 AliError("Can't delete file!");
844 TagFileMetaData(filename, entry->GetMetaData());
846 AliError("The file could not be opend or the object could not be written");
847 if(!gGrid->Rm(filename.Data()))
848 AliError("Can't delete file!");
852 AliInfo(Form("CDB object stored into file %s", filename.Data()));
854 AliInfo(Form("Storage Element: %s", fSE.Data()));
856 AliInfo(Form("Storage Element: %s", targetSE.Data()));
858 //In case of other SEs specified by the user, mirror the file to the remaining SEs
859 for(Int_t i=0; i<nSEs; i++){
860 if(i==nSEs-remainingSEs-1) continue; // skip mirroring to the SE where the file was saved
861 TString mirrorCmd("mirror ");
862 mirrorCmd += filename;
864 TObjString *target = (TObjString*) arraySEs->At(i);
865 TString mirrorSE(target->String());
866 mirrorCmd += mirrorSE;
867 AliDebug(5,Form("mirror command: \"%s\"",mirrorCmd.Data()));
868 AliInfo(Form("Mirroring to storage element: %s", mirrorSE.Data()));
869 gGrid->Command(mirrorCmd.Data());
875 //_____________________________________________________________________________
876 Bool_t AliCDBGrid::AddTag(TString& folderToTag, const char* tagname){
877 // add "tagname" tag (CDB or CDB_MD) to folder where object will be stored
879 Bool_t result = kTRUE;
880 AliDebug(2, Form("adding %s tag to folder %s", tagname, folderToTag.Data()));
881 TString addTag = Form("addTag %s %s", folderToTag.Data(), tagname);
882 TGridResult *gridres = gGrid->Command(addTag.Data());
883 const char* resCode = gridres->GetKey(0,"__result__"); // '1' if success
884 if(resCode[0] != '1') {
885 AliError(Form("Couldn't add %s tags to folder %s !",
886 tagname, folderToTag.Data()));
893 //_____________________________________________________________________________
894 Bool_t AliCDBGrid::TagFileId(TString& filename, const AliCDBId* id){
895 // tag stored object in CDB table using object Id's parameters
898 TString dirname(filename);
899 Int_t dirNumber = gGrid->Mkdir(dirname.Remove(dirname.Last('/')),"-d");
901 TString addTagValue1 = Form("addTagValue %s CDB ", filename.Data());
902 TString addTagValue2 = Form("first_run=%d last_run=%d version=%d ",
906 TString addTagValue3 = Form("path_level_0=\"%s\" path_level_1=\"%s\" path_level_2=\"%s\" ",
907 id->GetPathLevel(0).Data(),
908 id->GetPathLevel(1).Data(),
909 id->GetPathLevel(2).Data());
910 //TString addTagValue4 = Form("version_path=\"%s\" dir_number=%d",Form("%d_%s",id->GetVersion(),filename.Data()),dirNumber);
911 TString addTagValue4 = Form("version_path=\"%09d%s\" dir_number=%d",id->GetVersion(),filename.Data(),dirNumber);
912 TString addTagValue = Form("%s%s%s%s",
916 addTagValue4.Data());
918 Bool_t result = kFALSE;
919 AliDebug(2, Form("Tagging file. Tag command: %s", addTagValue.Data()));
920 TGridResult* res = gGrid->Command(addTagValue.Data());
921 const char* resCode = res->GetKey(0,"__result__"); // '1' if success
922 if(resCode[0] != '1') {
923 AliError(Form("Couldn't add CDB tag value to file %s !",
927 AliDebug(2, "Object successfully tagged.");
935 //_____________________________________________________________________________
936 Bool_t AliCDBGrid::TagShortLived(TString& filename, Bool_t value){
937 // tag folder with ShortLived tag
939 TString addTagValue = Form("addTagValue %s ShortLived_try value=%d", filename.Data(), value);
941 Bool_t result = kFALSE;
942 AliDebug(2, Form("Tagging file. Tag command: %s", addTagValue.Data()));
943 TGridResult* res = gGrid->Command(addTagValue.Data());
944 const char* resCode = res->GetKey(0,"__result__"); // '1' if success
945 if(resCode[0] != '1') {
946 AliError(Form("Couldn't add ShortLived tag value to file %s !", filename.Data()));
949 AliDebug(2,"Object successfully tagged.");
957 //_____________________________________________________________________________
958 Bool_t AliCDBGrid::TagFileMetaData(TString& filename, const AliCDBMetaData* md){
959 // tag stored object in CDB table using object Id's parameters
961 TString addTagValue1 = Form("addTagValue %s CDB_MD ", filename.Data());
962 TString addTagValue2 = Form("object_classname=\"%s\" responsible=\"%s\" beam_period=%d ",
963 md->GetObjectClassName(),
964 md->GetResponsible(),
965 md->GetBeamPeriod());
966 TString addTagValue3 = Form("aliroot_version=\"%s\" comment=\"%s\"",
967 md->GetAliRootVersion(),
969 TString addTagValue = Form("%s%s%s",
972 addTagValue3.Data());
974 Bool_t result = kFALSE;
975 AliDebug(2, Form("Tagging file. Tag command: %s", addTagValue.Data()));
976 TGridResult* res = gGrid->Command(addTagValue.Data());
977 const char* resCode = res->GetKey(0,"__result__"); // '1' if success
978 if(resCode[0] != '1') {
979 AliWarning(Form("Couldn't add CDB_MD tag value to file %s !",
983 AliDebug(2,"Object successfully tagged.");
989 //_____________________________________________________________________________
990 TList* AliCDBGrid::GetIdListFromFile(const char* fileName){
992 TString turl(fileName);
993 turl.Prepend("/alien" + fDBFolder);
994 turl += "?se="; turl += fSE.Data();
995 TFile *file = TFile::Open(turl);
997 AliError(Form("Can't open selection file <%s>!", turl.Data()));
1001 TList *list = new TList();
1009 keycycle = "AliCDBId;";
1012 id = (AliCDBId*) file->Get(keycycle);
1016 file->Close(); delete file; file=0;
1023 //_____________________________________________________________________________
1024 Bool_t AliCDBGrid::Contains(const char* path) const{
1025 // check for path in storage's DBFolder
1027 TString initDir(gGrid->Pwd(0));
1028 TString dirName(fDBFolder);
1029 dirName += path; // dirName = fDBFolder/path
1030 Bool_t result=kFALSE;
1031 if (gGrid->Cd(dirName,0)) result=kTRUE;
1032 gGrid->Cd(initDir.Data(),0);
1036 //_____________________________________________________________________________
1037 void AliCDBGrid::QueryValidFiles()
1039 // Query the CDB for files valid for AliCDBStorage::fRun
1040 // fills list fValidFileIds with AliCDBId objects created from file name
1043 MakeQueryFilter(fRun, fRun, fMetaDataFilter, filter);
1045 TString path = fPathFilter.GetPath();
1047 TString pattern = "Run*";
1048 TString optionQuery = "-y";
1050 pattern += Form("_v%d_s0", fVersion);
1054 AliDebug(2,Form("pattern: %s", pattern.Data()));
1056 TString addFolder = "";
1057 if (!path.Contains("*")){
1058 if (!path.BeginsWith("/")) addFolder += "/";
1062 if (path.BeginsWith("/")) path.Remove(0,1);
1063 if (path.EndsWith("/")) path.Remove(path.Length()-1,1);
1064 TObjArray* tokenArr = path.Tokenize("/");
1065 if (tokenArr->GetEntries() != 3) {
1066 AliError("Not a 3 level path! Keeping old query...");
1067 pattern.Prepend(path+"/");
1070 TString str0 = ((TObjString*)tokenArr->At(0))->String();
1071 TString str1 = ((TObjString*)tokenArr->At(1))->String();
1072 TString str2 = ((TObjString*)tokenArr->At(2))->String();
1073 if (str0 != "*" && str1 != "*" && str2 == "*"){
1074 // e.g. "ITS/Calib/*"
1075 addFolder = "/"+str0+"/"+str1;
1077 else if (str0 != "*" && str1 == "*" && str2 == "*"){
1079 addFolder = "/"+str0;
1081 else if (str0 == "*" && str1 == "*" && str2 == "*"){
1083 // do nothing: addFolder is already an empty string;
1086 // e.g. "ITS/*/RecoParam"
1087 pattern.Prepend(path+"/");
1090 delete tokenArr; tokenArr=0;
1093 TString folderCopy(Form("%s%s",fDBFolder.Data(),addFolder.Data()));
1095 AliDebug(2,Form("fDBFolder = %s, pattern = %s, filter = %s",folderCopy.Data(), pattern.Data(), filter.Data()));
1097 if (optionQuery == "-y"){
1098 AliInfo("Only latest version will be returned");
1101 TGridResult *res = gGrid->Query(folderCopy, pattern, filter, optionQuery.Data());
1104 AliError("Grid query failed");
1110 while ((map = (TMap*)next())) {
1112 if ((entry = (TObjString *) ((TMap *)map)->GetValue("lfn"))) {
1113 TString& filename = entry->String();
1114 if(filename.IsNull()) continue;
1115 AliDebug(2,Form("Found valid file: %s", filename.Data()));
1116 AliCDBId *validFileId = new AliCDBId;
1117 Bool_t result = FilenameToId(filename, *validFileId);
1119 fValidFileIds.AddLast(validFileId);
1130 //_____________________________________________________________________________
1131 void AliCDBGrid::MakeQueryFilter(Int_t firstRun, Int_t lastRun,
1132 const AliCDBMetaData* md, TString& result) const
1134 // create filter for file query
1136 result = Form("CDB:first_run<=%d and CDB:last_run>=%d", firstRun, lastRun);
1138 // if(version >= 0) {
1139 // result += Form(" and CDB:version=%d", version);
1141 // if(pathFilter.GetLevel0() != "*") {
1142 // result += Form(" and CDB:path_level_0=\"%s\"", pathFilter.GetLevel0().Data());
1144 // if(pathFilter.GetLevel1() != "*") {
1145 // result += Form(" and CDB:path_level_1=\"%s\"", pathFilter.GetLevel1().Data());
1147 // if(pathFilter.GetLevel2() != "*") {
1148 // result += Form(" and CDB:path_level_2=\"%s\"", pathFilter.GetLevel2().Data());
1152 if(md->GetObjectClassName()[0] != '\0') {
1153 result += Form(" and CDB_MD:object_classname=\"%s\"", md->GetObjectClassName());
1155 if(md->GetResponsible()[0] != '\0') {
1156 result += Form(" and CDB_MD:responsible=\"%s\"", md->GetResponsible());
1158 if(md->GetBeamPeriod() != 0) {
1159 result += Form(" and CDB_MD:beam_period=%d", md->GetBeamPeriod());
1161 if(md->GetAliRootVersion()[0] != '\0') {
1162 result += Form(" and CDB_MD:aliroot_version=\"%s\"", md->GetAliRootVersion());
1164 if(md->GetComment()[0] != '\0') {
1165 result += Form(" and CDB_MD:comment=\"%s\"", md->GetComment());
1168 AliDebug(2, Form("filter: %s",result.Data()));
1172 //_____________________________________________________________________________
1173 Int_t AliCDBGrid::GetLatestVersion(const char* path, Int_t run){
1174 // get last version found in the database valid for run and path
1176 AliCDBPath aCDBPath(path);
1177 if(!aCDBPath.IsValid() || aCDBPath.IsWildcard()) {
1178 AliError(Form("Invalid path in request: %s", path));
1181 AliCDBId query(path, run, run, -1, -1);
1183 AliCDBId* dataId = 0;
1184 // look for file matching query requests (path, runRange, version)
1185 if(run == fRun && fPathFilter.Comprises(aCDBPath) && fVersion < 0){
1186 // look into list of valid files previously loaded with AliCDBStorage::FillValidFileIds()
1187 AliDebug(2, Form("List of files valid for run %d and for path %s was loaded. Looking there!",
1189 dataId = GetId(fValidFileIds, query);
1190 if (!dataId) return -1;
1191 Int_t version = dataId->GetVersion();
1196 // List of files valid for reqested run was not loaded. Looking directly into CDB
1197 AliDebug(2, Form("List of files valid for run %d and for path %s was not loaded. Looking directly into CDB!",
1200 TObjArray validFileIds;
1201 validFileIds.SetOwner(1);
1204 MakeQueryFilter(run, run, 0, filter);
1206 TString pattern = ".root";
1208 TString folderCopy(Form("%s%s/Run",fDBFolder.Data(),path));
1210 AliDebug(2,Form("** fDBFolder = %s, pattern = %s, filter = %s",folderCopy.Data(), pattern.Data(), filter.Data()));
1211 TGridResult *res = gGrid->Query(folderCopy, pattern, filter, "-y -m");
1213 AliCDBId validFileId;
1214 if (res->GetEntries()>1){
1215 AliWarning("Number of found entries >1, even if option -y was used");
1216 for(int i=0; i<res->GetEntries(); i++){
1217 TString filename = res->GetKey(i, "lfn");
1218 if(filename == "") continue;
1219 if(FilenameToId(filename, validFileId))
1220 validFileIds.AddLast(validFileId.Clone());
1222 dataId = GetId(validFileIds, query);
1223 if (!dataId) return -1;
1225 Int_t version = dataId->GetVersion();
1229 else if (res->GetEntries()==1){
1230 TString filename = res->GetKey(0, "lfn");
1231 if(filename == "") {
1232 AliError("The only entry found has filename empty");
1235 if(FilenameToId(filename, validFileId)) return validFileId.GetVersion();
1237 AliError("Impossible to get FileId from filename");
1242 AliError("No entries found");
1251 //_____________________________________________________________________________
1252 Int_t AliCDBGrid::GetLatestSubVersion(const char* /*path*/, Int_t /*run*/, Int_t /*version*/){
1253 // get last subversion found in the database valid for run and path
1254 AliError("Objects in GRID storage have no sub version!");
1259 /////////////////////////////////////////////////////////////////////////////////////////////////
1261 // AliCDBGrid factory //
1263 /////////////////////////////////////////////////////////////////////////////////////////////////
1265 ClassImp(AliCDBGridFactory)
1267 //_____________________________________________________________________________
1268 Bool_t AliCDBGridFactory::Validate(const char* gridString) {
1269 // check if the string is valid Grid URI
1271 TRegexp gridPattern("^alien://.+$");
1273 return TString(gridString).Contains(gridPattern);
1276 //_____________________________________________________________________________
1277 AliCDBParam* AliCDBGridFactory::CreateParameter(const char* gridString) {
1278 // create AliCDBGridParam class from the URI string
1280 if (!Validate(gridString)) {
1284 TString buffer(gridString);
1286 TString gridUrl = "alien://";
1288 TString dbFolder = "";
1289 TString se = "default";
1290 TString cacheFolder = "";
1291 Bool_t operateDisconnected = kTRUE;
1292 Long64_t cacheSize = (UInt_t) 1024*1024*1024; // 1GB
1293 Long_t cleanupInterval = 0;
1295 TObjArray *arr = buffer.Tokenize('?');
1297 TObjString *str = 0;
1299 while((str = (TObjString*) iter.Next())){
1300 TString entry(str->String());
1301 Int_t indeq = entry.Index('=');
1303 if(entry.BeginsWith("alien://")) { // maybe it's a gridUrl!
1307 AliError(Form("Invalid entry! %s",entry.Data()));
1312 TString key = entry(0,indeq);
1313 TString value = entry(indeq+1,entry.Length()-indeq);
1315 if(key.Contains("grid",TString::kIgnoreCase)) {
1318 else if (key.Contains("user",TString::kIgnoreCase)){
1321 else if (key.Contains("se",TString::kIgnoreCase)){
1324 else if (key.Contains("cacheF",TString::kIgnoreCase)){
1325 cacheFolder = value;
1326 if (!cacheFolder.IsNull() && !cacheFolder.EndsWith("/"))
1329 else if (key.Contains("folder",TString::kIgnoreCase)){
1332 else if (key.Contains("operateDisc",TString::kIgnoreCase)){
1333 if(value == "kTRUE") {
1334 operateDisconnected = kTRUE;
1335 } else if (value == "kFALSE") {
1336 operateDisconnected = kFALSE;
1337 } else if (value == "0" || value == "1") {
1338 operateDisconnected = (Bool_t) value.Atoi();
1340 AliError(Form("Invalid entry! %s",entry.Data()));
1344 else if (key.Contains("cacheS",TString::kIgnoreCase)){
1345 if(value.IsDigit()) {
1346 cacheSize = value.Atoi();
1348 AliError(Form("Invalid entry! %s",entry.Data()));
1352 else if (key.Contains("cleanupInt",TString::kIgnoreCase)){
1353 if(value.IsDigit()) {
1354 cleanupInterval = value.Atoi();
1356 AliError(Form("Invalid entry! %s",entry.Data()));
1361 AliError(Form("Invalid entry! %s",entry.Data()));
1367 AliDebug(2, Form("gridUrl: %s", gridUrl.Data()));
1368 AliDebug(2, Form("user: %s", user.Data()));
1369 AliDebug(2, Form("dbFolder: %s", dbFolder.Data()));
1370 AliDebug(2, Form("s.e.: %s", se.Data()));
1371 AliDebug(2, Form("local cache folder: %s", cacheFolder.Data()));
1372 AliDebug(2, Form("local cache operate disconnected: %d", operateDisconnected));
1373 AliDebug(2, Form("local cache size: %lld", cacheSize));
1374 AliDebug(2, Form("local cache cleanup interval: %ld", cleanupInterval));
1377 AliError("Base folder must be specified!");
1381 return new AliCDBGridParam(gridUrl.Data(), user.Data(),
1382 dbFolder.Data(), se.Data(), cacheFolder.Data(),
1383 operateDisconnected, cacheSize, cleanupInterval);
1386 //_____________________________________________________________________________
1387 AliCDBStorage* AliCDBGridFactory::Create(const AliCDBParam* param) {
1388 // create AliCDBGrid storage instance from parameters
1390 AliCDBGrid *grid = 0;
1391 if (AliCDBGridParam::Class() == param->IsA()) {
1393 const AliCDBGridParam* gridParam = (const AliCDBGridParam*) param;
1394 grid = new AliCDBGrid(gridParam->GridUrl().Data(),
1395 gridParam->GetUser().Data(),
1396 gridParam->GetDBFolder().Data(),
1397 gridParam->GetSE().Data(),
1398 gridParam->GetCacheFolder().Data(),
1399 gridParam->GetOperateDisconnected(),
1400 gridParam->GetCacheSize(),
1401 gridParam->GetCleanupInterval());
1405 if(!gGrid && grid) {
1406 delete grid; grid=0;
1412 /////////////////////////////////////////////////////////////////////////////////////////////////
1414 // AliCDBGrid Parameter class // //
1416 /////////////////////////////////////////////////////////////////////////////////////////////////
1418 ClassImp(AliCDBGridParam)
1420 //_____________________________________________________________________________
1421 AliCDBGridParam::AliCDBGridParam():
1428 fOperateDisconnected(),
1433 // default constructor
1437 //_____________________________________________________________________________
1438 AliCDBGridParam::AliCDBGridParam(const char* gridUrl, const char* user, const char* dbFolder,
1439 const char* se, const char* cacheFolder, Bool_t operateDisconnected,
1440 Long64_t cacheSize, Long_t cleanupInterval):
1444 fDBFolder(dbFolder),
1446 fCacheFolder(cacheFolder),
1447 fOperateDisconnected(operateDisconnected),
1448 fCacheSize(cacheSize),
1449 fCleanupInterval(cleanupInterval)
1455 TString uri = Form("%s?User=%s?DBFolder=%s?SE=%s?CacheFolder=%s"
1456 "?OperateDisconnected=%d?CacheSize=%lld?CleanupInterval=%ld",
1457 fGridUrl.Data(), fUser.Data(),
1458 fDBFolder.Data(), fSE.Data(), fCacheFolder.Data(),
1459 fOperateDisconnected, fCacheSize, fCleanupInterval);
1464 //_____________________________________________________________________________
1465 AliCDBGridParam::~AliCDBGridParam() {
1470 //_____________________________________________________________________________
1471 AliCDBParam* AliCDBGridParam::CloneParam() const {
1474 return new AliCDBGridParam(fGridUrl.Data(), fUser.Data(),
1475 fDBFolder.Data(), fSE.Data(), fCacheFolder.Data(),
1476 fOperateDisconnected, fCacheSize, fCleanupInterval);
1479 //_____________________________________________________________________________
1480 ULong_t AliCDBGridParam::Hash() const {
1481 // return Hash function
1483 return fGridUrl.Hash()+fUser.Hash()+fDBFolder.Hash()+fSE.Hash()+fCacheFolder.Hash();
1486 //_____________________________________________________________________________
1487 Bool_t AliCDBGridParam::IsEqual(const TObject* obj) const {
1488 // check if this object is equal to AliCDBParam obj
1494 if (AliCDBGridParam::Class() != obj->IsA()) {
1498 AliCDBGridParam* other = (AliCDBGridParam*) obj;
1500 if(fGridUrl != other->fGridUrl) return kFALSE;
1501 if(fUser != other->fUser) return kFALSE;
1502 if(fDBFolder != other->fDBFolder) return kFALSE;
1503 if(fSE != other->fSE) return kFALSE;
1504 if(fCacheFolder != other->fCacheFolder) return kFALSE;
1505 if(fOperateDisconnected != other->fOperateDisconnected) return kFALSE;
1506 if(fCacheSize != other->fCacheSize) return kFALSE;
1507 if(fCleanupInterval != other->fCleanupInterval) return kFALSE;