mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Remove dependency on HeapTuple from predicate locking functions.
The following changes make the predicate locking functions more generic and suitable for use by future access methods: - PredicateLockTuple() is renamed to PredicateLockTID(). It takes ItemPointer and inserting transaction ID instead of HeapTuple. - CheckForSerializableConflictIn() takes blocknum instead of buffer. - CheckForSerializableConflictOut() no longer takes HeapTuple or buffer. Author: Ashwin Agrawal Reviewed-by: Andres Freund, Kuntal Ghosh, Thomas Munro Discussion: https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com
This commit is contained in:
@ -89,7 +89,7 @@ ginFindLeafPage(GinBtree btree, bool searchMode,
|
||||
stack->predictNumber = 1;
|
||||
|
||||
if (rootConflictCheck)
|
||||
CheckForSerializableConflictIn(btree->index, NULL, stack->buffer);
|
||||
CheckForSerializableConflictIn(btree->index, NULL, btree->rootBlkno);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -246,7 +246,7 @@ ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector)
|
||||
* tree, so it conflicts with all serializable scans. All scans acquire a
|
||||
* predicate lock on the metabuffer to represent that.
|
||||
*/
|
||||
CheckForSerializableConflictIn(index, NULL, metabuffer);
|
||||
CheckForSerializableConflictIn(index, NULL, GIN_METAPAGE_BLKNO);
|
||||
|
||||
if (collector->sumsize + collector->ntuples * sizeof(ItemIdData) > GinListPageSize)
|
||||
{
|
||||
|
@ -216,7 +216,8 @@ ginEntryInsert(GinState *ginstate,
|
||||
return;
|
||||
}
|
||||
|
||||
CheckForSerializableConflictIn(ginstate->index, NULL, stack->buffer);
|
||||
CheckForSerializableConflictIn(ginstate->index, NULL,
|
||||
BufferGetBlockNumber(stack->buffer));
|
||||
/* modify an existing leaf entry */
|
||||
itup = addItemPointersToLeafTuple(ginstate, itup,
|
||||
items, nitem, buildStats, stack->buffer);
|
||||
@ -225,7 +226,8 @@ ginEntryInsert(GinState *ginstate,
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckForSerializableConflictIn(ginstate->index, NULL, stack->buffer);
|
||||
CheckForSerializableConflictIn(ginstate->index, NULL,
|
||||
BufferGetBlockNumber(stack->buffer));
|
||||
/* no match, so construct a new leaf entry */
|
||||
itup = buildFreshLeafTuple(ginstate, attnum, key, category,
|
||||
items, nitem, buildStats, stack->buffer);
|
||||
|
Reference in New Issue
Block a user