Skip to content

Commit e266922

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 e956808 commit e266922

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
@@ -810,8 +810,7 @@ ginInsertCleanup(GinState *ginstate,
810810
*/
811811
processPendingPage(&accum, &datums, page, FirstOffsetNumber);
812812

813-
if (vac_delay)
814-
vacuum_delay_point();
813+
vacuum_delay_point();
815814

816815
/*
817816
* Is it time to flush memory to disk? Flush if we are at the end of
@@ -851,8 +850,7 @@ ginInsertCleanup(GinState *ginstate,
851850
{
852851
ginEntryInsert(ginstate, attnum, key, category,
853852
list, nlist, NULL);
854-
if (vac_delay)
855-
vacuum_delay_point();
853+
vacuum_delay_point();
856854
}
857855

858856
/*
@@ -937,7 +935,7 @@ ginInsertCleanup(GinState *ginstate,
937935
/*
938936
* Read next page in pending list
939937
*/
940-
CHECK_FOR_INTERRUPTS();
938+
vacuum_delay_point();
941939
buffer = ReadBuffer(index, blkno);
942940
LockBuffer(buffer, GIN_SHARE);
943941
page = BufferGetPage(buffer);

0 commit comments

Comments
 (0)