From 9db64cee156192cd44dc437b001170c640f691f4 Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Thu, 30 Sep 2021 12:16:14 -0400
Subject: [PATCH v2 2/2] Quick testing hack.

---
 src/backend/postmaster/autovacuum.c | 22 +++++++++++++++++++---
 src/include/utils/timeout.h         |  1 +
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 96332320a7..84aa4905b6 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -429,6 +429,14 @@ StartAutoVacLauncher(void)
 	return 0;
 }
 
+static volatile sig_atomic_t bogus_flag = false;
+
+static void
+bogus_handler(void)
+{
+	bogus_flag = true;
+}
+
 /*
  * Main loop for the autovacuum launcher process.
  */
@@ -442,9 +450,6 @@ AutoVacLauncherMain(int argc, char *argv[])
 	MyBackendType = B_AUTOVAC_LAUNCHER;
 	init_ps_display(NULL);
 
-	ereport(DEBUG1,
-			(errmsg_internal("autovacuum launcher started")));
-
 	if (PostAuthDelay)
 		pg_usleep(PostAuthDelay * 1000000L);
 
@@ -461,6 +466,11 @@ AutoVacLauncherMain(int argc, char *argv[])
 	/* SIGQUIT handler was already set up by InitPostmasterChild */
 
 	InitializeTimeouts();		/* establishes SIGALRM handler */
+	RegisterTimeout(BOGUS_TEST_TIMEOUT, bogus_handler);
+	enable_timeout_every(BOGUS_TEST_TIMEOUT, GetCurrentTimestamp(), 3000);
+
+	ereport(DEBUG1,
+			(errmsg_internal("autovacuum launcher started")));
 
 	pqsignal(SIGPIPE, SIG_IGN);
 	pqsignal(SIGUSR1, procsignal_sigusr1_handler);
@@ -810,6 +820,12 @@ AutoVacLauncherMain(int argc, char *argv[])
 static void
 HandleAutoVacLauncherInterrupts(void)
 {
+	if (bogus_flag)
+	{
+		bogus_flag = false;
+		elog(LOG, "bogus log message");
+	}
+
 	/* the normal shutdown case */
 	if (ShutdownRequestPending)
 		AutoVacLauncherShutdown();
diff --git a/src/include/utils/timeout.h b/src/include/utils/timeout.h
index 1b13ac96e0..3ada5154ca 100644
--- a/src/include/utils/timeout.h
+++ b/src/include/utils/timeout.h
@@ -33,6 +33,7 @@ typedef enum TimeoutId
 	IDLE_IN_TRANSACTION_SESSION_TIMEOUT,
 	IDLE_SESSION_TIMEOUT,
 	CLIENT_CONNECTION_CHECK_TIMEOUT,
+	BOGUS_TEST_TIMEOUT,
 	/* First user-definable timeout reason */
 	USER_TIMEOUT,
 	/* Maximum number of timeout reasons */
-- 
2.24.3 (Apple Git-128)

