Skip to content

Conversation

@jamesagnew
Copy link
Collaborator

This PR adds an explicit partitionId parameter to the bulk patch operation, and improves general support for running this batch job in a partitioned environment.

jamesagnew and others added 30 commits November 7, 2025 18:37
* bump to 8.7, add version enums

* changelog folder for 8.8

* increase memory to elastic search container

---------

Co-authored-by: jdar <[email protected]>
* [7332] update mdm resource persistence id

* [7332] add tests and changelog

* [7332] update changelog

* [7332] update test

* [7332] update test

* [7332] update changelog
* increase memory to elastic search container (#7326)

Co-authored-by: jdar <[email protected]>

* 7282 - Added the ability for an Interceptor to alter the HTTP Response Code when an Exception is thrown (#7303)

* 7282 - Added the ability for an Interceptor to alter the HTTP Response Code when an Exception is thrown.

* Enhanced the solution based on code review feedback.

* Removed a class that was being used to store the Http response Code and used the existing HttpStatus class instead.

* Enhanced the Unit Test.

* Enhanced the Javadoc for the Pointcut.SERVER_OUTGOING_FAILURE_OPERATIONOUTCOME enum.

* Changed the Interceptor Hook implementation based on Code Review feedback.

* Removed an unused variable declaration.

* Removed an unused variable declaration.

* Ran mvn spotless:apply to apply proper formatting.

* More code review feedback.

* Use ResponseDetails for exception outcome modification.

* Remove bit about "valid status" -- we allow anything

* changelog

* Replace the response object

---------

Co-authored-by: Michael Buckley <[email protected]>

* batch2 jobs that are cancelled will not be returned when requesting a… (#7321) (#7327)

* Improve URL processing for JpaPersistedResourceValidationSupport (#7330)

* Improve URL processing for JpaPersistedResourceValidationSupport

* Add changelog

* allow fetching subsequent pages when registering an allowed spec of r… (#7329)

* allow fetching subsequent pages when registering an allowed spec of resourcetype search

* 7833: add missing relationship between TermConcept and TermConceptProperty (#7346)

* 7316 do not expand chain refparams (#7350)

* Make sure refparams with chains are not expanded via MDM

* 7316: code review feedback

* [7269] bulk export history fails with client-assigned string IDs (#7300)

* fixed 7269 bulk export history failure with client-assigned string IDs

* fixed 7269 bulk export history failure with client-assigned string IDs

* Update hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/8_6_0/7296-bulk-export-fails-with-string-resource-ids.yaml

Co-authored-by: jdar8 <[email protected]>

* changed string ids to IResourcePersistentId

* changed string ids to IResourcePersistentId

* batch2 jobs that are cancelled will not be returned when requesting a… (#7321)

* Bump to 8 7 (#7322)

* bump to 8.7, add version enums

* changelog folder for 8.8

* increase memory to elastic search container

---------

Co-authored-by: jdar <[email protected]>

* Update hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java

Co-authored-by: Michael Buckley <[email protected]>

* fixed with spotless

* Revert "Bump to 8 7 (#7322)"

This reverts commit 40f1128.

* Revert "changed string ids to IResourcePersistentId"

This reverts commit 06af86a.

* Revert "batch2 jobs that are cancelled will not be returned when requesting a… (#7321)"

This reverts commit be08680.

* changed string ids to IResourcePersistentId

* fixed with spotless

* Bumped version number

* adding missing change to fix build

---------

Co-authored-by: Rob Caruso <[email protected]>
Co-authored-by: jdar8 <[email protected]>
Co-authored-by: TipzCM <[email protected]>
Co-authored-by: jdar <[email protected]>
Co-authored-by: Michael Buckley <[email protected]>

* [7332] fix mdm-query-links (#7356)

* 7324 unable to access collection bundles when performing search requests (#7325)

* Add failing tests

* Fix

* Changelog

* Fix comment

* Fix test

* Try fixing CodeQL autobuild error

* Implement revision suggestions

* Add missed test case parameter

* PatientIdPartitionIntercepto should allow Encounter.subject parameter (#7348)

* Work on megascale enhancements part 6

* Add changelog

* Test fix

* Update hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/8_6_0/7348-allow-patientidcompartmentmode-search-encounter-subject.yaml

Co-authored-by: Nathan Doef  <[email protected]>

* Test fixes

---------

Co-authored-by: Nathan Doef <[email protected]>

* Bump to spring62 (#7351)

* Bump spring framework version

* Replace Base64Utils with Base64.getEncoder()

* Bump spring boot test deps to match spring version 6.2

* Bump junit for spring tests

---------

Co-authored-by: Gary <[email protected]>

* 7217 with rel 8 6 (#7337)

* Automated Migration Testing (HAPI-FHIR) - updated test migration scripts for 8_6_0 (#7357)

* Remove dead autowire (#7365)

* Don't reuse TransactionDetails for partitioned TX execution (#7363)

* Fix tags on megascale

* Add test

* Test fix

* Version bump

---------

Co-authored-by: jdar <[email protected]>
Co-authored-by: Kevin Dougan <[email protected]>
Co-authored-by: Michael Buckley <[email protected]>
Co-authored-by: TipzCM <[email protected]>
Co-authored-by: James Agnew <[email protected]>
Co-authored-by: another-luis <[email protected]>
Co-authored-by: Rob Caruso <[email protected]>
Co-authored-by: Rob Caruso <[email protected]>
Co-authored-by: Yaling Pei <[email protected]>
Co-authored-by: jmarchionatto <[email protected]>
Co-authored-by: Nathan Doef <[email protected]>
Co-authored-by: tadgh <[email protected]>
Co-authored-by: Gary <[email protected]>
Co-authored-by: volodymyr-korzh <[email protected]>
Co-authored-by: Gary Graham <[email protected]>
* Ensure streaming queries don't impose limit clauses on the sql when called in "synchronous" mode.

* changelog
…7392)

* Fix logic in Icd10CmLoader to append 7th character extensions to the leaf-level concepts in the hierarchy (rather than to just the immediate child concepts).

* Fix logic in Icd10CmLoader to append 7th character extensions to the leaf-level concepts in the hierarchy (rather than to just the immediate child concepts).

* Fix logic in Icd10CmLoader to append 7th character extensions to the leaf-level concepts in the hierarchy (rather than to just the immediate child concepts).

---------

Co-authored-by: Ian Marshall <[email protected]>
…#7389)

* Inferno test parsing failure when 401 rejection does not contain OperationOutcome - failing test

* Inferno test parsing failure when 401 rejection does not contain OperationOutcome - implementation

* Inferno test parsing failure when 401 rejection does not contain OperationOutcome - changelog
* backport complete

* Be more resilient to unexpected resource version IDs in database (#7216)

* Handle mismatched versions

* Be more resilient to unexpected resource versions in DB

* Test fix

* Test fix

* Work on tests

* Test fixes

* Test fixes

* Add changelog

* Spotless

* Address review comments

* HAPI bump

* Fix API breakages

* api breakages

* version set

* changelog and versioning

---------

Co-authored-by: James Agnew <[email protected]>
Co-authored-by: Gary Graham <[email protected]>
Co-authored-by: jdar <[email protected]>
)

* STORAGE_TRANSACTION_PROCESSING-doesn't-pass-ServletRequestDetails

* Add changelog

---------

Co-authored-by: James Agnew <[email protected]>
…7388)

* Fix Encounter $everything not working in REQUEST_TENANT partitioning

* Add test

* changelog

* Remove unused HttpServletRequest parameter

* Remove unnecessary overriding
* bump to 8.7, add version enums

* changelog folder for 8.8

* increase memory to elastic search container

---------

Co-authored-by: jdar <[email protected]>
* [7332] update mdm resource persistence id

* [7332] add tests and changelog

* [7332] update changelog

* [7332] update test

* [7332] update test

* [7332] update changelog
* [7332] update mdm resource persistence id

* [7332] add tests and changelog

* [7332] update changelog

* [7332] update test

* [7332] update test

* [7332] update changelog
@robogary
Copy link
Contributor

Formatting check succeeded!

}

@Override
public ResourceVersionMap getVersionMap(String theResourceName, SearchParameterMap theSearchParamMap) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why add this method? Is there a reason the callers can't provide the parititon scope?

.withRequest(theRequestDetails)
.search(() -> builder.createQueryStream(
.withRequestPartitionId(theRequestPartitionId)
.search(partition -> builder.createQueryStream(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice change! Passing partition through makes shard search much more practical.

return requestDetails.getRequestPartitionId();
}
return RequestPartitionId.defaultPartition(myPartitionSettings);
return RequestPartitionId.allPartitions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: this is a big change. Is this safe?

final String matchUrl = "identifier=http://tempuri.org|1";
bundleBuilder.addTransactionCreateEntry(myTask1, "urn:uuid:59cda086-4763-4ef0-8e36-8c90058686ea")
.conditional(matchUrl);
Callable<Bundle> bundleSupplier = () -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial: Supplier.get() is clearer than Callable.call().

assertThat(toUnqualifiedVersionlessIdValues(result)).containsExactly("Patient/A");

myCaptureQueriesListener.logSelectQueriesForCurrentThread();
String searchSql = myCaptureQueriesListener.getSelectQueries().get(0).getSql(true, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: add a positive assertion to make sure you got the right query.

return RequestPartitionId.allPartitions();
}

RequestPartitionId existingPartitionId =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why do we need this? Maybe add a comment explaining.

RequestPartitionId requestPartitionId = partitionedUrl.getRequestPartitionId();
requestPartitionId = getIfNull(requestPartitionId, RequestPartitionId.allPartitions());

List<RequestPartitionId> partitionChunks =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: So sharding is finally a concept in Hapi. This will make things easier.

List<RequestPartitionId> partitionChunks =
myJobPartitionProvider.splitPartitionByShards(requestPartitionId);

for (RequestPartitionId nextPartitionId : partitionChunks) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: this might be cleaner if we had a service to "expand" a list of PartitionedUrls instead of doing it inline here. Move that into IJobPartitionProvider. This code won't make any sense to Hapi devs.

throws IOException {
ServletRequestUtil.validatePreferAsyncHeader(theRequestDetails, getOperationName());

theJobParameters.setRequestPartitionId(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security question: do we want to allways allow explicit partition ids, or just in UNNAMED mode? This feels like a security hole in REQEUST_TENANT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.