aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2013-11-27 17:45:25 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2013-11-28 12:00:12 -0300
commite518fa7adfc28e0d0a99fe4e5711386d9a5c6532 (patch)
treebaf622609b4b8ab79c2c62ee2039468a19c87a84
parentb6ecde8ed4799720eaa1c015e325012dbad095fa (diff)
downloadpostgresql-e518fa7adfc28e0d0a99fe4e5711386d9a5c6532.tar.gz
postgresql-e518fa7adfc28e0d0a99fe4e5711386d9a5c6532.zip
Cope with heap_fetch failure while locking an update chain
The reason for the fetch failure is that the tuple was removed because it was dead; so the failure is innocuous and can be ignored. Moreover, there's no need for further work and we can return success to the caller immediately. EvalPlanQualFetch is doing something very similar to this already. Report and test case from Andres Freund in 20131124000203.GA4403@alap2.anarazel.de
-rw-r--r--src/backend/access/heap/heapam.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index a21f31b4095..f55e612590f 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -4824,7 +4824,16 @@ heap_lock_updated_tuple_rec(Relation rel, ItemPointer tid, TransactionId xid,
ItemPointerCopy(&tupid, &(mytup.t_self));
if (!heap_fetch(rel, SnapshotAny, &mytup, &buf, false, NULL))
- elog(ERROR, "unable to fetch updated version of tuple");
+ {
+ /*
+ * if we fail to find the updated version of the tuple, it's
+ * because it was vacuumed/pruned away after its creator
+ * transaction aborted. So behave as if we got to the end of the
+ * chain, and there's no further tuple to lock: return success to
+ * caller.
+ */
+ return HeapTupleMayBeUpdated;
+ }
l4:
CHECK_FOR_INTERRUPTS();