diff options
-rw-r--r-- | doc/src/sgml/monitoring.sgml | 5 | ||||
-rw-r--r-- | src/backend/access/heap/vacuumlazy.c | 6 | ||||
-rw-r--r-- | src/backend/utils/activity/wait_event.c | 3 | ||||
-rw-r--r-- | src/include/utils/wait_event.h | 3 |
4 files changed, 15 insertions, 2 deletions
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 07a042254f9..643e1ad49fd 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -2242,6 +2242,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser <entry><literal>VacuumDelay</literal></entry> <entry>Waiting in a cost-based vacuum delay point.</entry> </row> + <row> + <entry><literal>VacuumTruncate</literal></entry> + <entry>Waiting to acquire an exclusive lock to truncate off any + empty pages at the end of a table vacuumed.</entry> + </row> </tbody> </tgroup> </table> diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 44f198398c1..2c04b69221f 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -3236,7 +3236,11 @@ lazy_truncate_heap(LVRelState *vacrel) return; } - pg_usleep(VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL * 1000L); + (void) WaitLatch(MyLatch, + WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH, + VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL, + WAIT_EVENT_VACUUM_TRUNCATE); + ResetLatch(MyLatch); } /* diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c index 6baf67740c7..ef7e6bfb779 100644 --- a/src/backend/utils/activity/wait_event.c +++ b/src/backend/utils/activity/wait_event.c @@ -485,6 +485,9 @@ pgstat_get_wait_timeout(WaitEventTimeout w) case WAIT_EVENT_VACUUM_DELAY: event_name = "VacuumDelay"; break; + case WAIT_EVENT_VACUUM_TRUNCATE: + event_name = "VacuumTruncate"; + break; /* no default case, so that compiler will warn */ } diff --git a/src/include/utils/wait_event.h b/src/include/utils/wait_event.h index 6c6ec2e7118..6007827b445 100644 --- a/src/include/utils/wait_event.h +++ b/src/include/utils/wait_event.h @@ -140,7 +140,8 @@ typedef enum WAIT_EVENT_PG_SLEEP, WAIT_EVENT_RECOVERY_APPLY_DELAY, WAIT_EVENT_RECOVERY_RETRIEVE_RETRY_INTERVAL, - WAIT_EVENT_VACUUM_DELAY + WAIT_EVENT_VACUUM_DELAY, + WAIT_EVENT_VACUUM_TRUNCATE } WaitEventTimeout; /* ---------- |