diff options
author | Tom Lane | 2004-06-02 17:28:18 +0000 |
---|---|---|
committer | Tom Lane | 2004-06-02 17:28:18 +0000 |
commit | 2095206de13b3fc9643cac7eef8c0f51b56cb556 (patch) | |
tree | a5347eda127bfbb2497de1d74f26663b89f20d67 /src/include | |
parent | 4d0e47d5a9482651007f946228381d3fa0141181 (diff) |
Adjust btree index build to not use shared buffers, thereby avoiding the
locking conflict against concurrent CHECKPOINT that was discussed a few
weeks ago. Also, if not using WAL archiving (which is always true ATM
but won't be if PITR makes it into this release), there's no need to
WAL-log the index build process; it's sufficient to force-fsync the
completed index before commit. This seems to gain about a factor of 2
in my tests, which is consistent with writing half as much data. I did
not try it with WAL on a separate drive though --- probably the gain would
be a lot less in that scenario.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/nbtree.h | 10 | ||||
-rw-r--r-- | src/include/storage/smgr.h | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index bf64b70ebcf..e8e4c46a820 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.77 2004/04/21 18:24:26 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/nbtree.h,v 1.78 2004/06/02 17:28:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -198,7 +198,6 @@ typedef BTItemData *BTItem; #define XLOG_BTREE_NEWROOT 0xA0 /* new root page */ #define XLOG_BTREE_NEWMETA 0xB0 /* update metadata page */ #define XLOG_BTREE_NEWPAGE 0xC0 /* new index page during build */ -#define XLOG_BTREE_INVALIDMETA 0xD0 /* new metadata, temp. invalid */ /* * All that we need to find changed index tuple @@ -315,8 +314,7 @@ typedef struct xl_btree_newroot /* * New metapage log record. This is not issued during routine operations; - * it's only used when initializing an empty index and at completion of - * index build. + * it's only used when initializing an empty index. */ typedef struct xl_btree_newmeta { @@ -442,7 +440,8 @@ extern void _bt_insert_parent(Relation rel, Buffer buf, Buffer rbuf, /* * prototypes for functions in nbtpage.c */ -extern void _bt_metapinit(Relation rel, bool markvalid); +extern void _bt_metapinit(Relation rel); +extern void _bt_initmetapage(Page page, BlockNumber rootbknum, uint32 level); extern Buffer _bt_getroot(Relation rel, int access); extern Buffer _bt_gettrueroot(Relation rel); extern Buffer _bt_getbuf(Relation rel, BlockNumber blkno, int access); @@ -453,7 +452,6 @@ extern void _bt_wrtbuf(Relation rel, Buffer buf); extern void _bt_wrtnorelbuf(Relation rel, Buffer buf); extern void _bt_pageinit(Page page, Size size); extern bool _bt_page_recyclable(Page page); -extern void _bt_metaproot(Relation rel, BlockNumber rootbknum, uint32 level); extern void _bt_delitems(Relation rel, Buffer buf, OffsetNumber *itemnos, int nitems); extern int _bt_pagedel(Relation rel, Buffer buf, bool vacuum_full); diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index 6999635dc46..52040432dcc 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.43 2004/05/31 20:31:33 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/smgr.h,v 1.44 2004/06/02 17:28:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -63,6 +63,7 @@ extern void smgrwrite(SMgrRelation reln, BlockNumber blocknum, char *buffer, extern BlockNumber smgrnblocks(SMgrRelation reln); extern BlockNumber smgrtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp); +extern void smgrimmedsync(SMgrRelation reln); extern void smgrDoPendingDeletes(bool isCommit); extern int smgrGetPendingDeletes(bool forCommit, RelFileNode **ptr); extern void smgrcommit(void); @@ -89,6 +90,7 @@ extern bool mdwrite(SMgrRelation reln, BlockNumber blocknum, char *buffer, extern BlockNumber mdnblocks(SMgrRelation reln); extern BlockNumber mdtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp); +extern bool mdimmedsync(SMgrRelation reln); extern bool mdsync(void); extern void RememberFsyncRequest(RelFileNode rnode, BlockNumber segno); |