hapifhir / hapi-fhir

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

Conditional creates on resources with identical identifiers across partitions results in a primary key violation #6033

Closed lukedegruchy closed 3 months ago

lukedegruchy commented 3 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Enable partioning
  2. Create 2 partitions
  3. On the first partition POST a bundle with a patient with an identifier: (system: acme, value: 123) with an ifNotExists of identifier=acme|123
  4. POST the same bundle but on the second partition
  5. See error: HAPI-0550: could not execute batch [Unique index or primary key violation: "PUBLIC.PRIMARY_KEY_3 ON PUBLIC.HFJ_RES_SEARCH_URL

Expected behavior The second bundle should insert correctly and both resources should be able to coexist on different partitions.

Environment (please complete the following information):

Additional context This behaviour should be configurable to users can either opt in or out of supporting resources with duplicate identifiers across partitions.