mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix bundle bugs of GIN:
- Fix possible deadlock between UPDATE and VACUUM queries. Bug never was observed in 8.2, but it still exist there. HEAD is more sensitive to bug after recent "ring" of buffer improvements. - Fix WAL creation: if parent page is stored as is after split then incomplete split isn't removed during replay. This happens rather rare, only on large tables with a lot of updates/inserts. - Fix WAL replay: there was wrong test of XLR_BKP_BLOCK_* for left page after deletion of page. That causes wrong rightlink field: it pointed to deleted page. - add checking of match of clearing incomplete split - cleanup incomplete split list after proceeding All of this chages doesn't change on-disk storage, so backpatch... But second point may be an issue for replaying logs from previous version.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.6 2007/01/05 22:19:21 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.7 2007/06/04 15:56:28 teodor Exp $
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -354,6 +354,7 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
|
||||
static XLogRecData rdata[3];
|
||||
OffsetNumber placed;
|
||||
static ginxlogInsert data;
|
||||
int cnt=0;
|
||||
|
||||
*prdata = rdata;
|
||||
data.updateBlkno = entryPreparePage(btree, page, off);
|
||||
@ -371,21 +372,33 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
|
||||
data.isData = false;
|
||||
data.isLeaf = GinPageIsLeaf(page) ? TRUE : FALSE;
|
||||
|
||||
rdata[0].buffer = buf;
|
||||
rdata[0].buffer_std = TRUE;
|
||||
rdata[0].data = NULL;
|
||||
rdata[0].len = 0;
|
||||
rdata[0].next = &rdata[1];
|
||||
/*
|
||||
* Prevent full page write if child's split occurs. That is needed
|
||||
* to remove incomplete splits while replaying WAL
|
||||
*
|
||||
* data.updateBlkno contains new block number (of newly created right page)
|
||||
* for recently splited page.
|
||||
*/
|
||||
if ( data.updateBlkno == InvalidBlockNumber )
|
||||
{
|
||||
rdata[0].buffer = buf;
|
||||
rdata[0].buffer_std = TRUE;
|
||||
rdata[0].data = NULL;
|
||||
rdata[0].len = 0;
|
||||
rdata[0].next = &rdata[1];
|
||||
cnt++;
|
||||
}
|
||||
|
||||
rdata[1].buffer = InvalidBuffer;
|
||||
rdata[1].data = (char *) &data;
|
||||
rdata[1].len = sizeof(ginxlogInsert);
|
||||
rdata[1].next = &rdata[2];
|
||||
rdata[cnt].buffer = InvalidBuffer;
|
||||
rdata[cnt].data = (char *) &data;
|
||||
rdata[cnt].len = sizeof(ginxlogInsert);
|
||||
rdata[cnt].next = &rdata[cnt+1];
|
||||
cnt++;
|
||||
|
||||
rdata[2].buffer = InvalidBuffer;
|
||||
rdata[2].data = (char *) btree->entry;
|
||||
rdata[2].len = IndexTupleSize(btree->entry);
|
||||
rdata[2].next = NULL;
|
||||
rdata[cnt].buffer = InvalidBuffer;
|
||||
rdata[cnt].data = (char *) btree->entry;
|
||||
rdata[cnt].len = IndexTupleSize(btree->entry);
|
||||
rdata[cnt].next = NULL;
|
||||
|
||||
btree->entry = NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user