summaryrefslogtreecommitdiff
path: root/src/backend/access/nbtree/nbtinsert.c
diff options
context:
space:
mode:
authorTom Lane2002-08-06 02:36:35 +0000
committerTom Lane2002-08-06 02:36:35 +0000
commit5df307c7782518c4a3c19ffd05c7cb591b97e23c (patch)
tree0ff988dc5b7b115e9f6bbf29852dd4bad7fcaeea /src/backend/access/nbtree/nbtinsert.c
parent35cd432b185938c33967c9fa48223ce33e1c66bd (diff)
Restructure local-buffer handling per recent pghackers discussion.
The local buffer manager is no longer used for newly-created relations (unless they are TEMP); a new non-TEMP relation goes through the shared bufmgr and thus will participate normally in checkpoints. But TEMP relations use the local buffer manager throughout their lifespan. Also, operations in TEMP relations are not logged in WAL, thus improving performance. Since it's no longer necessary to fsync relations as they move out of the local buffers into shared buffers, quite a lot of smgr.c/md.c/fd.c code is no longer needed and has been removed: there's no concept of a dirty relation anymore in md.c/fd.c, and we never fsync anything but WAL. Still TODO: improve local buffer management algorithms so that it would be reasonable to increase NLocBuffer.
Diffstat (limited to 'src/backend/access/nbtree/nbtinsert.c')
-rw-r--r--src/backend/access/nbtree/nbtinsert.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index c0190859b7b..16d63e03c99 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.94 2002/07/02 05:48:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.95 2002/08/06 02:36:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -623,8 +623,11 @@ _bt_insertuple(Relation rel, Buffer buf,
BTPageOpaque pageop = (BTPageOpaque) PageGetSpecialPointer(page);
START_CRIT_SECTION();
+
_bt_pgaddtup(rel, page, itemsz, btitem, newitemoff, "page");
+
/* XLOG stuff */
+ if (!rel->rd_istemp)
{
xl_btree_insert xlrec;
uint8 flag = XLOG_BTREE_INSERT;
@@ -866,6 +869,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
* NO ELOG(ERROR) till right sibling is updated.
*/
START_CRIT_SECTION();
+
+ /* XLOG stuff */
+ if (!rel->rd_istemp)
{
xl_btree_split xlrec;
int flag = (newitemonleft) ?
@@ -891,7 +897,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
BlockIdSet(&(xlrec.rightblk), ropaque->btpo_next);
/*
- * Dirrect access to page is not good but faster - we should
+ * Direct access to page is not good but faster - we should
* implement some new func in page API.
*/
xlrec.leftlen = ((PageHeader) leftpage)->pd_special -
@@ -1352,6 +1358,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
(metad->btm_level)++;
/* XLOG stuff */
+ if (!rel->rd_istemp)
{
xl_btree_newroot xlrec;
XLogRecPtr recptr;
@@ -1366,7 +1373,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
rdata[0].next = &(rdata[1]);
/*
- * Dirrect access to page is not good but faster - we should
+ * Direct access to page is not good but faster - we should
* implement some new func in page API.
*/
rdata[1].buffer = InvalidBuffer;
@@ -1388,6 +1395,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
PageSetLSN(rpage, recptr);
PageSetSUI(rpage, ThisStartUpID);
}
+
END_CRIT_SECTION();
/* write and let go of metapage buffer */