Skip to content

Commit aaa1300

Browse files
committed
CCDB fix: fetch headers to RequestContext when reading snapshot
1 parent f63f7a1 commit aaa1300

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

CCDB/include/CCDB/CcdbApi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class CcdbApi //: public DatabaseInterface
373373
void scheduleDownload(RequestContext& requestContext, size_t* requestCounter) const;
374374

375375
void getFromSnapshot(bool createSnapshot, std::string const& path,
376-
long timestamp, std::map<std::string, std::string> headers,
376+
long timestamp, std::map<std::string, std::string>& headers,
377377
std::string& snapshotpath, o2::pmr::vector<char>& dest, int& fromSnapshot, std::string const& etag) const;
378378
void releaseNamedSemaphore(boost::interprocess::named_semaphore* sem, std::string path) const;
379379
boost::interprocess::named_semaphore* createNamedSempahore(std::string path) const;

CCDB/src/CcdbApi.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ void CcdbApi::releaseNamedSemaphore(boost::interprocess::named_semaphore* sem, s
15711571
}
15721572

15731573
void CcdbApi::getFromSnapshot(bool createSnapshot, std::string const& path,
1574-
long timestamp, std::map<std::string, std::string> headers,
1574+
long timestamp, std::map<std::string, std::string>& headers,
15751575
std::string& snapshotpath, o2::pmr::vector<char>& dest, int& fromSnapshot, std::string const& etag) const
15761576
{
15771577
if (createSnapshot) { // create named semaphore
@@ -1581,9 +1581,10 @@ void CcdbApi::getFromSnapshot(bool createSnapshot, std::string const& path,
15811581
logStream << "CCDB-access[" << getpid() << "] of " << mUniqueAgentID << " to " << path << " timestamp " << timestamp << " for load to memory\n";
15821582
}
15831583
}
1584-
15851584
if (mInSnapshotMode) { // file must be there, otherwise a fatal will be produced;
1586-
loadFileToMemory(dest, getSnapshotFile(mSnapshotTopPath, path), &headers);
1585+
if (etag.empty()) {
1586+
loadFileToMemory(dest, getSnapshotFile(mSnapshotTopPath, path), &headers);
1587+
}
15871588
fromSnapshot = 1;
15881589
} else if (mPreferSnapshotCache && std::filesystem::exists(snapshotpath)) {
15891590
// if file is available, use it, otherwise cache it below from the server. Do this only when etag is empty since otherwise the object was already fetched and cached

0 commit comments

Comments
 (0)