Refactor BaseHapiFhirDao.getOrCreateTag method to run in a separate thread for XA transaction compatibility
XA Transaction Issue with HAPI FHIR and PostgreSQL
We are experiencing issues in our HAPI FHIR application when using XA transactions, similar to those reported in issue #3412.
Problem
The PostgreSQL JDBC driver's PGXAConnection does not support suspend/resume operations, as detailed in the official documentation. This limitation causes exceptions when the PROPAGATION_REQUIRES_NEW transaction propagation behavior is used in XA environments, since it requires suspending the current transaction and resuming it later.
Proposed Solution
The solution focuses on simplifying the TagDefinition handling by addressing the primary concern of managing tag creation in a concurrent environment. Previously, complex retry and nested transaction logic was necessary due to a uniqueness constraint on the hfj_tag_def table, which prevented duplicate tag definitions. However, this constraint was relaxed, and duplicate tag definitions are now allowed, making the nested transaction and retry logic obsolete.
- closes #3412
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 83.58%. Comparing base (
406db33) to head (b18c22b). Report is 87 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #6224 +/- ##
============================================
+ Coverage 83.54% 83.58% +0.04%
- Complexity 27432 27560 +128
============================================
Files 1707 1716 +9
Lines 106185 106634 +449
Branches 13397 13430 +33
============================================
+ Hits 88710 89135 +425
+ Misses 11750 11740 -10
- Partials 5725 5759 +34
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
FYI @michaelabuckley all tests go green now