-
Priyanka Sangam authored
A transaction which inserts a child row may run concurrently with a transaction which deletes the parent row for that child. One of the transactions should be aborted in this case, or there will be an orphaned child row. Before committing an INSERT on a child row, a READ of the parent row is triggered to confirm that the parent exists. Similarly, before committing a DELETE on a parent row, a READ or SCAN is done to confirm that no child rows exist. If the INSERT(child) and DELETE(parent) transactions are run concurrently, their PREPARE and COMMIT ops may interleave in such a way that both transactions commit. This occurs because the triggered reads are done using CommittedRead locks, which are not strong enough to prevent such error scenarios. This is fixed by using the stronger lock mode of SimpleRead for both triggered reads. The use of SimpleRead locks ensures that at least one transaction will abort in every scenario of interleaved ops from concurrent INSERT(child) and DELETE(parent) transactions. Reviewed-by:
Frazer Clement <frazer.clement@oracle.com> Change-Id: Ifde79ff11ee1a3dac8d955490b9140cd07d3d242
Priyanka Sangam authoredA transaction which inserts a child row may run concurrently with a transaction which deletes the parent row for that child. One of the transactions should be aborted in this case, or there will be an orphaned child row. Before committing an INSERT on a child row, a READ of the parent row is triggered to confirm that the parent exists. Similarly, before committing a DELETE on a parent row, a READ or SCAN is done to confirm that no child rows exist. If the INSERT(child) and DELETE(parent) transactions are run concurrently, their PREPARE and COMMIT ops may interleave in such a way that both transactions commit. This occurs because the triggered reads are done using CommittedRead locks, which are not strong enough to prevent such error scenarios. This is fixed by using the stronger lock mode of SimpleRead for both triggered reads. The use of SimpleRead locks ensures that at least one transaction will abort in every scenario of interleaved ops from concurrent INSERT(child) and DELETE(parent) transactions. Reviewed-by:
Frazer Clement <frazer.clement@oracle.com> Change-Id: Ifde79ff11ee1a3dac8d955490b9140cd07d3d242
Loading