mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +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:
@@ -387,24 +387,22 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
|
||||
START_CRIT_SECTION();
|
||||
|
||||
if (RelationNeedsWAL(btree->index) && !btree->isBuild)
|
||||
{
|
||||
XLogBeginInsert();
|
||||
XLogRegisterBuffer(0, stack->buffer, REGBUF_STANDARD);
|
||||
if (BufferIsValid(childbuf))
|
||||
XLogRegisterBuffer(1, childbuf, REGBUF_STANDARD);
|
||||
}
|
||||
|
||||
/* Perform the page update, and register any extra WAL data */
|
||||
/*
|
||||
* Perform the page update, dirty and register stack->buffer, and
|
||||
* register any extra WAL data.
|
||||
*/
|
||||
btree->execPlaceToPage(btree, stack->buffer, stack,
|
||||
insertdata, updateblkno, ptp_workspace);
|
||||
|
||||
MarkBufferDirty(stack->buffer);
|
||||
|
||||
/* An insert to an internal page finishes the split of the child. */
|
||||
if (BufferIsValid(childbuf))
|
||||
{
|
||||
GinPageGetOpaque(childpage)->flags &= ~GIN_INCOMPLETE_SPLIT;
|
||||
MarkBufferDirty(childbuf);
|
||||
if (RelationNeedsWAL(btree->index) && !btree->isBuild)
|
||||
XLogRegisterBuffer(1, childbuf, REGBUF_STANDARD);
|
||||
}
|
||||
|
||||
if (RelationNeedsWAL(btree->index) && !btree->isBuild)
|
||||
|
||||
Reference in New Issue
Block a user