Re: multi-install PostgresNode fails with older postgres versions

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: multi-install PostgresNode fails with older postgres versions
Date: 2021-04-03 18:01:10
Message-ID: ab0fa423-b904-2eb1-8c13-4423b2332e9f@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 3/31/21 10:28 PM, Mark Dilger wrote:
>
>> On Mar 31, 2021, at 1:07 PM, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> wrote:
>>
>>
>>
>>> On Mar 31, 2021, at 1:05 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>>
>>>
>>> On 3/31/21 3:48 PM, Alvaro Herrera wrote:
>>>> On 2021-Mar-31, Mark Dilger wrote:
>>>>
>>>>> PostgresNode::start() doesn't work for servers older than version 10,
>>>>> either. If I hack that function to sleep until the postmaster.pid
>>>>> file exists, it works, but that is really ugly and is just to prove to
>>>>> myself that it is a timing issue. There were a few commits in the
>>>>> version 10 development cycle (cf, commit
>>>>> f13ea95f9e473a43ee4e1baeb94daaf83535d37c) which changed how pg_ctl
>>>>> works, though I haven't figured out yet exactly what the interaction
>>>>> with PostgresNode would be. I'll keep looking.
>>>> Do you need to do "pg_ctl -w" perhaps?
>>>
>>>
>>> Probably. The buildfarm does this unconditionally and has done for a
>>> very long time, so maybe we don't need a version test for it.
>> I put a version test for this and it works for me. I guess you could do it unconditionally, if you want, but the condition is just:
>>
>> - TestLib::system_or_bail('pg_ctl', '-D', $pgdata, '-l', $logfile,
>> + TestLib::system_or_bail('pg_ctl',
>> + $self->older_than_version('10') ? '-w' : (),
>> + '-D', $pgdata, '-l', $logfile,
>> 'restart');
> I have needed to do a number of these version checks to get PostgresNode working across a variety of versions. Attached is a WIP patch set with those changes, and with a framework that exercises PostgresNode and can be extended to check other things. For now, it just checks that init(), start(), safe_psql(), and teardown_node() work.
>
> With the existing changes to PostgresNode in 0001, the framework in 0002 works for server versions back to 9.3. Versions 9.1 and 9.2 fail on the safe_psql(), and I haven't dug into that far enough yet to explain why. Versions 8.4 and 9.0 fail on the start(). I had trouble getting versions of postgres older than 8.4 to compile on my laptop. I haven't dug far enough into that yet, either.
>
> To get this running, you need to install the versions you care about and edit src/test/modules/test_cross_version/version.dat with the names and locations of those installations. (I committed the patch with my local settings, so you can easily compare and edit.) That should get you to the point where you can run 'make check' in the test_cross_version directory.

I've had a look at the first of these patches. I think it's generally
ok, but:

-    TestLib::system_or_bail('initdb', '-D', $pgdata, '-A', 'trust', '-N',
+    TestLib::system_or_bail('initdb', '-D', $pgdata, '-A', 'trust',
+        $self->at_least_version("9.3") ? '-N' : (),
         @{ $params{extra} });

I'd rather do this in two steps to make it clearer.

I still think just doing pg_ctl -w unconditionally would be simpler.

Prior to 9.3 "unix_socket_directories" was spelled
"unix_socket_directory". We should just set a variable appropriately and
use it. That should make the changes around that a whole lot simpler.
(c.f. buildfarm code)

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-04-03 18:24:10 Re: [PATCH] Implement motd for PostgreSQL
Previous Message Pavel Stehule 2021-04-03 17:50:38 Re: SELECT Query taking 200 ms on PostgreSQL compared to 4 ms on Oracle after migration.