set version map to check all partitions
This commit is contained in:
parent
cf917d0f82
commit
1f7fb52d91
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.cache;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
|
||||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
||||||
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
|
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.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.util.QueryChunker;
|
import ca.uhn.fhir.jpa.util.QueryChunker;
|
||||||
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
|
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -36,12 +38,15 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
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.
|
* 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.
|
* It is used by the in-memory resource-version cache to detect when resource versions have been changed by remote processes.
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ResourceVersionSvcDaoImpl implements IResourceVersionSvc {
|
public class ResourceVersionSvcDaoImpl implements IResourceVersionSvc {
|
||||||
|
private static final Logger ourLog = getLogger(ResourceVersionSvcDaoImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DaoRegistry myDaoRegistry;
|
DaoRegistry myDaoRegistry;
|
||||||
|
@ -53,7 +58,11 @@ public class ResourceVersionSvcDaoImpl implements IResourceVersionSvc {
|
||||||
public ResourceVersionMap getVersionMap(String theResourceName, SearchParameterMap theSearchParamMap) {
|
public ResourceVersionMap getVersionMap(String theResourceName, SearchParameterMap theSearchParamMap) {
|
||||||
IFhirResourceDao<?> dao = myDaoRegistry.getResourceDao(theResourceName);
|
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)
|
.map(ResourcePersistentId::getIdAsLong)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue