hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

Make conditional_create_duplicate_identifiers_enabled default true if partitioning is enabled #6442

Open esecules opened 2 weeks ago

esecules commented 2 weeks ago

NOTE: Before filing a ticket, please see the following URL: https://github.com/hapifhir/hapi-fhir/wiki/Getting-Help

Describe the issue One of the requirements for data partitioning and multitennancy is that one tenant's data cannot affect another tenant. However the default setting: conditional_create_duplicate_identifiers_enabled=false means that Resource identifiers must be globally unique across tenants (see error message below). This is not expected when partitioning is enabled. I propose that this setting is default true when partitioning is enabled so that identifiers from separate tenants can have the same values. I might go one step further to suggest that this setting is not needed at the top level as I cannot see a case where we would want to set it to true or false independently of enabling or disabling partitioning as a whole.

Environment (please complete the following information):

Additional context The default configuration for partitioning produces this error log when I run my partitioning tests that create two identical resources in two separate tenants. I would expect that partitioning works by default.

ERROR: duplicate key value violates unique constraint \"hfj_res_search_url_pkey\"\n  Detail: Key (res_search_url, partition_id)=(Patient?identifier=1_76, -1) already exists.
esecules commented 2 weeks ago

relates to the setting added in https://github.com/hapifhir/hapi-fhir/pull/5983 to fix the bug https://github.com/hapifhir/hapi-fhir/issues/6033