index b502086300038faa94c50e6ce4d56a8c9f080df4..9876f8b695bdb1143e37024dbc19748e4bf8ff5b 100644 (file)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.185 2005年03月27日 23:52:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.186 2005年03月28日 01:50:32 tgl Exp $
*
*
* INTERFACE ROUTINES
#include "pgstat.h"
-/* comments are in heap_update */
-static xl_heaptid _locked_tuple_;
-static void _heap_unlock_tuple(void *data);
static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
ItemPointerData from, Buffer newbuf, HeapTuple newtup, bool move);
* context lock (but not the pin!) on the old tuple's buffer while we
* are off doing TOAST and/or table-file-extension work. We must mark
* the old tuple to show that it's already being updated, else other
- * processes may try to update it themselves. To avoid second XLOG log
- * record, we use xact mgr hook to unlock old tuple without reading
- * log if xact will abort before update is logged. In the event of
- * crash prio logging, TQUAL routines will see HEAP_XMAX_UNLOGGED
- * flag...
- *
- * NOTE: this trick is useless currently but saved for future when we'll
- * implement UNDO and will re-use transaction IDs after postmaster
- * startup.
+ * processes may try to update it themselves.
*
* We need to invoke the toaster if there are already any out-of-line
* toasted values present, or if the new tuple is over-threshold.
if (need_toast || newtupsize > pagefree)
{
- _locked_tuple_.node = relation->rd_node;
- _locked_tuple_.tid = oldtup.t_self;
- XactPushRollback(_heap_unlock_tuple, (void *) &_locked_tuple_);
-
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID |
HEAP_MARKED_FOR_UPDATE |
HEAP_MOVED);
- oldtup.t_data->t_infomask |= HEAP_XMAX_UNLOGGED;
HeapTupleHeaderSetXmax(oldtup.t_data, xid);
HeapTupleHeaderSetCmax(oldtup.t_data, cid);
already_marked = true;
RelationPutHeapTuple(relation, newbuf, newtup); /* insert new tuple */
- if (already_marked)
- {
- oldtup.t_data->t_infomask &= ~HEAP_XMAX_UNLOGGED;
- XactPopRollback();
- }
- else
+ if (!already_marked)
{
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
HEAP_XMAX_INVALID |
}
-static void
-_heap_unlock_tuple(void *data)
-{
- TransactionId xid = GetCurrentTransactionId();
- xl_heaptid *xltid = (xl_heaptid *) data;
- Relation reln = XLogOpenRelation(false, RM_HEAP_ID, xltid->node);
- Buffer buffer;
- Page page;
- OffsetNumber offnum;
- ItemId lp;
- HeapTupleHeader htup;
-
- if (!RelationIsValid(reln))
- elog(PANIC, "_heap_unlock_tuple: can't open relation");
-
- buffer = XLogReadBuffer(false, reln,
- ItemPointerGetBlockNumber(&(xltid->tid)));
- if (!BufferIsValid(buffer))
- elog(PANIC, "_heap_unlock_tuple: can't read buffer");
-
- page = (Page) BufferGetPage(buffer);
- if (PageIsNew((PageHeader) page))
- elog(PANIC, "_heap_unlock_tuple: uninitialized page");
-
- offnum = ItemPointerGetOffsetNumber(&(xltid->tid));
- if (offnum > PageGetMaxOffsetNumber(page))
- elog(PANIC, "_heap_unlock_tuple: invalid itemid");
- lp = PageGetItemId(page, offnum);
-
- if (!ItemIdIsUsed(lp) || ItemIdDeleted(lp))
- elog(PANIC, "_heap_unlock_tuple: unused/deleted tuple in rollback");
-
- htup = (HeapTupleHeader) PageGetItem(page, lp);
-
- if (!TransactionIdEquals(HeapTupleHeaderGetXmax(htup), xid))
- elog(PANIC, "_heap_unlock_tuple: invalid xmax in rollback");
- htup->t_infomask &= ~HEAP_XMAX_UNLOGGED;
- htup->t_infomask |= HEAP_XMAX_INVALID;
- LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
- WriteBuffer(buffer);
-}
-
void
heap_redo(XLogRecPtr lsn, XLogRecord *record)
{
index 5c84bb995542bee0802182caaa6d823686871db4..b5bb3d5b1fc40ad8d88c90a1c754e97d4f403313 100644 (file)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.197 2005年02月20日 21:46:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.198 2005年03月28日 01:50:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
static SubXactCallbackItem *SubXact_callbacks = NULL;
-static void (*_RollbackFunc) (void *) = NULL;
-static void *_RollbackData = NULL;
-
/* local function prototypes */
static void AssignSubTransactionId(TransactionState s);
else
strcat(buf, "UNKNOWN");
}
-
-void
- XactPushRollback(void (*func) (void *), void *data)
-{
-#ifdef XLOG_II
- if (_RollbackFunc != NULL)
- elog(PANIC, "XactPushRollback: already installed");
-#endif
-
- _RollbackFunc = func;
- _RollbackData = data;
-}
-
-void
-XactPopRollback(void)
-{
- _RollbackFunc = NULL;
-}
index 51da662df1f5ec6659eaa46c3993b9a25372bde2..e57ce8a3cbefcbcf9a13a72e33e3079b6f579f79 100644 (file)
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.72 2004年12月31日 22:03:21 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.73 2005年03月28日 01:50:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -152,9 +152,7 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
* attribute(s) */
#define HEAP_HASEXTENDED 0x000C /* the two above combined */
#define HEAP_HASOID 0x0010 /* has an object-id field */
-/* 0x0020 and 0x0040 are unused */
-#define HEAP_XMAX_UNLOGGED 0x0080 /* to lock tuple for update
- * without logging */
+/* 0x0020, 0x0040 and 0x0080 are unused */
#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
index 0039b5b12432d398be1b71e966d7992d0ae327a4..0d3a6383426a0809a7b9dc1300ec65cfef13cebe 100644 (file)
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.74 2004年12月31日 22:03:21 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/xact.h,v 1.75 2005年03月28日 01:50:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -145,9 +145,6 @@ extern void RecordTransactionCommit(void);
extern int xactGetCommittedChildren(TransactionId **ptr);
-extern void XactPushRollback(void (*func) (void *), void *data);
-extern void XactPopRollback(void);
-
extern void xact_redo(XLogRecPtr lsn, XLogRecord *record);
extern void xact_undo(XLogRecPtr lsn, XLogRecord *record);
extern void xact_desc(char *buf, uint8 xl_info, char *rec);