*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.71 2000/12/28 13:00:07 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.72 2000/12/29 20:47:16 vadim Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
+ START_CRIT_CODE;
+ _bt_pgaddtup(rel, page, itemsz, btitem, newitemoff, "page");
+ itup_off = newitemoff;
+ itup_blkno = BufferGetBlockNumber(buf);
/* XLOG stuff */
{
xl_btree_insert xlrec;
uint8 flag = XLOG_BTREE_INSERT;
XLogRecPtr recptr;
XLogRecData rdata[2];
+ BTItemData truncitem;
xlrec.target.node = rel->rd_node;
ItemPointerSet(&(xlrec.target.tid), BufferGetBlockNumber(buf), newitemoff);
/* Read comments in _bt_pgaddtup */
if (!(P_ISLEAF(lpageop)) && newitemoff == P_FIRSTDATAKEY(lpageop))
{
- BTItemData truncitem = *btitem;
-
+ truncitem = *btitem;
truncitem.bti_itup.t_info = sizeof(BTItemData);
rdata[1].data = (char*)&truncitem;
rdata[1].len = sizeof(BTItemData);
PageSetSUI(page, ThisStartUpID);
}
- _bt_pgaddtup(rel, page, itemsz, btitem, newitemoff, "page");
- itup_off = newitemoff;
- itup_blkno = BufferGetBlockNumber(buf);
+ END_CRIT_CODE;
/* Write out the updated page and release pin/lock */
_bt_wrtbuf(rel, buf);
}
oopaque;
Buffer sbuf = 0;
Page spage = 0;
- BTPageOpaque sopaque;
Size itemsz;
ItemId itemid;
BTItem item;
if (!P_RIGHTMOST(ropaque))
{
+ BTPageOpaque sopaque = (BTPageOpaque) PageGetSpecialPointer(spage);
+ sopaque->btpo_prev = BufferGetBlockNumber(rbuf);
+
rdata[2].next = &(rdata[3]);
rdata[3].buffer = sbuf;
rdata[3].data = NULL;
PageRestoreTempPage(leftpage, origpage);
+ /* write and release the old right sibling */
if (!P_RIGHTMOST(ropaque))
- {
- sopaque = (BTPageOpaque) PageGetSpecialPointer(spage);
- sopaque->btpo_prev = BufferGetBlockNumber(rbuf);
-
- /* write and release the old right sibling */
_bt_wrtbuf(rel, sbuf);
- }
END_CRIT_CODE;
/* split's done */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.44 2000/12/28 13:00:07 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.45 2000/12/29 20:47:17 vadim Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
buf = _bt_getbuf(rel, blkno, BT_WRITE);
page = BufferGetPage(buf);
- /* XLOG stuff */
START_CRIT_CODE;
+ PageIndexTupleDelete(page, offno);
+ /* XLOG stuff */
{
xl_btree_delete xlrec;
XLogRecPtr recptr;
PageSetLSN(page, recptr);
PageSetSUI(page, ThisStartUpID);
}
-
- PageIndexTupleDelete(page, offno);
END_CRIT_CODE;
/* write the buffer and release the lock */