Describe the bug
The reindex operation is vulnerable to a race condition if the resource is updated after the reindex read is performed.
Environment
Which version of IBM FHIR Server?
To Reproduce
Steps to reproduce the behavior:
Concurrent resource updates at the same time as concurrent reindex operations on overlapping resources.
Expected behavior
The reindex operation must lock the logical_resource_ident record before inserting the new parameters.
Additional context
The select for update needs to use the resource_type_id and logical_id (the PK for logical_resource_ident). Because the reindex operation is driven by logical_resource_id, there must be a read against logical_resources first to get these values. The logical_resource_ident record can then be locked and the resource payload read without risk of a race condition.
Describe the bug
The reindex operation is vulnerable to a race condition if the resource is updated after the reindex read is performed.
Environment
Which version of IBM FHIR Server?
To Reproduce
Steps to reproduce the behavior:
Concurrent resource updates at the same time as concurrent reindex operations on overlapping resources.
Expected behavior
The reindex operation must lock the logical_resource_ident record before inserting the new parameters.
Additional context
The select for update needs to use the resource_type_id and logical_id (the PK for logical_resource_ident). Because the reindex operation is driven by logical_resource_id, there must be a read against logical_resources first to get these values. The logical_resource_ident record can then be locked and the resource payload read without risk of a race condition.