mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
Assert that buffers are marked dirty before XLogRegisterBuffer().
Enforce the rule from transam/README in XLogRegisterBuffer(), and update callers to follow the rule. Hash indexes sometimes register clean pages as a part of the locking protocol, so provide a REGBUF_NO_CHANGE flag to support that use. Discussion: https://postgr.es/m/c84114f8-c7f1-5b57-f85a-3adc31e1a904@iki.fi Reviewed-by: Heikki Linnakangas
This commit is contained in:
@@ -721,9 +721,12 @@ dataExecPlaceToPageLeaf(GinBtree btree, Buffer buf, GinBtreeStack *stack,
|
||||
/* Apply changes to page */
|
||||
dataPlaceToPageLeafRecompress(buf, leaf);
|
||||
|
||||
MarkBufferDirty(buf);
|
||||
|
||||
/* If needed, register WAL data built by computeLeafRecompressWALData */
|
||||
if (RelationNeedsWAL(btree->index) && !btree->isBuild)
|
||||
{
|
||||
XLogRegisterBuffer(0, buf, REGBUF_STANDARD);
|
||||
XLogRegisterBufData(0, leaf->walinfo, leaf->walinfolen);
|
||||
}
|
||||
}
|
||||
@@ -1155,6 +1158,8 @@ dataExecPlaceToPageInternal(GinBtree btree, Buffer buf, GinBtreeStack *stack,
|
||||
pitem = (PostingItem *) insertdata;
|
||||
GinDataPageAddPostingItem(page, pitem, off);
|
||||
|
||||
MarkBufferDirty(buf);
|
||||
|
||||
if (RelationNeedsWAL(btree->index) && !btree->isBuild)
|
||||
{
|
||||
/*
|
||||
@@ -1167,6 +1172,7 @@ dataExecPlaceToPageInternal(GinBtree btree, Buffer buf, GinBtreeStack *stack,
|
||||
data.offset = off;
|
||||
data.newitem = *pitem;
|
||||
|
||||
XLogRegisterBuffer(0, buf, REGBUF_STANDARD);
|
||||
XLogRegisterBufData(0, (char *) &data,
|
||||
sizeof(ginxlogInsertDataInternal));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user