1-timeout-framework-v14-fix.patch

text/x-patch

Filename: 1-timeout-framework-v14-fix.patch
Type: text/x-patch
Part: 0
Message: Re: [PATCH] lock_timeout and common SIGALRM framework

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
Series: patch v14
File+
src/backend/main/main.c 1 1
src/backend/postmaster/postmaster.c 1 1
src/backend/tcop/postgres.c 5 2
src/include/tcop/tcopprot.h 1 1
diff -durpN postgresql.14.orig/src/backend/main/main.c postgresql.14/src/backend/main/main.c
--- postgresql.14.orig/src/backend/main/main.c	2012-06-26 09:10:21.272759354 +0200
+++ postgresql.14/src/backend/main/main.c	2012-07-04 12:21:58.869037014 +0200
@@ -192,7 +192,7 @@ main(int argc, char *argv[])
 	else if (argc > 1 && strcmp(argv[1], "--describe-config") == 0)
 		GucInfoMain();			/* does not return */
 	else if (argc > 1 && strcmp(argv[1], "--single") == 0)
-		PostgresMain(argc, argv, get_current_username(progname)); /* does not return */
+		PostgresMain(argc, argv, get_current_username(progname), true); /* does not return */
 	else
 		PostmasterMain(argc, argv); /* does not return */
 	abort();						/* should not get here */
diff -durpN postgresql.14.orig/src/backend/postmaster/postmaster.c postgresql.14/src/backend/postmaster/postmaster.c
--- postgresql.14.orig/src/backend/postmaster/postmaster.c	2012-07-04 12:25:09.247183727 +0200
+++ postgresql.14/src/backend/postmaster/postmaster.c	2012-07-04 12:23:22.933543240 +0200
@@ -3626,7 +3626,7 @@ BackendRun(Port *port)
 	 */
 	MemoryContextSwitchTo(TopMemoryContext);
 
-	PostgresMain(ac, av, port->user_name);
+	PostgresMain(ac, av, port->user_name, false);
 }
 
 
diff -durpN postgresql.14.orig/src/backend/tcop/postgres.c postgresql.14/src/backend/tcop/postgres.c
--- postgresql.14.orig/src/backend/tcop/postgres.c	2012-07-04 12:25:09.255183775 +0200
+++ postgresql.14/src/backend/tcop/postgres.c	2012-07-04 12:24:17.685873058 +0200
@@ -3509,7 +3509,7 @@ process_postgres_switches(int argc, char
  * ----------------------------------------------------------------
  */
 void
-PostgresMain(int argc, char *argv[], const char *username)
+PostgresMain(int argc, char *argv[], const char *username, bool single_user)
 {
 	const char *dbname;
 	int			firstchar;
@@ -3603,8 +3603,11 @@ PostgresMain(int argc, char *argv[], con
 	{
 		/*
 		 * Register timeout sources needed by backend operation.  Note
-		 * that InitializeTimeout was already called by BackendInitialize.
+		 * that InitializeTimeout was already called by BackendInitialize
+		 * unless we are in --single mode.
 		 */
+		if (single_user)
+			InitializeTimeouts();
 		RegisterTimeout(DEADLOCK_TIMEOUT, true,
 						CheckDeadLock, GetCurrentTimestamp);
 		RegisterTimeout(STATEMENT_TIMEOUT, false,
diff -durpN postgresql.14.orig/src/include/tcop/tcopprot.h postgresql.14/src/include/tcop/tcopprot.h
--- postgresql.14.orig/src/include/tcop/tcopprot.h	2012-06-26 09:10:21.316759721 +0200
+++ postgresql.14/src/include/tcop/tcopprot.h	2012-07-04 12:21:42.732939868 +0200
@@ -70,7 +70,7 @@ extern void prepare_for_client_read(void
 extern void client_read_ended(void);
 extern const char *process_postgres_switches(int argc, char *argv[],
 						  GucContext ctx);
-extern void PostgresMain(int argc, char *argv[], const char *username) __attribute__((noreturn));
+extern void PostgresMain(int argc, char *argv[], const char *username, bool single_user) __attribute__((noreturn));
 extern long get_stack_depth_rlimit(void);
 extern void ResetUsage(void);
 extern void ShowUsage(const char *title);
Binary files postgresql.14.orig/src/test/regress/core.29872 and postgresql.14/src/test/regress/core.29872 differ