aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gin/gininsert.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2012-06-14 10:11:16 -0400
committerRobert Haas <rhaas@postgresql.org>2012-06-14 10:11:16 -0400
commit6cd015bea38b8a59feb84bf238a880a3b503cf5f (patch)
treebe1f8b3b82791166c9dd0fa448e1ef9080eb39b4 /src/backend/access/gin/gininsert.c
parenta475c6036752c26dca538632b68fd2cc592976b7 (diff)
downloadpostgresql-6cd015bea38b8a59feb84bf238a880a3b503cf5f.tar.gz
postgresql-6cd015bea38b8a59feb84bf238a880a3b503cf5f.zip
Add new function log_newpage_buffer.
When I implemented the ginbuildempty() function as part of implementing unlogged tables, I falsified the note in the header comment for log_newpage. Although we could fix that up by changing the comment, it seems cleaner to add a new function which is specifically intended to handle this case. So do that.
Diffstat (limited to 'src/backend/access/gin/gininsert.c')
-rw-r--r--src/backend/access/gin/gininsert.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index fe06bdcbfab..2f95f718e0b 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -520,20 +520,14 @@ ginbuildempty(PG_FUNCTION_ARGS)
ReadBufferExtended(index, INIT_FORKNUM, P_NEW, RBM_NORMAL, NULL);
LockBuffer(RootBuffer, BUFFER_LOCK_EXCLUSIVE);
- /* Initialize both pages, mark them dirty, unlock and release buffer. */
+ /* Initialize and xlog metabuffer and root buffer. */
START_CRIT_SECTION();
GinInitMetabuffer(MetaBuffer);
MarkBufferDirty(MetaBuffer);
+ log_newpage_buffer(MetaBuffer);
GinInitBuffer(RootBuffer, GIN_LEAF);
MarkBufferDirty(RootBuffer);
-
- /* XLOG the new pages */
- log_newpage(&index->rd_smgr->smgr_rnode.node, INIT_FORKNUM,
- BufferGetBlockNumber(MetaBuffer),
- BufferGetPage(MetaBuffer));
- log_newpage(&index->rd_smgr->smgr_rnode.node, INIT_FORKNUM,
- BufferGetBlockNumber(RootBuffer),
- BufferGetPage(RootBuffer));
+ log_newpage_buffer(RootBuffer);
END_CRIT_SECTION();
/* Unlock and release the buffers. */