multi-install PostgresNode fails with older postgres versions - Mailing list pgsql-hackers

From Mark Dilger
Subject multi-install PostgresNode fails with older postgres versions
Date
Msg-id 75F880E4-0645-44B7-A032-8431C51A98DC@enterprisedb.com
Whole thread Raw
Responses Re: multi-install PostgresNode fails with older postgres versions
Re: multi-install PostgresNode fails with older postgres versions
Re: multi-install PostgresNode fails with older postgres versions
List pgsql-hackers
Andrew,

While developing some cross version tests, I noticed that PostgresNode::init fails for postgres versions older than
9.3,like so: 

# Checking port 52814
# Found port 52814
Name: 9.2.24
Data directory:
/Users/mark.dilger/hydra/postgresnode.review/src/test/modules/test_cross_version/tmp_check/t_001_verify_paths_9.2.24_data/pgdata
Backup directory:
/Users/mark.dilger/hydra/postgresnode.review/src/test/modules/test_cross_version/tmp_check/t_001_verify_paths_9.2.24_data/backup
Archive directory:
/Users/mark.dilger/hydra/postgresnode.review/src/test/modules/test_cross_version/tmp_check/t_001_verify_paths_9.2.24_data/archives
Connection string: port=52814 host=/var/folders/6n/3f4vwbnn7fz5qk0xqhgbjrkw0000gp/T/L_A2w1x7qb
Log file:
/Users/mark.dilger/hydra/postgresnode.review/src/test/modules/test_cross_version/tmp_check/log/001_verify_paths_9.2.24.log
# Running: initdb -D
/Users/mark.dilger/hydra/postgresnode.review/src/test/modules/test_cross_version/tmp_check/t_001_verify_paths_9.2.24_data/pgdata
-Atrust -N 
initdb: invalid option -- N
Try "initdb --help" for more information.
Bail out!  system initdb failed

The problem is clear enough; -N/--nosync was added in 9.3, and PostgresNode::init is passing -N to initdb
unconditionally.I wonder if during PostgresNode::new a call should be made to pg_config and the version information
grep'dout so that version specific options to various functions (init, backup, etc) could hinge on the version of
postgresbeing used? 

You could also just remove the -N option, but that would slow down all tests for everybody, so I'm not keen to do that.
Or you could remove -N in cases where $node->{_install_path} is defined, which would be far more acceptable.  I'm
leaningtowards using the output of pg_config, though, since this problem is likely to come up again with other
options/commands.

Thoughts?

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Stronger safeguard for archive recovery not to miss data
Next
From: Maxim Orlov
Date:
Subject: Re: Failed assertion on standby while shutdown