diff options
author | Andres Freund | 2019-05-14 19:11:26 +0000 |
---|---|---|
committer | Andres Freund | 2019-05-14 19:19:32 +0000 |
commit | aa4b8c61d2cd57b53be03defb04d59b232a0e150 (patch) | |
tree | 3b7b1ca7702d20a11c652e876e666489f2d84996 | |
parent | 08e2edc0767ab6e619970f165cb34d4673105f23 (diff) |
Handle table_complete_speculative's succeeded argument as documented.
For some reason both callsite and the implementation for heapam had
the meaning inverted (i.e. succeeded == true was passed in case of
conflict). That's confusing.
I (Andres) briefly pondered whether it'd be better to rename
table_complete_speculative's argument to 'bool specConflict' or such,
but decided not to. The 'complete' in the function name for me makes
`succeeded` sound a bit better.
Reported-By: Ashwin Agrawal, Melanie Plageman, Heikki Linnakangas
Discussion:
https://postgr.es/m/CALfoeitk7-TACwYv3hCw45FNPjkA86RfXg4iQ5kAOPhR+F1Y4w@mail.gmail.com
https://postgr.es/m/[email protected]
-rw-r--r-- | src/backend/access/heap/heapam_handler.c | 2 | ||||
-rw-r--r-- | src/backend/executor/nodeModifyTable.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index bc47856ad5..00505ec3f4 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -282,7 +282,7 @@ heapam_tuple_complete_speculative(Relation relation, TupleTableSlot *slot, HeapTuple tuple = ExecFetchSlotHeapTuple(slot, true, &shouldFree); /* adjust the tuple's state accordingly */ - if (!succeeded) + if (succeeded) heap_finish_speculative(relation, &slot->tts_tid); else heap_abort_speculative(relation, &slot->tts_tid); diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 444c0c0574..d545bbce8a 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -556,7 +556,7 @@ ExecInsert(ModifyTableState *mtstate, /* adjust the tuple's state accordingly */ table_complete_speculative(resultRelationDesc, slot, - specToken, specConflict); + specToken, !specConflict); /* * Wake up anyone waiting for our decision. They will re-check |