Skip to content

Commit c5209b1

Browse files
committed
Do not fetch meta-data object unless reading explicit ccdb snapshot file
1 parent fc1fd7b commit c5209b1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CCDB/include/CCDB/CcdbApi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class CcdbApi //: public DatabaseInterface
388388
static bool removeSemaphore(std::string const& name, bool remove = false);
389389
static void removeLeakingSemaphores(std::string const& basedir, bool remove = false);
390390

391-
void loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr) const;
391+
void loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr, bool fetchLocalMetaData = true) const;
392392
void loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& path,
393393
std::map<std::string, std::string> const& metadata, long timestamp,
394394
std::map<std::string, std::string>* headers, std::string const& etag,

CCDB/src/CcdbApi.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,7 @@ bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string&
19891989
{
19901990
if (url.find("alien:/", 0) != std::string::npos) {
19911991
std::map<std::string, std::string> localHeaders;
1992-
loadFileToMemory(dest, url, &localHeaders);
1992+
loadFileToMemory(dest, url, &localHeaders, false);
19931993
auto it = localHeaders.find("Error");
19941994
if (it != localHeaders.end() && it->second == "An error occurred during retrieval") {
19951995
return false;
@@ -2001,7 +2001,7 @@ bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string&
20012001
std::string path = url.substr(7);
20022002
if (std::filesystem::exists(path)) {
20032003
std::map<std::string, std::string> localHeaders;
2004-
loadFileToMemory(dest, url, &localHeaders);
2004+
loadFileToMemory(dest, url, &localHeaders, o2::utils::Str::endsWith(path, ".root"));
20052005
auto it = localHeaders.find("Error");
20062006
if (it != localHeaders.end() && it->second == "An error occurred during retrieval") {
20072007
return false;
@@ -2013,7 +2013,7 @@ bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string&
20132013
return false;
20142014
}
20152015

2016-
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders) const
2016+
void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
20172017
{
20182018
// Read file to memory as vector. For special case of the locally cached file retriev metadata stored directly in the file
20192019
constexpr size_t MaxCopySize = 0x1L << 25;
@@ -2061,7 +2061,7 @@ void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& p
20612061
totalread += nread;
20622062
} while (nread == (long)MaxCopySize);
20632063

2064-
if (localHeaders) {
2064+
if (localHeaders && fetchLocalMetaData) {
20652065
TMemFile memFile("name", const_cast<char*>(dest.data()), dest.size(), "READ");
20662066
auto storedmeta = (std::map<std::string, std::string>*)extractFromTFile(memFile, TClass::GetClass("std::map<std::string, std::string>"), CCDBMETA_ENTRY);
20672067
if (storedmeta) {

0 commit comments

Comments
 (0)