Skip to content

Commit 97a75ed

Browse files
sundongkim-devhackorum
authored andcommitted
Add vacuum_delay_point() to GiST empty-page deletion pass
gistvacuum_delete_empty_pages() rescans the index's internal pages to unlink the empty leaf pages found during the main vacuum scan. For each internal page it reads a buffer and may perform WAL-logged page deletions, but the loop never calls vacuum_delay_point(). This phase of a GiST vacuum therefore ignores the cost-based vacuum delay, unlike the other page-scanning loops in this file: gistvacuumscan() calls vacuum_delay_point() at the top of its per-page loop, and gistvacuumpage() calls it before re-reading a buffer when it recurses to an earlier page. Add vacuum_delay_point(false) at the top of the loop, where no buffer lock is held, matching the sibling idiom. vacuum_delay_point() also checks for interrupts, so this additionally lets the pass respond to query cancellation without having to wait for a buffer read to perform I/O. gistvacuum_delete_empty_pages() has lacked this since it was introduced in commit 7df159a.
1 parent 44056f6 commit 97a75ed

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/backend/access/gist/gistvacuum.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,9 @@ gistvacuum_delete_empty_pages(IndexVacuumInfo *info, GistVacState *vstate)
524524
int ntodelete;
525525
int deleted;
526526

527+
/* call vacuum_delay_point while not holding any buffer lock */
528+
vacuum_delay_point(false);
529+
527530
buffer = ReadBufferExtended(rel, MAIN_FORKNUM, (BlockNumber) blkno,
528531
RBM_NORMAL, info->strategy);
529532

0 commit comments

Comments
 (0)