diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java index 1e3f5016083..e814a0ab929 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java @@ -433,15 +433,12 @@ public class JpaJobPersistenceImpl implements IJobPersistence { if (theIncludeData) { chunks = myWorkChunkRepository.fetchChunks( PageRequest.of(thePageIndex, thePageSize), theInstanceId); - for (Batch2WorkChunkEntity chunk : chunks) { - theConsumer.accept(toChunk(chunk)); - } } else { - Page page = myWorkChunkMetadataViewRepo.findAll( - Pageable.ofSize(thePageSize).withPage(thePageIndex)); - for (Batch2WorkChunkMetadataView metadataView : page.getContent()) { - theConsumer.accept(metadataView.toChunkMetadata().toWorkChunk()); - } + chunks = myWorkChunkRepository.fetchChunksNoData( + PageRequest.of(thePageIndex, thePageSize), theInstanceId); + } + for (Batch2WorkChunkEntity chunk : chunks) { + theConsumer.accept(toChunk(chunk)); } }); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java index b6984140388..d033d703d17 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java @@ -18,7 +18,10 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.jpa.test.PatientReindexTestHelper; +import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; +import jakarta.annotation.PostConstruct; +import jakarta.persistence.Query; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Patient; @@ -30,8 +33,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.springframework.beans.factory.annotation.Autowired; -import jakarta.annotation.PostConstruct; -import jakarta.persistence.Query; import java.util.Date; import java.util.List; import java.util.stream.Stream; @@ -263,7 +264,7 @@ public class ReindexJobTest extends BaseJpaR4Test { .setOptimizeStorage(ReindexParameters.OptimizeStorageModeEnum.CURRENT_VERSION) .setReindexSearchParameters(ReindexParameters.ReindexSearchParametersEnum.NONE) ); - Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(startRequest); + Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(new SystemRequestDetails(), startRequest); JobInstance outcome = myBatch2JobHelper.awaitJobCompletion(startResponse); assertEquals(10, outcome.getCombinedRecordsProcessed()); @@ -390,7 +391,7 @@ public class ReindexJobTest extends BaseJpaR4Test { JobInstanceStartRequest startRequest = new JobInstanceStartRequest(); startRequest.setJobDefinitionId(ReindexAppCtx.JOB_REINDEX); startRequest.setParameters(new ReindexJobParameters()); - Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(startRequest); + Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(new SystemRequestDetails(), startRequest); JobInstance myJob = myBatch2JobHelper.awaitJobCompletion(startResponse); assertEquals(StatusEnum.COMPLETED, myJob.getStatus()); @@ -445,7 +446,7 @@ public class ReindexJobTest extends BaseJpaR4Test { JobInstanceStartRequest startRequest = new JobInstanceStartRequest(); startRequest.setJobDefinitionId(ReindexAppCtx.JOB_REINDEX); startRequest.setParameters(new ReindexJobParameters()); - Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(startRequest); + Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(new SystemRequestDetails(), startRequest); JobInstance outcome = myBatch2JobHelper.awaitJobFailure(startResponse); // Verify