OSDN Git Service

You must hold a lock on the heap page when you call
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 4 Mar 2011 13:37:09 +0000 (15:37 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 4 Mar 2011 13:43:11 +0000 (15:43 +0200)
CheckForSerializableConflictOut(), because it can set hint bits.

YAMAMOTO Takashi

src/backend/access/heap/heapam.c
src/backend/storage/lmgr/predicate.c

index 7dcc601..89697f6 100644 (file)
@@ -1472,10 +1472,10 @@ heap_fetch(Relation relation,
        if (valid)
                PredicateLockTuple(relation, tuple);
 
-       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
-
        CheckForSerializableConflictOut(valid, relation, tuple, buffer);
 
+       LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+
        if (valid)
        {
                /*
index aa657fa..700c0db 100644 (file)
@@ -3366,9 +3366,10 @@ XidIsConcurrent(TransactionId xid)
  * If the transactions overlap (i.e., they cannot see each other's writes),
  * then we have a conflict out.
  *
- * This function should be called just about anywhere in heapam.c that a
- * tuple has been read.  There is currently no known reason to call this
- * function from an index AM.
+ * This function should be called just about anywhere in heapam.c where a
+ * tuple has been read. The caller must hold at least a shared lock on the
+ * buffer, because this function might set hint bits on the tuple. There is
+ * currently no known reason to call this function from an index AM.
  */
 void
 CheckForSerializableConflictOut(const bool visible, const Relation relation,