mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Move call of MarkBufferDirty() before XLogInsert() as required.
Many thanks to Heikki Linnakangas <heikki@enterprisedb.com> for his sharp eyes.
This commit is contained in:
parent
07bd1db152
commit
5e87f49a4c
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/ginbtree.c,v 1.6 2006/11/12 06:55:53 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/ginbtree.c,v 1.6.2.1 2007/06/05 12:48:21 teodor Exp $
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -294,6 +294,8 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
|
||||
START_CRIT_SECTION();
|
||||
btree->placeToPage(btree, stack->buffer, stack->off, &rdata);
|
||||
|
||||
MarkBufferDirty(stack->buffer);
|
||||
|
||||
if (!btree->index->rd_istemp)
|
||||
{
|
||||
XLogRecPtr recptr;
|
||||
@ -303,7 +305,6 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
|
||||
PageSetTLI(page, ThisTimeLineID);
|
||||
}
|
||||
|
||||
MarkBufferDirty(stack->buffer);
|
||||
UnlockReleaseBuffer(stack->buffer);
|
||||
END_CRIT_SECTION();
|
||||
|
||||
@ -351,6 +352,11 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
|
||||
GinInitBuffer(stack->buffer, GinPageGetOpaque(newlpage)->flags & ~GIN_LEAF);
|
||||
PageRestoreTempPage(newlpage, lpage);
|
||||
btree->fillRoot(btree, stack->buffer, lbuffer, rbuffer);
|
||||
|
||||
MarkBufferDirty(rbuffer);
|
||||
MarkBufferDirty(lbuffer);
|
||||
MarkBufferDirty(stack->buffer);
|
||||
|
||||
if (!btree->index->rd_istemp)
|
||||
{
|
||||
XLogRecPtr recptr;
|
||||
@ -364,11 +370,8 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
|
||||
PageSetTLI(rpage, ThisTimeLineID);
|
||||
}
|
||||
|
||||
MarkBufferDirty(rbuffer);
|
||||
UnlockReleaseBuffer(rbuffer);
|
||||
MarkBufferDirty(lbuffer);
|
||||
UnlockReleaseBuffer(lbuffer);
|
||||
MarkBufferDirty(stack->buffer);
|
||||
UnlockReleaseBuffer(stack->buffer);
|
||||
|
||||
END_CRIT_SECTION();
|
||||
@ -389,6 +392,10 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
|
||||
|
||||
START_CRIT_SECTION();
|
||||
PageRestoreTempPage(newlpage, lpage);
|
||||
|
||||
MarkBufferDirty(rbuffer);
|
||||
MarkBufferDirty(stack->buffer);
|
||||
|
||||
if (!btree->index->rd_istemp)
|
||||
{
|
||||
XLogRecPtr recptr;
|
||||
@ -399,9 +406,7 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
|
||||
PageSetLSN(rpage, recptr);
|
||||
PageSetTLI(rpage, ThisTimeLineID);
|
||||
}
|
||||
MarkBufferDirty(rbuffer);
|
||||
UnlockReleaseBuffer(rbuffer);
|
||||
MarkBufferDirty(stack->buffer);
|
||||
END_CRIT_SECTION();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.5 2006/10/04 00:29:47 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.5.2.1 2007/06/05 12:48:21 teodor Exp $
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -48,6 +48,8 @@ createPostingTree(Relation index, ItemPointerData *items, uint32 nitems)
|
||||
memcpy(GinDataPageGetData(page), items, sizeof(ItemPointerData) * nitems);
|
||||
GinPageGetOpaque(page)->maxoff = nitems;
|
||||
|
||||
MarkBufferDirty(buffer);
|
||||
|
||||
if (!index->rd_istemp)
|
||||
{
|
||||
XLogRecPtr recptr;
|
||||
@ -76,7 +78,6 @@ createPostingTree(Relation index, ItemPointerData *items, uint32 nitems)
|
||||
|
||||
}
|
||||
|
||||
MarkBufferDirty(buffer);
|
||||
UnlockReleaseBuffer(buffer);
|
||||
|
||||
END_CRIT_SECTION();
|
||||
@ -281,6 +282,8 @@ ginbuild(PG_FUNCTION_ARGS)
|
||||
buffer = GinNewBuffer(index);
|
||||
START_CRIT_SECTION();
|
||||
GinInitBuffer(buffer, GIN_LEAF);
|
||||
MarkBufferDirty(buffer);
|
||||
|
||||
if (!index->rd_istemp)
|
||||
{
|
||||
XLogRecPtr recptr;
|
||||
@ -301,7 +304,6 @@ ginbuild(PG_FUNCTION_ARGS)
|
||||
|
||||
}
|
||||
|
||||
MarkBufferDirty(buffer);
|
||||
UnlockReleaseBuffer(buffer);
|
||||
END_CRIT_SECTION();
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.9.2.1 2007/06/04 15:59:19 teodor Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.9.2.2 2007/06/05 12:48:21 teodor Exp $
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@ -190,9 +190,9 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
|
||||
pfree(cleaned);
|
||||
GinPageGetOpaque(page)->maxoff = newMaxOff;
|
||||
|
||||
MarkBufferDirty(buffer);
|
||||
xlogVacuumPage(gvs->index, buffer);
|
||||
|
||||
MarkBufferDirty(buffer);
|
||||
END_CRIT_SECTION();
|
||||
|
||||
/* if root is a leaf page, we don't desire further processing */
|
||||
@ -280,6 +280,11 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
|
||||
*/
|
||||
GinPageGetOpaque(page)->flags = GIN_DELETED;
|
||||
|
||||
MarkBufferDirty(pBuffer);
|
||||
if (leftBlkno != InvalidBlockNumber)
|
||||
MarkBufferDirty(lBuffer);
|
||||
MarkBufferDirty(dBuffer);
|
||||
|
||||
if (!gvs->index->rd_istemp)
|
||||
{
|
||||
XLogRecPtr recptr;
|
||||
@ -337,18 +342,13 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
|
||||
}
|
||||
}
|
||||
|
||||
MarkBufferDirty(pBuffer);
|
||||
if (!isParentRoot)
|
||||
LockBuffer(pBuffer, GIN_UNLOCK);
|
||||
ReleaseBuffer(pBuffer);
|
||||
|
||||
if (leftBlkno != InvalidBlockNumber)
|
||||
{
|
||||
MarkBufferDirty(lBuffer);
|
||||
UnlockReleaseBuffer(lBuffer);
|
||||
}
|
||||
|
||||
MarkBufferDirty(dBuffer);
|
||||
UnlockReleaseBuffer(dBuffer);
|
||||
|
||||
END_CRIT_SECTION();
|
||||
@ -633,8 +633,8 @@ ginbulkdelete(PG_FUNCTION_ARGS)
|
||||
{
|
||||
START_CRIT_SECTION();
|
||||
PageRestoreTempPage(resPage, page);
|
||||
xlogVacuumPage(gvs.index, buffer);
|
||||
MarkBufferDirty(buffer);
|
||||
xlogVacuumPage(gvs.index, buffer);
|
||||
UnlockReleaseBuffer(buffer);
|
||||
END_CRIT_SECTION();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user