Skip to content

Commit a7496ae

Browse files
committed
Make GIN's cleanup pending list process interruptable
Cleanup process could be called by ordinary insert/update and could take a lot of time. Add vacuum_delay_point() to make this process interruptable. Under vacuum this call will also throttle a vacuum process to decrease system load, called from insert/update it will not throttle, and that reduces a latency. Backpatch for all supported branches. Jeff Janes <jeff.janes@gmail.com>
1 parent fad42aa commit a7496ae

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/backend/access/gin/ginfast.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
759759
*/
760760
processPendingPage(&accum, &datums, page, FirstOffsetNumber);
761761

762-
if (vac_delay)
763-
vacuum_delay_point();
762+
vacuum_delay_point();
764763

765764
/*
766765
* Is it time to flush memory to disk? Flush if we are at the end of
@@ -797,8 +796,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
797796
while ((list = ginGetEntry(&accum, &attnum, &entry, &nlist)) != NULL)
798797
{
799798
ginEntryInsert(index, ginstate, attnum, entry, list, nlist, FALSE);
800-
if (vac_delay)
801-
vacuum_delay_point();
799+
vacuum_delay_point();
802800
}
803801

804802
/*
@@ -877,7 +875,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
877875
/*
878876
* Read next page in pending list
879877
*/
880-
CHECK_FOR_INTERRUPTS();
878+
vacuum_delay_point();
881879
buffer = ReadBuffer(index, blkno);
882880
LockBuffer(buffer, GIN_SHARE);
883881
page = BufferGetPage(buffer);

0 commit comments

Comments
 (0)