Skip to content

Commit d592a87

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 552723a commit d592a87

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/backend/access/gin/ginfast.c

+3-5
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,7 @@ ginInsertCleanup(GinState *ginstate,
801801
*/
802802
processPendingPage(&accum, &datums, page, FirstOffsetNumber);
803803

804-
if (vac_delay)
805-
vacuum_delay_point();
804+
vacuum_delay_point();
806805

807806
/*
808807
* Is it time to flush memory to disk? Flush if we are at the end of
@@ -842,8 +841,7 @@ ginInsertCleanup(GinState *ginstate,
842841
{
843842
ginEntryInsert(ginstate, attnum, key, category,
844843
list, nlist, NULL);
845-
if (vac_delay)
846-
vacuum_delay_point();
844+
vacuum_delay_point();
847845
}
848846

849847
/*
@@ -923,7 +921,7 @@ ginInsertCleanup(GinState *ginstate,
923921
/*
924922
* Read next page in pending list
925923
*/
926-
CHECK_FOR_INTERRUPTS();
924+
vacuum_delay_point();
927925
buffer = ReadBuffer(index, blkno);
928926
LockBuffer(buffer, GIN_SHARE);
929927
page = BufferGetPage(buffer);

0 commit comments

Comments
 (0)