pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Add tests for reinit.c
8+ messages / 5 participants
[nested] [flat]

* pgsql: Add tests for reinit.c
@ 2018-03-14 13:03 Peter Eisentraut <peter_e@gmx.net>
  2018-03-15 23:41 ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Peter Eisentraut @ 2018-03-14 13:03 UTC (permalink / raw)
  To: pgsql-committers

Add tests for reinit.c

This tests how the different forks of unlogged tables behave in crash
recovery.

Author: David Steele <david@pgmasters.net>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/df411e7c664ee9a2395eb8c7a74ceddea818d489

Modified Files
--------------
src/test/recovery/t/014_unlogged_reinit.pl | 82 ++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Add tests for reinit.c
  2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
@ 2018-03-15 23:41 ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 03:51   ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2018-03-15 23:41 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers@postgresql.org, David Steele <david@pgmasters.net>; Andrew Dunstan <andrew@dunslane.net>

Peter Eisentraut <peter_e@gmx.net> writes:
> Add tests for reinit.c

BTW, buildfarm member jacana hasn't succeeded at this test once.
The failures look like

ok 1 - init fork in base exists
ok 2 - main fork in base exists
error running SQL: 'psql:<stdin>:1: ERROR:  directory "/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG" does not exist'
while running 'psql -XAtq -d port=50531 host=127.0.0.1 dbname='postgres' -f - -v ON_ERROR_STOP=1' with sql 'CREATE TABLESPACE ts1 LOCATION '/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG'' at /home/pgrunner/bf/root/HEAD/pgsql.build/../pgsql/src/test/perl//PostgresNode.pm line 1246.

so I hypothesize that there's something wrong with TestLib::tempdir on
Windows, but no idea what.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Add tests for reinit.c
  2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
  2018-03-15 23:41 ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-16 03:51   ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 13:36     ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2018-03-16 03:51 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-committers@postgresql.org, David Steele <david@pgmasters.net>

I wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> Add tests for reinit.c

> BTW, buildfarm member jacana hasn't succeeded at this test once.
> The failures look like

> ok 1 - init fork in base exists
> ok 2 - main fork in base exists
> error running SQL: 'psql:<stdin>:1: ERROR:  directory "/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG" does not exist'
> while running 'psql -XAtq -d port=50531 host=127.0.0.1 dbname='postgres' -f - -v ON_ERROR_STOP=1' with sql 'CREATE TABLESPACE ts1 LOCATION '/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG'' at /home/pgrunner/bf/root/HEAD/pgsql.build/../pgsql/src/test/perl//PostgresNode.pm line 1246.

> so I hypothesize that there's something wrong with TestLib::tempdir on
> Windows, but no idea what.

After further staring at that, I think it's some sort of mingw path
weirdness.  I notice that the initdb output refers to the PGDATA
directory as

c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/t_014_unlogged_reinit_main_data/pgdata

and then after that we see "pg_ctl start" succeeding with just

/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/t_014_unlogged_reinit_main_data/pgdata

but this isn't working:

/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_esA3

perhaps because it lacks the "c:/mingw/msys/1.0" prefix.

Still no opinion about how to fix it.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Add tests for reinit.c
  2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
  2018-03-15 23:41 ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 03:51   ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-16 13:36     ` David Steele <david@pgmasters.net>
  2018-03-19 08:15       ` Re: pgsql: Add tests for reinit.c Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 1 reply; 8+ messages in thread

From: David Steele @ 2018-03-16 13:36 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Andrew Dunstan <andrew@dunslane.net>; Michael Paquier <michael.paquier@gmail.com>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-committers

On 3/15/18 11:51 PM, Tom Lane wrote:
> I wrote:
>> Peter Eisentraut <peter_e@gmx.net> writes:
>>> Add tests for reinit.c
> 
>> BTW, buildfarm member jacana hasn't succeeded at this test once.
>> The failures look like
> 
>> ok 1 - init fork in base exists
>> ok 2 - main fork in base exists
>> error running SQL: 'psql:<stdin>:1: ERROR:  directory "/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG" does not exist'
>> while running 'psql -XAtq -d port=50531 host=127.0.0.1 dbname='postgres' -f - -v ON_ERROR_STOP=1' with sql 'CREATE TABLESPACE ts1 LOCATION '/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG'' at /home/pgrunner/bf/root/HEAD/pgsql.build/../pgsql/src/test/perl//PostgresNode.pm line 1246.
> 
>> so I hypothesize that there's something wrong with TestLib::tempdir on
>> Windows, but no idea what.
> 
> After further staring at that, I think it's some sort of mingw path
> weirdness.  I notice that the initdb output refers to the PGDATA
> directory as
> 
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/t_014_unlogged_reinit_main_data/pgdata
> 
> and then after that we see "pg_ctl start" succeeding with just
> 
> /home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/t_014_unlogged_reinit_main_data/pgdata
> 
> but this isn't working:
> 
> /home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_esA3
> 
> perhaps because it lacks the "c:/mingw/msys/1.0" prefix.
> 
> Still no opinion about how to fix it.

