Blame SOURCES/postgresql-socket-dirs-pgupgrade.patch

ca36e9
Expect unix_socket_directories on RHEL's PostgreSQL 9.2
ca36e9
ca36e9
If REDHAT_PGUPGRADE_FROM_RHEL is defined, (Red Hat only versions of) pg_upgrade
ca36e9
are told to run the older server than 9.2 with unix_socket_directories instead
ca36e9
of unix_socket_directory.  By default, even 9.2 is called with
ca36e9
unix_socket_directory which breaks upgrade from RHSCL 9.2.
ca36e9
ca36e9
diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
ca36e9
index 3d041ef..a9c56e0 100644
ca36e9
--- a/src/bin/pg_upgrade/server.c
ca36e9
+++ b/src/bin/pg_upgrade/server.c
3789cb
@@ -191,6 +191,12 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
3789cb
 
3789cb
 	static bool exit_hook_registered = false;
ca36e9
 
ca36e9
+	/* By default set to what upstream uses */
ca36e9
+	int			rh_sock_dir_split = 903;
ca36e9
+	if (getenv("REDHAT_PGUPGRADE_FROM_RHEL")) {
ca36e9
+		rh_sock_dir_split = 902;
ca36e9
+	}
ca36e9
+
ca36e9
 	if (!exit_hook_registered)
ca36e9
 	{
ca36e9
 		atexit(stop_postmaster_atexit);
ca36e9
@@ -196,7 +202,7 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
ca36e9
 		snprintf(socket_string + strlen(socket_string),
ca36e9
 				 sizeof(socket_string) - strlen(socket_string),
ca36e9
 				 " -c %s='%s'",
ca36e9
-				 (GET_MAJOR_VERSION(cluster->major_version) < 903) ?
ca36e9
+				 (GET_MAJOR_VERSION(cluster->major_version) < rh_sock_dir_split) ?
ca36e9
 				 "unix_socket_directory" : "unix_socket_directories",
ca36e9
 				 cluster->sockdir);
ca36e9
 #endif