*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.144 2002/08/06 02:36:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.145 2002/08/13 20:11:03 tgl Exp $
*
*
* INTERFACE ROUTINES
/* NO ELOG(ERROR) from here till changes are logged */
START_CRIT_SECTION();
+
RelationPutHeapTuple(relation, buffer, tup);
pgstat_count_heap_insert(&relation->pgstat_info);
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
HeapTupleHeaderSetXmax(tp.t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmax(tp.t_data, cid);
+ /* Make sure there is no forward chain link in t_ctid */
+ tp.t_data->t_ctid = tp.t_self;
/* XLOG stuff */
if (!relation->rd_istemp)
tuple->t_data->t_infomask |= HEAP_MARKED_FOR_UPDATE;
HeapTupleHeaderSetXmax(tuple->t_data, GetCurrentTransactionId());
HeapTupleHeaderSetCmax(tuple->t_data, cid);
+ /* Make sure there is no forward chain link in t_ctid */
+ tuple->t_data->t_ctid = *tid;
LockBuffer(*buffer, BUFFER_LOCK_UNLOCK);
}
PageRepairFragmentation(page, NULL);
+
+ PageSetLSN(page, lsn);
+ PageSetSUI(page, ThisStartUpID); /* prev sui */
UnlockAndWriteBuffer(buffer);
}
heap_xlog_delete(bool redo, XLogRecPtr lsn, XLogRecord *record)
{
xl_heap_delete *xlrec = (xl_heap_delete *) XLogRecGetData(record);
- Relation reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+ Relation reln;
Buffer buffer;
Page page;
OffsetNumber offnum;
if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
return;
+ reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+
if (!RelationIsValid(reln))
return;
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
HeapTupleHeaderSetXmax(htup, record->xl_xid);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
+ /* Make sure there is no forward chain link in t_ctid */
+ htup->t_ctid = xlrec->target.tid;
PageSetLSN(page, lsn);
PageSetSUI(page, ThisStartUpID);
UnlockAndWriteBuffer(buffer);
heap_xlog_insert(bool redo, XLogRecPtr lsn, XLogRecord *record)
{
xl_heap_insert *xlrec = (xl_heap_insert *) XLogRecGetData(record);
- Relation reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+ Relation reln;
Buffer buffer;
Page page;
OffsetNumber offnum;
if (redo && (record->xl_info & XLR_BKP_BLOCK_1))
return;
+ reln = XLogOpenRelation(redo, RM_HEAP_ID, xlrec->target.node);
+
if (!RelationIsValid(reln))
return;
HeapTupleHeaderSetCmin(htup, FirstCommandId);
HeapTupleHeaderSetXmaxInvalid(htup);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
+ htup->t_ctid = xlrec->target.tid;
if (reln->rd_rel->relhasoids)
{
AssertTupleDescHasOid(reln->rd_att);
~(HEAP_XMIN_COMMITTED | HEAP_XMIN_INVALID | HEAP_MOVED_IN);
htup->t_infomask |= HEAP_MOVED_OFF;
HeapTupleHeaderSetXvac(htup, record->xl_xid);
+ /* Make sure there is no forward chain link in t_ctid */
+ htup->t_ctid = xlrec->target.tid;
}
else
{
HEAP_XMAX_INVALID | HEAP_MARKED_FOR_UPDATE);
HeapTupleHeaderSetXmax(htup, record->xl_xid);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
+ /* Set forward chain link in t_ctid */
+ htup->t_ctid = xlrec->newtid;
}
if (samepage)
goto newsame;
HeapTupleHeaderSetXmaxInvalid(htup);
HeapTupleHeaderSetCmax(htup, FirstCommandId);
}
+ /* Make sure there is no forward chain link in t_ctid */
+ htup->t_ctid = xlrec->newtid;
offnum = PageAddItem(page, (Item) htup, newlen, offnum,
LP_USED | OverwritePageMode);