Skip to content

Commit 250dae3

Browse files
tadghepeartreepeartreemarkiantornotadgh-secondary
authored
Final 8.0.0 Mergeback (hapifhir#6756)
* 6711 everything operation with partitioning enabled returns duplicates since the dbpm merge (hapifhir#6712) * Add test stub * Changelog * Wording * Trying to get test working * Initial commit of tests and potential hash fix * Remove json file * Remove dead code * Remove dead test, spotless, fix changelog * Limitation * Version bump to 8.0 * With partitioning selection mode set to request tenant, creating a cross partition subscription will fail if the default partition id is not null (hapifhir#6748) * initial failing test * fix with changelog and modification to previous changelog --------- Co-authored-by: peartree <[email protected]> * Updating version to: 8.0.1 post release. * Spotless --------- Co-authored-by: Etienne Poirier <[email protected]> Co-authored-by: peartree <[email protected]> Co-authored-by: markiantorno <[email protected]> Co-authored-by: tadgh <[email protected]>
1 parent 9ae60f1 commit 250dae3

File tree

13 files changed

+119
-9
lines changed

13 files changed

+119
-9
lines changed

hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionEnum.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ public enum VersionEnum {
174174
V7_7_0,
175175
V7_8_0,
176176
V8_0_0,
177+
V8_0_1,
177178
V8_1_0,
178179
V8_2_0;
179180

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
type: fix
33
issue: 6686
4-
title: "Previously, attempting to create a cross-partition subscription would fail if the default partition ID was
5-
assigned a value different than the default value(null). This issue is fixed."
4+
title: "With partitioning selection mode set to 'PATIENT_ID', attempting to create a cross-partition subscription
5+
would fail if the default partition ID was assigned a value different than the default value(null). This issue is fixed."
6+
67

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
type: fix
3+
issue: 6711
4+
jira: SMILE-9733
5+
title: "Introduction of Database Partitioning Mode temporarily introduced a regression in the Patient `$everything` operation on partitioned servers, in which duplicates would be returned in the bundle. This has been corrected."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
type: fix
3+
issue: 6747
4+
title: "With partitioning selection mode set to 'REQUEST_TENANT', attempting to create a cross-partition subscription
5+
would fail if the default partition ID was assigned a value different than the default value(null). This issue is fixed."
6+

hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_partitioning/db_partition_mode.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ It is not yet possible to migrate an existing database schema between these two
3737

3838
The CLI [Migrator](../server_jpa/upgrading.md) can be used to upgrade the database schema when upgrading HAPI FHIR. It must be configured to use the Database Partition Mode schema by using the `--flags` argument as [described here](../server_jpa/upgrading.md#database-partition-mode).
3939

40+
# Limitations
41+
42+
As Database Partitioning Mode is being built from the ground up, there are currently some known limitations.
43+
44+
* MDM does not currently work with Database Partitioning Mode. This will be corrected in a future release
45+

hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/RequestPartitionHelperSvc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public RequestPartitionId validateAndNormalizePartitionNames(RequestPartitionId
144144
if (partition != null) {
145145
ids.add(partition.getId());
146146
} else {
147-
ids.add(null);
147+
ids.add(myPartitionSettings.getDefaultPartitionId());
148148
}
149149
}
150150
}

hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,8 @@ public Set<JpaPid> loadIncludes(SearchBuilderLoadIncludesParameters<JpaPid> theP
16111611
for (JpaPid next : pidsToInclude) {
16121612
if (!original.contains(next) && !allAdded.contains(next)) {
16131613
nextRoundMatches.add(next);
1614+
} else {
1615+
ourLog.trace("Skipping include since it has already been seen. [jpaPid={}]", next);
16141616
}
16151617
}
16161618

hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dao/JpaPid.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public boolean equals(Object theO) {
142142
return false;
143143
}
144144
JpaPid jpaPid = (JpaPid) theO;
145-
return Objects.equals(myId, jpaPid.myId) && Objects.equals(myPartitionIdValue, jpaPid.myPartitionIdValue);
145+
return Objects.equals(myId, jpaPid.myId);
146146
}
147147

148148
/**
@@ -151,7 +151,7 @@ public boolean equals(Object theO) {
151151
*/
152152
@Override
153153
public int hashCode() {
154-
return Objects.hash(myId, myPartitionIdValue);
154+
return Objects.hash(myId);
155155
}
156156

157157
@Override

hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSearchCacheR4Test.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
package ca.uhn.fhir.jpa.dao.r4;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import ca.uhn.fhir.jpa.api.dao.PatientEverythingParameters;
6+
import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider;
7+
import ca.uhn.fhir.jpa.rp.r4.PatientResourceProvider;
48
import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider;
59
import ca.uhn.fhir.jpa.search.cache.SearchCacheStatusEnum;
610
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
711
import ca.uhn.fhir.jpa.util.SqlQuery;
12+
import ca.uhn.fhir.rest.api.server.IBundleProvider;
13+
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
814
import org.apache.commons.lang3.StringUtils;
15+
import org.hl7.fhir.instance.model.api.IBaseResource;
916
import org.hl7.fhir.instance.model.api.IIdType;
17+
import org.hl7.fhir.r4.model.IntegerType;
1018
import org.junit.jupiter.api.Test;
1119
import org.slf4j.Logger;
1220
import org.slf4j.LoggerFactory;
21+
import org.springframework.beans.factory.annotation.Autowired;
1322

23+
import java.util.ArrayList;
1424
import java.util.List;
1525
import java.util.stream.Collectors;
1626

hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/partition/RequestPartitionHelperSvcTest.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Set;
2222
import java.util.stream.Stream;
2323

24+
import static ca.uhn.fhir.jpa.model.util.JpaConstants.DEFAULT_PARTITION_NAME;
2425
import static org.assertj.core.api.Assertions.assertThat;
2526
import static org.junit.jupiter.api.Assertions.assertEquals;
2627
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -190,7 +191,7 @@ public void testValidateAndNormalizePartitionNames_withNameAndInvalidId_throwsEx
190191
}
191192

192193
@ParameterizedTest
193-
@MethodSource
194+
@MethodSource("withPartitionIds")
194195
public void testDefaultPartition_whenDefaultPartitionIsNotNull(Integer theRequestPartitionId) {
195196
final Integer defaultPartitionId = 0;
196197
myPartitionSettings.setDefaultPartitionId(defaultPartitionId);
@@ -206,7 +207,20 @@ public void testDefaultPartition_whenDefaultPartitionIsNotNull(Integer theReques
206207
}
207208
}
208209

209-
private static Stream<Integer> testDefaultPartition_whenDefaultPartitionIsNotNull(){
210+
@ParameterizedTest
211+
@MethodSource("withPartitionIds")
212+
public void testValidateAndNormalizePartitionNames_willResolveDefaultPartitionNameToCorrectPartitionId(Integer theDefaultPartitionId) {
213+
myPartitionSettings.setDefaultPartitionId(theDefaultPartitionId);
214+
215+
RequestPartitionId requestPartitionId = RequestPartitionId.fromPartitionName(DEFAULT_PARTITION_NAME);
216+
217+
RequestPartitionId normalizedRequestPartitionId = mySvc.validateAndNormalizePartitionNames(requestPartitionId);
218+
219+
assertThat(normalizedRequestPartitionId.isDefaultPartition(theDefaultPartitionId)).isTrue();
220+
221+
}
222+
223+
private static Stream<Integer> withPartitionIds(){
210224
return Stream.of(null, 1,2,3);
211225
}
212226

0 commit comments

Comments
 (0)