pg_upgrade needs postmaster [sic]

Started by Christoph Bergabout 11 years ago3 messages
#1Christoph Berg
cb@df7cb.de
1 attachment(s)

Hi,

I've played with trying to find out which minimal set of files I need
from the old version to make pg_upgrade work. Interestingly, this
includes the good old postmaster binary:

$ sudo -u postgres pgsql/bin/pg_upgrade -b /var/tmp/pgsql/bin/ -B /usr/lib/postgresql/9.5/bin/ -d /etc/postgresql/9.5/main -D /tmp/9.5/data
Finding the real data directory for the old cluster sh: 1: /var/tmp/pgsql/bin/postmaster: not found

Could not get data directory using "/var/tmp/pgsql/bin/postmaster" -D "/etc/postgresql/9.5/main" -C data_directory: No such file or directory
Failure, exiting

I think it should just use "postgres" there, patch attached. (If we
need to be compatible with postmaster-only PG versions from the last
century, it should try both names.)

Christoph
--
cb@df7cb.de | http://www.df7cb.de/

Attachments:

pg_upgrade_postmaster.patchtext/x-diff; charset=us-asciiDownload
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c
new file mode 100644
index cfc88ec..bd810cd
*** a/contrib/pg_upgrade/option.c
--- b/contrib/pg_upgrade/option.c
*************** adjust_data_dir(ClusterInfo *cluster)
*** 415,421 ****
  	 * so this might fail --- only works for PG 9.2+.   If this fails,
  	 * pg_upgrade will fail anyway because the data files will not be found.
  	 */
! 	snprintf(cmd, sizeof(cmd), "\"%s/postmaster\" -D \"%s\" -C data_directory",
  			 cluster->bindir, cluster->pgconfig);
  
  	if ((output = popen(cmd, "r")) == NULL ||
--- 415,421 ----
  	 * so this might fail --- only works for PG 9.2+.   If this fails,
  	 * pg_upgrade will fail anyway because the data files will not be found.
  	 */
! 	snprintf(cmd, sizeof(cmd), "\"%s/postgres\" -D \"%s\" -C data_directory",
  			 cluster->bindir, cluster->pgconfig);
  
  	if ((output = popen(cmd, "r")) == NULL ||
#2Bruce Momjian
bruce@momjian.us
In reply to: Christoph Berg (#1)
Re: pg_upgrade needs postmaster [sic]

On Mon, Dec 22, 2014 at 11:48:52PM +0100, Christoph Berg wrote:

Hi,

I've played with trying to find out which minimal set of files I need
from the old version to make pg_upgrade work. Interestingly, this
includes the good old postmaster binary:

$ sudo -u postgres pgsql/bin/pg_upgrade -b /var/tmp/pgsql/bin/ -B /usr/lib/postgresql/9.5/bin/ -d /etc/postgresql/9.5/main -D /tmp/9.5/data
Finding the real data directory for the old cluster sh: 1: /var/tmp/pgsql/bin/postmaster: not found

Could not get data directory using "/var/tmp/pgsql/bin/postmaster" -D "/etc/postgresql/9.5/main" -C data_directory: No such file or directory
Failure, exiting

I think it should just use "postgres" there, patch attached. (If we
need to be compatible with postmaster-only PG versions from the last
century, it should try both names.)

Yes, I think you are right. I see pg_ctl using the 'postgres' binary,
so pg_upgrade should do the same. I will apply this patch soon, and see
if there are any other 'postmaster' mentions that need updating.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#2)
Re: pg_upgrade needs postmaster [sic]

On Mon, Dec 22, 2014 at 06:18:35PM -0500, Bruce Momjian wrote:

On Mon, Dec 22, 2014 at 11:48:52PM +0100, Christoph Berg wrote:

Hi,

I've played with trying to find out which minimal set of files I need
from the old version to make pg_upgrade work. Interestingly, this
includes the good old postmaster binary:

$ sudo -u postgres pgsql/bin/pg_upgrade -b /var/tmp/pgsql/bin/ -B /usr/lib/postgresql/9.5/bin/ -d /etc/postgresql/9.5/main -D /tmp/9.5/data
Finding the real data directory for the old cluster sh: 1: /var/tmp/pgsql/bin/postmaster: not found

Could not get data directory using "/var/tmp/pgsql/bin/postmaster" -D "/etc/postgresql/9.5/main" -C data_directory: No such file or directory
Failure, exiting

I think it should just use "postgres" there, patch attached. (If we
need to be compatible with postmaster-only PG versions from the last
century, it should try both names.)

Yes, I think you are right. I see pg_ctl using the 'postgres' binary,
so pg_upgrade should do the same. I will apply this patch soon, and see
if there are any other 'postmaster' mentions that need updating.

Patch applied. Thanks.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers