Details
-
Bug
-
Status: Open (View Workflow)
-
P4
-
Resolution: Unresolved
-
None
-
None
-
None
-
Sif
-
TBD
Description
/inventory-storage/bound-withs assumes that no other process touches the records involved. This cannot be guaranteed and may cause roll backs or unique violation exceptions (race condition).
The validation, the INSERT and the DELETE should be in the same transaction.
SELECT count(*) FROM item WHERE id=$1 FOR KEY SHARE; SELECT count(*) FROM holdings_record WHERE id in (...) FOR KEY SHARE; DELETE FROM bound_with_part WHERE itemId=$1 AND holdingsRecordId NOT IN (...) RETURNING jsonb; INSERT INTO bound_with_part (id, jsonb) VALUES ... ON CONFLICT DO NOTHING RETURNING jsonb;
FOR KEY SHARE is needed to prevent a roll-back if some other process wants to delete the item or the holding.
RETURNING jsonb is needed to return the changed elements for the Kafka messages.
TestRail: Results
Attachments
Issue Links
- continues
-
MODINVSTOR-1022 Bound-with. New PUT API where a single item ID and a list of holdings IDs can be created
-
- Closed
-