Skip to content

Commit de3ecdf

Browse files
authored
DPL Analysis: query the CCDB once per run of equal timestamps (#16080)
1 parent d273816 commit de3ecdf

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& /*ctx*/)
235235

236236
// Rows sharing a uniformity value resolve to the same objects, so the query is
237237
// issued once per distinct value and the resulting handles are repeated for the
238-
// rest of the run. When uniformity is the timestamp itself (the default) this
239-
// degenerates to the previous behaviour, one query per row.
238+
// rest of the run. When uniformity is the timestamp itself (the default) the
239+
// query is issued once per run of consecutive rows with the same timestamp.
240240
std::vector<int64_t> uniformity;
241241
bool const shortCircuit = uniformityColumn.get() != timestampColumn.get();
242242
if (shortCircuit) {
@@ -273,15 +273,13 @@ AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& /*ctx*/)
273273

274274
for (int64_t ri = 0; ri < chunk->data()->length; ri++) {
275275
++row;
276-
bool const sameAsPrevious = shortCircuit && haveResponses && uniformity[row] == previousUniformity;
277-
if (shortCircuit) {
278-
previousUniformity = uniformity[row];
279-
}
280276
ops.clear();
281277
int64_t timestamp = timestamps[ri];
282278
// Key the path lookup on the uniformity value; when uniformity is the
283279
// timestamp itself the mapping expresses validity intervals instead.
284280
int64_t const uniformityKey = shortCircuit ? uniformity[row] : timestamp;
281+
bool const sameAsPrevious = haveResponses && uniformityKey == previousUniformity;
282+
previousUniformity = uniformityKey;
285283
int fi = 0;
286284
for (auto& field : schema->fields()) {
287285
auto const& url = pathTables[i][fi++].resolve(uniformityKey, field->name());

‎Framework/CCDBSupport/src/CCDBFetcherHelper.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ auto CCDBFetcherHelper::populateCacheWith(std::shared_ptr<CCDBFetcherHelper> con
179179
O2_SIGNPOST_EVENT_EMIT(ccdb, sid, "populateCacheWith", "Fetching object for route %{public}s", DataSpecUtils::describe(op.spec).data());
180180
auto concrete = DataSpecUtils::asConcreteDataMatcher(op.spec);
181181
Output output{concrete.origin, concrete.description, concrete.subSpec};
182-
auto&& v = allocator.makeVector<char>(output);
183182
std::map<std::string, std::string> metadata;
184183
std::map<std::string, std::string> headers;
185184
std::string path = op.url;
@@ -232,6 +231,7 @@ auto CCDBFetcherHelper::populateCacheWith(std::shared_ptr<CCDBFetcherHelper> con
232231

233232
const auto& api = helper->getAPI(path);
234233
if (checkValidity && (!api.isSnapshotMode() || etag.empty())) { // in the snapshot mode the object needs to be fetched only once
234+
auto&& v = allocator.makeVector<char>(output);
235235
LOGP(detail, "Loading {} for timestamp {}", path, timestampToUse);
236236
api.loadFileToMemory(v, path, metadata, timestampToUse, &headers, etag, helper->createdNotAfter, helper->createdNotBefore);
237237
if ((headers.count("Error") != 0) || (etag.empty() && v.empty())) {

0 commit comments

Comments
 (0)