set version map to check all partitions
@@ -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<Long> matchingIds = dao.searchForIds(theSearchParamMap, new SystemRequestDetails()).stream()
+ if (ourLog.isDebugEnabled()) {
+ ourLog.debug("About to retrieve version map for resource type: {}", theResourceName);
+ }
+
+ List<Long> matchingIds = dao.searchForIds(theSearchParamMap, new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.allPartitions())).stream()
.map(ResourcePersistentId::getIdAsLong)
.collect(Collectors.toList());
