diff --git a/Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx b/Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx index 5bd21ce6bdf3f..b5e7e9436357c 100644 --- a/Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx +++ b/Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx @@ -235,8 +235,8 @@ AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& /*ctx*/) // Rows sharing a uniformity value resolve to the same objects, so the query is // issued once per distinct value and the resulting handles are repeated for the - // rest of the run. When uniformity is the timestamp itself (the default) this - // degenerates to the previous behaviour, one query per row. + // rest of the run. When uniformity is the timestamp itself (the default) the + // query is issued once per run of consecutive rows with the same timestamp. std::vector uniformity; bool const shortCircuit = uniformityColumn.get() != timestampColumn.get(); if (shortCircuit) { @@ -273,15 +273,13 @@ AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& /*ctx*/) for (int64_t ri = 0; ri < chunk->data()->length; ri++) { ++row; - bool const sameAsPrevious = shortCircuit && haveResponses && uniformity[row] == previousUniformity; - if (shortCircuit) { - previousUniformity = uniformity[row]; - } ops.clear(); int64_t timestamp = timestamps[ri]; // Key the path lookup on the uniformity value; when uniformity is the // timestamp itself the mapping expresses validity intervals instead. int64_t const uniformityKey = shortCircuit ? uniformity[row] : timestamp; + bool const sameAsPrevious = haveResponses && uniformityKey == previousUniformity; + previousUniformity = uniformityKey; int fi = 0; for (auto& field : schema->fields()) { auto const& url = pathTables[i][fi++].resolve(uniformityKey, field->name()); diff --git a/Framework/CCDBSupport/src/CCDBFetcherHelper.cxx b/Framework/CCDBSupport/src/CCDBFetcherHelper.cxx index e4a9556c59b17..c79f64cccbd7c 100644 --- a/Framework/CCDBSupport/src/CCDBFetcherHelper.cxx +++ b/Framework/CCDBSupport/src/CCDBFetcherHelper.cxx @@ -179,7 +179,6 @@ auto CCDBFetcherHelper::populateCacheWith(std::shared_ptr con O2_SIGNPOST_EVENT_EMIT(ccdb, sid, "populateCacheWith", "Fetching object for route %{public}s", DataSpecUtils::describe(op.spec).data()); auto concrete = DataSpecUtils::asConcreteDataMatcher(op.spec); Output output{concrete.origin, concrete.description, concrete.subSpec}; - auto&& v = allocator.makeVector(output); std::map metadata; std::map headers; std::string path = op.url; @@ -232,6 +231,7 @@ auto CCDBFetcherHelper::populateCacheWith(std::shared_ptr con const auto& api = helper->getAPI(path); if (checkValidity && (!api.isSnapshotMode() || etag.empty())) { // in the snapshot mode the object needs to be fetched only once + auto&& v = allocator.makeVector(output); LOGP(detail, "Loading {} for timestamp {}", path, timestampToUse); api.loadFileToMemory(v, path, metadata, timestampToUse, &headers, etag, helper->createdNotAfter, helper->createdNotBefore); if ((headers.count("Error") != 0) || (etag.empty() && v.empty())) {