]> granicus.if.org Git - postgresql/commitdiff
Make GIN's cleanup pending list process interruptable
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 7 Sep 2015 14:20:44 +0000 (17:20 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 7 Sep 2015 14:20:44 +0000 (17:20 +0300)
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>

src/backend/access/gin/ginfast.c

index 6629d3ccafc5e011f81259bd9e5f7075e53c16fe..0c2b19884f76004468c16d8c8ad7ba24da5688ce 100644 (file)
@@ -759,8 +759,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
                 */
                processPendingPage(&accum, &datums, page, FirstOffsetNumber);
 
-               if (vac_delay)
-                       vacuum_delay_point();
+               vacuum_delay_point();
 
                /*
                 * 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,
                        while ((list = ginGetEntry(&accum, &attnum, &entry, &nlist)) != NULL)
                        {
                                ginEntryInsert(index, ginstate, attnum, entry, list, nlist, FALSE);
-                               if (vac_delay)
-                                       vacuum_delay_point();
+                               vacuum_delay_point();
                        }
 
                        /*
@@ -877,7 +875,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
                /*
                 * Read next page in pending list
                 */
-               CHECK_FOR_INTERRUPTS();
+               vacuum_delay_point();
                buffer = ReadBuffer(index, blkno);
                LockBuffer(buffer, GIN_SHARE);
                page = BufferGetPage(buffer);