1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-04 20:11:56 +03:00

Revert: Allow locking updated tuples in tuple_update() and tuple_delete()

This commit reverts 87985cc925 and 818861eb57 per review by Andres Freund.

Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de
This commit is contained in:
Alexander Korotkov
2024-04-11 15:51:35 +03:00
parent da841aa4dc
commit 193e6d18e5
9 changed files with 346 additions and 501 deletions

View File

@@ -287,23 +287,16 @@ simple_table_tuple_insert(Relation rel, TupleTableSlot *slot)
* via ereport().
*/
void
simple_table_tuple_delete(Relation rel, ItemPointer tid, Snapshot snapshot,
TupleTableSlot *oldSlot)
simple_table_tuple_delete(Relation rel, ItemPointer tid, Snapshot snapshot)
{
TM_Result result;
TM_FailureData tmfd;
int options = TABLE_MODIFY_WAIT; /* wait for commit */
/* Fetch old tuple if the relevant slot is provided */
if (oldSlot)
options |= TABLE_MODIFY_FETCH_OLD_TUPLE;
result = table_tuple_delete(rel, tid,
GetCurrentCommandId(true),
snapshot, InvalidSnapshot,
options,
&tmfd, false /* changingPart */ ,
oldSlot);
true /* wait for commit */ ,
&tmfd, false /* changingPart */ );
switch (result)
{
@@ -342,24 +335,17 @@ void
simple_table_tuple_update(Relation rel, ItemPointer otid,
TupleTableSlot *slot,
Snapshot snapshot,
TU_UpdateIndexes *update_indexes,
TupleTableSlot *oldSlot)
TU_UpdateIndexes *update_indexes)
{
TM_Result result;
TM_FailureData tmfd;
LockTupleMode lockmode;
int options = TABLE_MODIFY_WAIT; /* wait for commit */
/* Fetch old tuple if the relevant slot is provided */
if (oldSlot)
options |= TABLE_MODIFY_FETCH_OLD_TUPLE;
result = table_tuple_update(rel, otid, slot,
GetCurrentCommandId(true),
snapshot, InvalidSnapshot,
options,
&tmfd, &lockmode, update_indexes,
oldSlot);
true /* wait for commit */ ,
&tmfd, &lockmode, update_indexes);
switch (result)
{