From 1f7fb52d91b52619ab1afe61bea8b7d3885c07ff Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 17 Aug 2021 16:45:12 -0400 Subject: [PATCH] set version map to check all partitions --- .../uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java index aa2c9ef2ad9..cb82083e24e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.cache; * #L% */ +import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; @@ -28,6 +29,7 @@ import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.util.QueryChunker; import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,12 +38,15 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import static org.slf4j.LoggerFactory.getLogger; + /** * This service builds a map of resource ids to versions based on a SearchParameterMap. * It is used by the in-memory resource-version cache to detect when resource versions have been changed by remote processes. */ @Service public class ResourceVersionSvcDaoImpl implements IResourceVersionSvc { + private static final Logger ourLog = getLogger(ResourceVersionSvcDaoImpl.class); @Autowired DaoRegistry myDaoRegistry; @@ -53,7 +58,11 @@ public class ResourceVersionSvcDaoImpl implements IResourceVersionSvc { public ResourceVersionMap getVersionMap(String theResourceName, SearchParameterMap theSearchParamMap) { IFhirResourceDao dao = myDaoRegistry.getResourceDao(theResourceName); - List matchingIds = dao.searchForIds(theSearchParamMap, new SystemRequestDetails()).stream() + if (ourLog.isDebugEnabled()) { + ourLog.debug("About to retrieve version map for resource type: {}", theResourceName); + } + + List matchingIds = dao.searchForIds(theSearchParamMap, new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.allPartitions())).stream() .map(ResourcePersistentId::getIdAsLong) .collect(Collectors.toList());