I looked around for other examples but the only ones I could find are in
the pg_basebackup tests (010_pg_basebackup.pl), which exclude these
calls for Windows.  I don't have a Windows machine to experiment on.

Michael, any thoughts?

-- 
-David
david@pgmasters.net




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Add tests for reinit.c
  2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
  2018-03-15 23:41 ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 03:51   ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 13:36     ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
@ 2018-03-19 08:15       ` Andrew Dunstan <andrew@dunslane.net>
  2018-03-19 13:03         ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
  0 siblings, 1 reply; 8+ messages in thread

From: Andrew Dunstan @ 2018-03-19 08:15 UTC (permalink / raw)
  To: David Steele <david@pgmasters.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; Peter Eisentraut <peter_e@gmx.net>; pgsql-committers

On Sat, Mar 17, 2018 at 12:06 AM, David Steele <david@pgmasters.net> wrote:

> On 3/15/18 11:51 PM, Tom Lane wrote:
> > I wrote:
> >> Peter Eisentraut <peter_e@gmx.net> writes:
> >>> Add tests for reinit.c
> >
> >> BTW, buildfarm member jacana hasn't succeeded at this test once.
> >> The failures look like
> >
> >> ok 1 - init fork in base exists
> >> ok 2 - main fork in base exists
> >> error running SQL: 'psql:<stdin>:1: ERROR:  directory
> "/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG"
> does not exist'
> >> while running 'psql -XAtq -d port=50531 host=127.0.0.1
> dbname='postgres' -f - -v ON_ERROR_STOP=1' with sql 'CREATE TABLESPACE ts1
> LOCATION '/home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/tmp_test_wBGG''
> at /home/pgrunner/bf/root/HEAD/pgsql.build/../pgsql/src/test/perl//PostgresNode.pm
> line 1246.
> >
> >> so I hypothesize that there's something wrong with TestLib::tempdir on
> >> Windows, but no idea what.
> >
> > After further staring at that, I think it's some sort of mingw path
> > weirdness.  I notice that the initdb output refers to the PGDATA
> > directory as
> >
> > c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.
> build/src/test/recovery/tmp_check/t_014_unlogged_reinit_main_data/pgdata
> >
> > and then after that we see "pg_ctl start" succeeding with just
> >
> > /home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/
> tmp_check/t_014_unlogged_reinit_main_data/pgdata
> >
> > but this isn't working:
> >
> > /home/pgrunner/bf/root/HEAD/pgsql.build/src/test/recovery/
> tmp_check/tmp_test_esA3
> >
> > perhaps because it lacks the "c:/mingw/msys/1.0" prefix.
> >
> > Still no opinion about how to fix it.
>
> I looked around for other examples but the only ones I could find are in
> the pg_basebackup tests (010_pg_basebackup.pl), which exclude these
> calls for Windows.  I don't have a Windows machine to experiment on.
>
> Michael, any thoughts?
>
>

The attached fixes it. We should probably put the function or something
like it in TestLib.pm, though. The call to pwd is quite tricky - it needs
to be done pretty much exactly like this, not quite sure why, but direct
calls to "pwd -W" via system() or backticks don't work, only this indirect
call works on jacana.

cheers

andrew

Attachments:

tap-test-fix.patch (application/octet-stream, 922B) download diff --git a/src/test/recovery/t/014_unlogged_reinit.pl b/src/test/recovery/t/014_unlogged_reinit.pl index 5d07a66..e2dbdc0 100644 --- a/src/test/recovery/t/014_unlogged_reinit.pl +++ b/src/test/recovery/t/014_unlogged_reinit.pl @@ -30,8 +30,25 @@ ok(-f "$pgdata/$baseUnloggedPath", 'main fork in base exists'); my $tablespaceDir = TestLib::tempdir; +sub real_dir +{ + my $dir = "$_[0]"; + return $dir unless -d $dir; + use Config; + return $dir unless $Config{osname} eq 'msys'; + use Cwd; + my $here = cwd; + chdir $dir; + $dir = qx{sh -c "pwd -W"}; + chomp $dir; + chdir $here; + return $dir; +} + +my $realTSDir = real_dir($tablespaceDir); + $node->safe_psql('postgres', - "CREATE TABLESPACE ts1 LOCATION '$tablespaceDir'"); + "CREATE TABLESPACE ts1 LOCATION '$realTSDir'"); $node->safe_psql('postgres', 'CREATE UNLOGGED TABLE ts1_unlogged (id int) TABLESPACE ts1');
^ permalink raw reply [nested|flat] 8+ messages in thread

* Re: pgsql: Add tests for reinit.c
  2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
  2018-03-15 23:41 ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 03:51   ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 13:36     ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
  2018-03-19 08:15       ` Re: pgsql: Add tests for reinit.c Andrew Dunstan <andrew@dunslane.net>
