Re: Re: In-core regression tests for replication, cascading, archiving, PITR, etc.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: In-core regression tests for replication, cascading, archiving, PITR, etc.
Дата
Msg-id 27550.1449342569@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Re: In-core regression tests for replication, cascading, archiving, PITR, etc.  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> On 11/29/2015 04:28 PM, Noah Misch wrote:
>> Never mutate the filesystem in a BEGIN block, because "perl -c" runs BEGIN
>> blocks.  (Likewise for the BEGIN block this patch adds to TestLib.)

> Yeah, those two lines might belong in an INIT block. "perldoc perlmod" 
> for details.

BTW, if we consider that gospel, why has PostgresNode.pm got this in its
BEGIN block?
# PGHOST is set once and for all through a single series of tests when# this module is loaded.$test_pghost =
$TestLib::windows_os? "127.0.0.1" : TestLib::tempdir_short;$ENV{PGHOST}     = $test_pghost;
 

On non-Windows machines, the call of tempdir_short will result in
filesystem activity, ie creation of a directory.  Offhand it looks like
all of the activity in this BEGIN block could go to an INIT block instead.

I'm also bemused by why there was any question about this being wrong:
# XXX: Should this use PG_VERSION_NUM?$last_port_assigned = 90600 % 16384 + 49152;

If that's not a hard-coded PG version number then I don't know
what it is.  Maybe it would be better to use random() instead,
but surely this isn't good as-is.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Size of Path nodes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Size of Path nodes