Re: [UNVERIFIED SENDER] Re: Minimal logical decoding on standbys

From: "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>
To: <fabriziomello(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, Rahila Syed <rahila(dot)syed(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, "[pgdg] Robert Haas" <robertmhaas(at)gmail(dot)com>
Subject: Re: [UNVERIFIED SENDER] Re: Minimal logical decoding on standbys
Date: 2021-01-18 11:48:31
Message-ID: c35a57d4-01f8-dcd1-42a9-be835a07b3f6@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 12/15/20 7:24 PM, Fabrízio de Royes Mello wrote:
>
> On Wed, Mar 18, 2020 at 4:50 PM Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com <mailto:alvherre(at)2ndquadrant(dot)com>> wrote:
> >
> >
> > well, not "forever", but:
> >
> > $ make check PROVE_TESTS=t/019_standby_logical_decoding_conflicts.pl
> <http://019_standby_logical_decoding_conflicts.pl> PROVE_FLAGS=-v
> > ...
> > cd /pgsql/source/master/src/test/recovery &&
> TESTDIR='/home/alvherre/mnt/crypt/alvherre/Code/pgsql/build/master/src/test/recovery'
> PATH="/pgsql/build/master/tmp_install/pgsql/install/master/bin:$PATH"
> LD_LIBRARY_PATH="/pgsql/build/master/tmp_install/pgsql/install/master/lib"
>  PGPORT='655432'
> PG_REGRESS='/home/alvherre/mnt/crypt/alvherre/Code/pgsql/build/master/src/test/recovery/../../../src/test/regress/pg_regress'
> REGRESS_SHLIB='/pgsql/build/master/src/test/regress/regress.so'
> /usr/bin/prove -I /pgsql/source/master/src/test/perl/ -I
> /pgsql/source/master/src/test/recovery -v
> t/019_standby_logical_decoding_conflicts.pl
> <http://019_standby_logical_decoding_conflicts.pl>
> > t/019_standby_logical_decoding_conflicts.pl
> <http://019_standby_logical_decoding_conflicts.pl> ..
> > 1..24
> > ok 1 - dropslot on standby created
> > ok 2 - activeslot on standby created
> > # poll_query_until timed out executing this query:
> > # SELECT '0/35C9190' <= replay_lsn AND state = 'streaming' FROM
> pg_catalog.pg_stat_replication WHERE application_name = 'standby';
> > # expecting this output:
> > # t
> > # last actual query output:
> > #
> > # with stderr:
> > Bailout called.  Further testing stopped:  system pg_ctl failed
> > Bail out!  system pg_ctl failed
> > FAILED--Further testing stopped: system pg_ctl failed
> > make: *** [Makefile:19: check] Error 255
> >
>
> After rebase and did minimal tweaks (duplicated oid, TAP tests
> numbering) I'm facing similar problem but in other place:
>
>
> make -C src/test/recovery check
> PROVE_TESTS=t/023_standby_logical_decoding_conflicts.pl
> <http://023_standby_logical_decoding_conflicts.pl> PROVE_FLAGS=-v
> ...
> /usr/bin/mkdir -p '/data/src/pg/main/src/test/recovery'/tmp_check
> cd . && TESTDIR='/data/src/pg/main/src/test/recovery'
> PATH="/d/src/pg/main/tmp_install/home/fabrizio/pgsql/logical-decoding-standby/bin:$PATH"
> LD_LIBRARY_PATH="/d/src/pg/main/tmp_install/home/fabrizio/pgsql/logical-decoding-standby/lib"
>  PGPORT='65432'
> PG_REGRESS='/data/src/pg/main/src/test/recovery/../../../src/test/regress/pg_regress'
> REGRESS_SHLIB='/d/src/pg/main/src/test/regress/regress.so'
> /usr/bin/prove -I ../../../src/test/perl/ -I . -v
> t/023_standby_logical_decoding_conflicts.pl
> <http://023_standby_logical_decoding_conflicts.pl>
> t/023_standby_logical_decoding_conflicts.pl
> <http://023_standby_logical_decoding_conflicts.pl> ..
> 1..24
> ok 1 - dropslot on standby created
> ok 2 - activeslot on standby created
> not ok 3 - dropslot on standby dropped
>
> #   Failed test 'dropslot on standby dropped'
> #   at t/023_standby_logical_decoding_conflicts.pl
> <http://023_standby_logical_decoding_conflicts.pl> line 67.
> #          got: 'logical'
> #     expected: ''
> not ok 4 - activeslot on standby dropped
>
> #   Failed test 'activeslot on standby dropped'
> #   at t/023_standby_logical_decoding_conflicts.pl
> <http://023_standby_logical_decoding_conflicts.pl> line 68.
> #          got: 'logical'
> #     expected: ''
>
>
> TAP tests hang forever in `check_slots_dropped` exactly here:
>
>     # our client should've terminated in response to the walsender error
>     eval {
>         $slot_user_handle->finish;
>     };

3 and 4 were failing because the
ResolveRecoveryConflictWithLogicalSlots() call was missing in
ResolveRecoveryConflictWithSnapshot(): the new version attached adds it.

The new version attached also provides a few changes to make it
compiling on the current master (it was not the case anymore).

I also had to change 023_standby_logical_decoding_conflicts.pl (had to
call $node_standby->create_logical_slot_on_standby($node_master,
'otherslot', 'postgres'); at the very beginning of the "DROP DATABASE
should drops it's slots, including active slots" section)

So that now the tests are passing:

t/023_standby_logical_decoding_conflicts.pl ..
1..24
ok 1 - dropslot on standby created
ok 2 - activeslot on standby created
ok 3 - dropslot on standby dropped
ok 4 - activeslot on standby dropped
ok 5 - pg_recvlogical exited non-zero
#
ok 6 - recvlogical recovery conflict
ok 7 - recvlogical error detail
ok 8 - dropslot on standby created
ok 9 - activeslot on standby created
ok 10 - dropslot on standby dropped
ok 11 - activeslot on standby dropped
ok 12 - pg_recvlogical exited non-zero
#
ok 13 - recvlogical recovery conflict
ok 14 - recvlogical error detail
ok 15 - otherslot on standby created
ok 16 - dropslot on standby created
ok 17 - activeslot on standby created
ok 18 - database dropped on standby
ok 19 - dropslot on standby dropped
ok 20 - activeslot on standby dropped
ok 21 - pg_recvlogical exited non-zero
#
ok 22 - recvlogical recovery conflict
ok 23 - recvlogical error detail
ok 24 - otherslot on standby not dropped
ok
All tests successful.
Files=1, Tests=24,  4 wallclock secs ( 0.02 usr  0.00 sys + 1.27 cusr 
0.37 csys =  1.66 CPU)
Result: PASS

Attached is the new version.

Bertrand

Attachment Content-Type Size
v8-0001-Allow-logical-decoding-on-standby.patch text/plain 9.3 KB
v8-0002-Add-info-in-WAL-records-in-preparation-for-logica.patch text/plain 17.4 KB
v8-0003-Handle-logical-slot-conflicts-on-standby.patch text/plain 24.4 KB
v8-0004-New-TAP-test-for-logical-decoding-on-standby.patch text/plain 20.0 KB
v8-0005-Doc-changes-describing-details-about-logical-deco.patch text/plain 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2021-01-18 12:22:33 Re: ResourceOwner refactoring
Previous Message Bharath Rupireddy 2021-01-18 11:48:29 Re: Narrow the scope of the variable outputstr in logicalrep_write_tuple