@ 2018-03-19 13:03         ` David Steele <david@pgmasters.net>
  2018-03-19 21:58           ` Re: pgsql: Add tests for reinit.c Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  0 siblings, 1 reply; 8+ messages in thread

From: David Steele @ 2018-03-19 13:03 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter_e@gmx.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; pgsql-committers

On 3/19/18 4:15 AM, Andrew Dunstan wrote:
> 
> The attached fixes it. We should probably put the function or something
> like it in TestLib.pm, though. The call to pwd is quite tricky - it
> needs to be done pretty much exactly like this, not quite sure why, but
> direct calls to "pwd -W" via system() or backticks don't work, only this
> indirect call works on jacana.

Thanks for the patch, Andrew!

Peter, would you like me to provide a patch that moves this function to
TestLib.pm?  Happy to do it, just don't want patches crossing in the
night, as it were.

Thanks,
-- 
-David
david@pgmasters.net




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Add tests for reinit.c
  2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
  2018-03-15 23:41 ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 03:51   ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 13:36     ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
  2018-03-19 08:15       ` Re: pgsql: Add tests for reinit.c Andrew Dunstan <andrew@dunslane.net>
  2018-03-19 13:03         ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
@ 2018-03-19 21:58           ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
  2018-03-20 02:03             ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
  0 siblings, 1 reply; 8+ messages in thread

From: Andrew Dunstan @ 2018-03-19 21:58 UTC (permalink / raw)
  To: David Steele <david@pgmasters.net>; +Cc: Peter Eisentraut <peter_e@gmx.net>; Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; pgsql-committers

On Mon, Mar 19, 2018 at 11:33 PM, David Steele <david@pgmasters.net> wrote:
> On 3/19/18 4:15 AM, Andrew Dunstan wrote:
>>
>> The attached fixes it. We should probably put the function or something
>> like it in TestLib.pm, though. The call to pwd is quite tricky - it
>> needs to be done pretty much exactly like this, not quite sure why, but
>> direct calls to "pwd -W" via system() or backticks don't work, only this
>> indirect call works on jacana.
>
> Thanks for the patch, Andrew!
>
> Peter, would you like me to provide a patch that moves this function to
> TestLib.pm?  Happy to do it, just don't want patches crossing in the
> night, as it were.
>

I've reworked it and pushed the fix.

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Add tests for reinit.c
  2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
  2018-03-15 23:41 ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 03:51   ` Re: pgsql: Add tests for reinit.c Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-16 13:36     ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
  2018-03-19 08:15       ` Re: pgsql: Add tests for reinit.c Andrew Dunstan <andrew@dunslane.net>
  2018-03-19 13:03         ` Re: pgsql: Add tests for reinit.c David Steele <david@pgmasters.net>
  2018-03-19 21:58           ` Re: pgsql: Add tests for reinit.c Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
@ 2018-03-20 02:03             ` David Steele <david@pgmasters.net>
  0 siblings, 0 replies; 8+ messages in thread

From: David Steele @ 2018-03-20 02:03 UTC (permalink / raw)
  To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>; +Cc: Peter Eisentraut <peter_e@gmx.net>; Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; pgsql-committers

On 3/19/18 5:58 PM, Andrew Dunstan wrote:
> On Mon, Mar 19, 2018 at 11:33 PM, David Steele <david@pgmasters.net> wrote:
>> On 3/19/18 4:15 AM, Andrew Dunstan wrote:
>>>
>>> The attached fixes it. We should probably put the function or something
>>> like it in TestLib.pm, though. The call to pwd is quite tricky - it
>>> needs to be done pretty much exactly like this, not quite sure why, but
>>> direct calls to "pwd -W" via system() or backticks don't work, only this
>>> indirect call works on jacana.
>>
>> Thanks for the patch, Andrew!
>>
>> Peter, would you like me to provide a patch that moves this function to
>> TestLib.pm?  Happy to do it, just don't want patches crossing in the
>> night, as it were.
>>
> 
> I've reworked it and pushed the fix.

Thanks, Andrew!

-- 
-David
david@pgmasters.net




^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2018-03-20 02:03 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 13:03 pgsql: Add tests for reinit.c Peter Eisentraut <peter_e@gmx.net>
2018-03-15 23:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-16 03:51   ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-16 13:36     ` David Steele <david@pgmasters.net>
2018-03-19 08:15       ` Andrew Dunstan <andrew@dunslane.net>
2018-03-19 13:03         ` David Steele <david@pgmasters.net>
2018-03-19 21:58           ` Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
2018-03-20 02:03             ` David Steele <david@pgmasters.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox